├── .babelrc
├── .editorconfig
├── .eslintrc.js
├── .gitignore
├── LICENSE
├── README.md
├── build
├── build.js
├── check-versions.js
├── dev-client.js
├── dev-server.js
├── utils.js
├── webpack.base.conf.js
├── webpack.build.js
├── webpack.build.min.js
└── webpack.dev.conf.js
├── config
├── dev.env.js
├── index.js
├── prod.env.js
└── test.env.js
├── index.html
├── package.json
├── screenshot.gif
└── src
├── App.vue
├── index.js
├── main.js
└── vue-drag-resize-rotate.vue
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["es2015", "stage-2"],
3 | "plugins": ["transform-runtime"],
4 | "comments": false
5 | }
6 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | indent_style = space
6 | indent_size = 2
7 | end_of_line = lf
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | parser: 'babel-eslint',
4 | parserOptions: {
5 | sourceType: 'module'
6 | },
7 | // https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
8 | extends: 'standard',
9 | // required to lint *.vue files
10 | plugins: [
11 | 'html'
12 | ],
13 | // add your custom rules here
14 | 'rules': {
15 | // allow paren-less arrow functions
16 | 'arrow-parens': 0,
17 | // allow async-await
18 | 'generator-star-spacing': 0,
19 | "no-new": 0,
20 | "space-before-function-paren":0,
21 | "no-useless-call":0,
22 |
23 | // allow debugger during development
24 | 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules/
3 | dist/
4 | npm-debug.log
5 | test/unit/coverage
6 | test/e2e/reports
7 | selenium-debug.log
8 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 tigerlove
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | a vue2 component. Taking a cue from react-resizable and react-draggable.
2 |
3 | 
4 |
5 | ## Install
6 | ```
7 | npm install vue-drag-resize-rotate
8 | ```
9 |
10 | ## Usage
11 | ```
12 |
13 |
14 |
15 | I can be dragged anywhere
16 |
17 |
18 |
19 | I can only be moved in any parent.
20 |
21 |
22 |
25 |
26 | I can only be dragged horizonally
27 |
28 |
29 | I can only be dragged vertically
30 |
31 |
32 | drag here
33 | lalalalaala
34 |
35 |
36 | don't drag here
37 | lalalalaala
38 |
39 |
40 |
41 | snap to 50 * 50
42 |
43 |
44 | I can only be moved 100px in any direction.
45 |
46 |
47 |
48 |
51 |
65 | ```
66 |
--------------------------------------------------------------------------------
/build/build.js:
--------------------------------------------------------------------------------
1 | // https://github.com/shelljs/shelljs
2 | require('./check-versions')()
3 | require('shelljs/global')
4 | env.NODE_ENV = 'production'
5 |
6 | var path = require('path')
7 | var config = require('../config')
8 | var ora = require('ora')
9 | var webpack = require('webpack')
10 | var webpackConfig = require('./webpack.prod.conf')
11 |
12 | console.log(
13 | ' Tip:\n' +
14 | ' Built files are meant to be served over an HTTP server.\n' +
15 | ' Opening index.html over file:// won\'t work.\n'
16 | )
17 |
18 | var spinner = ora('building for production...')
19 | spinner.start()
20 |
21 | var assetsPath = path.join(config.build.assetsRoot, config.build.assetsSubDirectory)
22 | rm('-rf', assetsPath)
23 | mkdir('-p', assetsPath)
24 | cp('-R', 'static/*', assetsPath)
25 |
26 | webpack(webpackConfig, function (err, stats) {
27 | spinner.stop()
28 | if (err) throw err
29 | process.stdout.write(stats.toString({
30 | colors: true,
31 | modules: false,
32 | children: false,
33 | chunks: false,
34 | chunkModules: false
35 | }) + '\n')
36 | })
37 |
--------------------------------------------------------------------------------
/build/check-versions.js:
--------------------------------------------------------------------------------
1 | var semver = require('semver')
2 | var chalk = require('chalk')
3 | var packageConfig = require('../package.json')
4 | var exec = function (cmd) {
5 | return require('child_process')
6 | .execSync(cmd).toString().trim()
7 | }
8 |
9 | var versionRequirements = [
10 | {
11 | name: 'node',
12 | currentVersion: semver.clean(process.version),
13 | versionRequirement: packageConfig.engines.node
14 | },
15 | {
16 | name: 'npm',
17 | currentVersion: exec('npm --version'),
18 | versionRequirement: packageConfig.engines.npm
19 | }
20 | ]
21 |
22 | module.exports = function () {
23 | var warnings = []
24 | for (var i = 0; i < versionRequirements.length; i++) {
25 | var mod = versionRequirements[i]
26 | if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
27 | warnings.push(mod.name + ': ' +
28 | chalk.red(mod.currentVersion) + ' should be ' +
29 | chalk.green(mod.versionRequirement)
30 | )
31 | }
32 | }
33 |
34 | if (warnings.length) {
35 | console.log('')
36 | console.log(chalk.yellow('To use this template, you must update following to modules:'))
37 | console.log()
38 | for (var i = 0; i < warnings.length; i++) {
39 | var warning = warnings[i]
40 | console.log(' ' + warning)
41 | }
42 | console.log()
43 | process.exit(1)
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/build/dev-client.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | require('eventsource-polyfill')
3 | var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true')
4 |
5 | hotClient.subscribe(function (event) {
6 | if (event.action === 'reload') {
7 | window.location.reload()
8 | }
9 | })
10 |
--------------------------------------------------------------------------------
/build/dev-server.js:
--------------------------------------------------------------------------------
1 | require('./check-versions')()
2 | var config = require('../config')
3 | if (!process.env.NODE_ENV) process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV)
4 | var path = require('path')
5 | var express = require('express')
6 | var webpack = require('webpack')
7 | var opn = require('opn')
8 | var proxyMiddleware = require('http-proxy-middleware')
9 | var webpackConfig = process.env.NODE_ENV === 'testing'
10 | ? require('./webpack.prod.conf')
11 | : require('./webpack.dev.conf')
12 |
13 | // default port where dev server listens for incoming traffic
14 | var port = process.env.PORT || config.dev.port
15 | // Define HTTP proxies to your custom API backend
16 | // https://github.com/chimurai/http-proxy-middleware
17 | var proxyTable = config.dev.proxyTable
18 |
19 | var app = express()
20 | var compiler = webpack(webpackConfig)
21 |
22 | var devMiddleware = require('webpack-dev-middleware')(compiler, {
23 | publicPath: webpackConfig.output.publicPath,
24 | stats: {
25 | colors: true,
26 | chunks: false
27 | }
28 | })
29 |
30 | var hotMiddleware = require('webpack-hot-middleware')(compiler)
31 | // force page reload when html-webpack-plugin template changes
32 | compiler.plugin('compilation', function (compilation) {
33 | compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) {
34 | hotMiddleware.publish({ action: 'reload' })
35 | cb()
36 | })
37 | })
38 |
39 | // proxy api requests
40 | Object.keys(proxyTable).forEach(function (context) {
41 | var options = proxyTable[context]
42 | if (typeof options === 'string') {
43 | options = { target: options }
44 | }
45 | app.use(proxyMiddleware(context, options))
46 | })
47 |
48 | // handle fallback for HTML5 history API
49 | app.use(require('connect-history-api-fallback')())
50 |
51 | // serve webpack bundle output
52 | app.use(devMiddleware)
53 |
54 | // enable hot-reload and state-preserving
55 | // compilation error display
56 | app.use(hotMiddleware)
57 |
58 | // serve pure static assets
59 | var staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory)
60 | app.use(staticPath, express.static('./static'))
61 |
62 | module.exports = app.listen(port, function (err) {
63 | if (err) {
64 | console.log(err)
65 | return
66 | }
67 | var uri = 'http://localhost:' + port
68 | console.log('Listening at ' + uri + '\n')
69 |
70 | // when env is testing, don't need open it
71 | if (process.env.NODE_ENV !== 'testing') {
72 | opn(uri)
73 | }
74 | })
75 |
--------------------------------------------------------------------------------
/build/utils.js:
--------------------------------------------------------------------------------
1 | var path = require('path')
2 | var config = require('../config')
3 | var ExtractTextPlugin = require('extract-text-webpack-plugin')
4 |
5 | exports.assetsPath = function (_path) {
6 | var assetsSubDirectory = process.env.NODE_ENV === 'production'
7 | ? config.build.assetsSubDirectory
8 | : config.dev.assetsSubDirectory
9 | return path.posix.join(assetsSubDirectory, _path)
10 | }
11 |
12 | exports.cssLoaders = function (options) {
13 | options = options || {}
14 | // generate loader string to be used with extract text plugin
15 | function generateLoaders (loaders) {
16 | var sourceLoader = loaders.map(function (loader) {
17 | var extraParamChar
18 | if (/\?/.test(loader)) {
19 | loader = loader.replace(/\?/, '-loader?')
20 | extraParamChar = '&'
21 | } else {
22 | loader = loader + '-loader'
23 | extraParamChar = '?'
24 | }
25 | return loader + (options.sourceMap ? extraParamChar + 'sourceMap' : '')
26 | }).join('!')
27 |
28 | // Extract CSS when that option is specified
29 | // (which is the case during production build)
30 | if (options.extract) {
31 | return ExtractTextPlugin.extract('vue-style-loader', sourceLoader)
32 | } else {
33 | return ['vue-style-loader', sourceLoader].join('!')
34 | }
35 | }
36 |
37 | // http://vuejs.github.io/vue-loader/en/configurations/extract-css.html
38 | return {
39 | css: generateLoaders(['css']),
40 | postcss: generateLoaders(['css']),
41 | less: generateLoaders(['css', 'less']),
42 | sass: generateLoaders(['css', 'sass?indentedSyntax']),
43 | scss: generateLoaders(['css', 'sass']),
44 | stylus: generateLoaders(['css', 'stylus']),
45 | styl: generateLoaders(['css', 'stylus'])
46 | }
47 | }
48 |
49 | // Generate loaders for standalone style files (outside of .vue)
50 | exports.styleLoaders = function (options) {
51 | var output = []
52 | var loaders = exports.cssLoaders(options)
53 | for (var extension in loaders) {
54 | var loader = loaders[extension]
55 | output.push({
56 | test: new RegExp('\\.' + extension + '$'),
57 | loader: loader
58 | })
59 | }
60 | return output
61 | }
62 |
--------------------------------------------------------------------------------
/build/webpack.base.conf.js:
--------------------------------------------------------------------------------
1 | var path = require('path')
2 | var config = require('../config')
3 | var utils = require('./utils')
4 | var projectRoot = path.resolve(__dirname, '../')
5 |
6 | var env = process.env.NODE_ENV
7 | // check env & config/index.js to decide whether to enable CSS source maps for the
8 | // various preprocessor loaders added to vue-loader at the end of this file
9 | var cssSourceMapDev = (env === 'development' && config.dev.cssSourceMap)
10 | var useCssSourceMap = cssSourceMapDev
11 |
12 | module.exports = {
13 | entry: {
14 | app: './src/main.js'
15 | },
16 | output: {
17 | path: config.build.assetsRoot,
18 | publicPath: process.env.NODE_ENV === 'production' ? config.build.assetsPublicPath : config.dev.assetsPublicPath,
19 | filename: '[name].js'
20 | },
21 | devtool: "#source-map",
22 | resolve: {
23 | extensions: ['', '.js', '.vue', '.json'],
24 | fallback: [path.join(__dirname, '../node_modules')],
25 | alias: {
26 | 'vue$': 'vue/dist/vue.common.js',
27 | 'src': path.resolve(__dirname, '../src'),
28 | 'assets': path.resolve(__dirname, '../src/assets'),
29 | 'components': path.resolve(__dirname, '../src/components')
30 | }
31 | },
32 | resolveLoader: {
33 | fallback: [path.join(__dirname, '../node_modules')]
34 | },
35 | module: {
36 | preLoaders: [
37 | {
38 | test: /\.vue$/,
39 | loader: 'eslint',
40 | include: projectRoot,
41 | exclude: /node_modules/
42 | },
43 | {
44 | test: /\.js$/,
45 | loader: 'eslint',
46 | include: projectRoot,
47 | exclude: /node_modules/
48 | }
49 | ],
50 | loaders: [
51 | {
52 | test: /\.vue$/,
53 | loader: 'vue'
54 | },
55 | {
56 | test: /\.js$/,
57 | loader: 'babel',
58 | include: projectRoot,
59 | exclude: /node_modules/
60 | },
61 | {
62 | test: /\.json$/,
63 | loader: 'json'
64 | },
65 | {
66 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
67 | loader: 'url',
68 | query: {
69 | limit: 10000,
70 | name: utils.assetsPath('img/[name].[hash:7].[ext]')
71 | }
72 | },
73 | {
74 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
75 | loader: 'url',
76 | query: {
77 | limit: 10000,
78 | name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
79 | }
80 | }
81 | ]
82 | },
83 | eslint: {
84 | formatter: require('eslint-friendly-formatter')
85 | },
86 | vue: {
87 | loaders: utils.cssLoaders({ sourceMap: useCssSourceMap }),
88 | postcss: [
89 | require('autoprefixer')({
90 | browsers: ['last 2 versions']
91 | })
92 | ]
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/build/webpack.build.js:
--------------------------------------------------------------------------------
1 | var config = require('./webpack.base.conf.js')
2 |
3 | config.entry = {
4 | 'vue-drag-resize-rotate': 'src/index.js',
5 | }
6 |
7 | config.output = {
8 | filename: 'dist/[name].js',
9 | library: 'VueDragResizeRotate',
10 | libraryTarget: 'umd'
11 | }
12 |
13 | module.exports = config
14 |
--------------------------------------------------------------------------------
/build/webpack.build.min.js:
--------------------------------------------------------------------------------
1 | var config = require('./webpack.build.js')
2 | var webpack = require('webpack')
3 |
4 |
5 | config.output.filename = config.output.filename.replace(/\.js$/, '.min.js')
6 |
7 | delete config.devtool
8 |
9 | config.plugins = [
10 | new webpack.DefinePlugin({
11 | 'process.env': {
12 | NODE_ENV: '"production"'
13 | }
14 | }),
15 | new webpack.optimize.UglifyJsPlugin({
16 | sourceMap: false,
17 | compress: {
18 | warnings: false
19 | }
20 | }),
21 | new webpack.optimize.OccurenceOrderPlugin()
22 | ]
23 |
24 | module.exports = config
--------------------------------------------------------------------------------
/build/webpack.dev.conf.js:
--------------------------------------------------------------------------------
1 | var config = require('../config')
2 | var webpack = require('webpack')
3 | var merge = require('webpack-merge')
4 | var utils = require('./utils')
5 | var baseWebpackConfig = require('./webpack.base.conf')
6 | var HtmlWebpackPlugin = require('html-webpack-plugin')
7 |
8 | // add hot-reload related code to entry chunks
9 | Object.keys(baseWebpackConfig.entry).forEach(function (name) {
10 | baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name])
11 | })
12 |
13 | module.exports = merge(baseWebpackConfig, {
14 | module: {
15 | loaders: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap })
16 | },
17 | // eval-source-map is faster for development
18 | devtool: '#eval-source-map',
19 | plugins: [
20 | new webpack.DefinePlugin({
21 | 'process.env': config.dev.env
22 | }),
23 | // https://github.com/glenjamin/webpack-hot-middleware#installation--usage
24 | new webpack.optimize.OccurrenceOrderPlugin(),
25 | new webpack.HotModuleReplacementPlugin(),
26 | new webpack.NoErrorsPlugin(),
27 | // https://github.com/ampedandwired/html-webpack-plugin
28 | new HtmlWebpackPlugin({
29 | filename: 'index.html',
30 | template: 'index.html',
31 | inject: true
32 | })
33 | ]
34 | })
35 |
--------------------------------------------------------------------------------
/config/dev.env.js:
--------------------------------------------------------------------------------
1 | var merge = require('webpack-merge')
2 | var prodEnv = require('./prod.env')
3 |
4 | module.exports = merge(prodEnv, {
5 | NODE_ENV: '"development"'
6 | })
7 |
--------------------------------------------------------------------------------
/config/index.js:
--------------------------------------------------------------------------------
1 | // see http://vuejs-templates.github.io/webpack for documentation.
2 | var path = require('path')
3 |
4 | module.exports = {
5 | build: {
6 | env: require('./prod.env'),
7 | index: path.resolve(__dirname, '../dist/index.html'),
8 | assetsRoot: path.resolve(__dirname, '../dist'),
9 | assetsSubDirectory: 'static',
10 | assetsPublicPath: '/',
11 | productionSourceMap: true,
12 | // Gzip off by default as many popular static hosts such as
13 | // Surge or Netlify already gzip all static assets for you.
14 | // Before setting to `true`, make sure to:
15 | // npm install --save-dev compression-webpack-plugin
16 | productionGzip: false,
17 | productionGzipExtensions: ['js', 'css']
18 | },
19 | dev: {
20 | env: require('./dev.env'),
21 | port: 8080,
22 | assetsSubDirectory: 'static',
23 | assetsPublicPath: '/',
24 | proxyTable: {},
25 | // CSS Sourcemaps off by default because relative paths are "buggy"
26 | // with this option, according to the CSS-Loader README
27 | // (https://github.com/webpack/css-loader#sourcemaps)
28 | // In our experience, they generally work as expected,
29 | // just be aware of this issue when enabling this option.
30 | cssSourceMap: false
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/config/prod.env.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | NODE_ENV: '"production"'
3 | }
4 |
--------------------------------------------------------------------------------
/config/test.env.js:
--------------------------------------------------------------------------------
1 | var merge = require('webpack-merge')
2 | var devEnv = require('./dev.env')
3 |
4 | module.exports = merge(devEnv, {
5 | NODE_ENV: '"testing"'
6 | })
7 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | vue-drag-resize-rotate
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vue-drag-resize-rotate",
3 | "version": "2.0.6",
4 | "description": "a vue2 component. Taking a cue from react-resizable and react-draggable.",
5 | "main": "dist/vue-drag-resize-rotate.js",
6 | "scripts": {
7 | "dev": "node build/dev-server.js",
8 | "dist": "webpack --progress --hide-modules --config build/webpack.build.js && cross-env NODE_ENV=production webpack --progress --hide-modules --config build/webpack.build.min.js"
9 | },
10 | "keywords": [
11 | "vue",
12 | "layout",
13 | "vuejs",
14 | "drag",
15 | "draggable",
16 | "resize",
17 | "resizeable",
18 | "rotate",
19 | "rotatable"
20 | ],
21 | "files": [
22 | "dist",
23 | "src/vue-drag-resize-rotate.vue"
24 | ],
25 | "author": "corleonelou@qq.com",
26 | "license": "MIT",
27 | "dependencies": {
28 | "lodash": "^4.17.4",
29 | "victor": "^1.1.0",
30 | "vue": "^2.1.8"
31 | },
32 | "devDependencies": {
33 | "vue-loader": "^10.0.0",
34 | "webpack": "^1.14.0",
35 | "autoprefixer": "^6.4.0",
36 | "babel-core": "^6.0.0",
37 | "babel-eslint": "^7.0.0",
38 | "babel-loader": "^6.0.0",
39 | "babel-plugin-transform-runtime": "^6.0.0",
40 | "babel-preset-es2015": "^6.0.0",
41 | "babel-preset-stage-2": "^6.0.0",
42 | "babel-register": "^6.0.0",
43 | "chai": "^3.5.0",
44 | "chalk": "^1.1.3",
45 | "chromedriver": "^2.21.2",
46 | "connect-history-api-fallback": "^1.1.0",
47 | "cross-env": "^3.1.3",
48 | "cross-spawn": "^4.0.2",
49 | "css-loader": "^0.25.0",
50 | "eslint": "^3.7.1",
51 | "eslint-config-airbnb-base": "^8.0.0",
52 | "eslint-config-standard": "^6.1.0",
53 | "eslint-friendly-formatter": "^2.0.5",
54 | "eslint-import-resolver-webpack": "^0.6.0",
55 | "eslint-loader": "^1.5.0",
56 | "eslint-plugin-html": "^1.3.0",
57 | "eslint-plugin-import": "^1.16.0",
58 | "eslint-plugin-promise": "^3.4.0",
59 | "eslint-plugin-standard": "^2.0.1",
60 | "eventsource-polyfill": "^0.9.6",
61 | "express": "^4.13.3",
62 | "extract-text-webpack-plugin": "^1.0.1",
63 | "file-loader": "^0.9.0",
64 | "function-bind": "^1.0.2",
65 | "html-webpack-plugin": "^2.8.1",
66 | "http-proxy-middleware": "^0.17.2",
67 | "inject-loader": "^2.0.1",
68 | "isparta-loader": "^2.0.0",
69 | "json-loader": "^0.5.4",
70 | "lolex": "^1.4.0",
71 | "mocha": "^3.1.0",
72 | "opn": "^4.0.2",
73 | "ora": "^0.3.0",
74 | "semver": "^5.3.0",
75 | "shelljs": "^0.7.4",
76 | "sinon": "^1.17.3",
77 | "sinon-chai": "^2.8.0",
78 | "url-loader": "^0.5.7",
79 | "vue-style-loader": "^1.0.0",
80 | "vue-template-compiler": "^2.1.0",
81 | "webpack-dev-middleware": "^1.8.3",
82 | "webpack-dev-server": "^1.16.2",
83 | "webpack-hot-middleware": "^2.12.2",
84 | "webpack-merge": "^0.14.1"
85 | },
86 | "engines": {
87 | "node": ">= 4.0.0",
88 | "npm": ">= 3.0.0"
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/screenshot.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tigerlove/vue-drag-resize-rotate/7396dda0d08f508249f2ba806f3625aaa8f9fa47/screenshot.gif
--------------------------------------------------------------------------------
/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | I can be dragged anywhere
5 |
6 |
7 |
8 | I can only be moved in any parent.
9 |
10 |
11 |
14 |
15 | I can only be dragged horizonally
16 |
17 |
18 | I can only be dragged vertically
19 |
20 |
21 | drag here
22 | lalalalaala
23 |
24 |
25 | don't drag here
26 | lalalalaala
27 |
28 |
29 |
30 | snap to 50 * 50
31 |
32 |
33 | I can only be moved 100px in any direction.
34 |
35 |
36 |
37 |
40 |
54 |
--------------------------------------------------------------------------------
/src/index.js:
--------------------------------------------------------------------------------
1 | import VueDragResizeRotate from './vue-drag-resize-rotate.vue'
2 | module.exports = VueDragResizeRotate
3 |
--------------------------------------------------------------------------------
/src/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import App from './App'
3 | new Vue({
4 | el: '#app',
5 | components: {
6 | App
7 | },
8 | render: h => h(App)
9 | })
10 |
--------------------------------------------------------------------------------
/src/vue-drag-resize-rotate.vue:
--------------------------------------------------------------------------------
1 |
44 |
45 |
46 |
51 |
52 |
53 |
377 |
--------------------------------------------------------------------------------