All Projects → probil → Vue Moveable

probil / Vue Moveable

Licence: mit
↔️ ↕️ 🔄 Vue.js wrapper for Moveable

Projects that are alternatives of or similar to Vue Moveable

TNImageView-Android
Android Library for making scale-able and rotatable image views or giving this power to your own image view. This repo has been depreciated.
Stars: ✭ 18 (-97.73%)
Mutual labels:  scalable, draggable, resizable
Moveable
Moveable! Draggable! Resizable! Scalable! Rotatable! Warpable! Pinchable! Groupable! Snappable!
Stars: ✭ 6,378 (+705.3%)
Mutual labels:  scalable, draggable, resizable
react-mops
🐶 Modify Orientation Position Size
Stars: ✭ 40 (-94.95%)
Mutual labels:  draggable, resizable
vue-drr
A Vue2 component for draggable, resizable, rotatable elements
Stars: ✭ 34 (-95.71%)
Mutual labels:  draggable, resizable
Svelte Grid
A responsive, draggable and resizable grid layout, for Svelte.
Stars: ✭ 473 (-40.28%)
Mutual labels:  draggable, resizable
React Rnd
🖱 A resizable and draggable component for React.
Stars: ✭ 2,560 (+223.23%)
Mutual labels:  draggable, resizable
Photoviewer
🌀 A JS plugin to view images just like in Windows.
Stars: ✭ 203 (-74.37%)
Mutual labels:  draggable, resizable
vue-drag-resize-rotate
一个Vue组件,支持拖拽,拉伸,旋转,放缩,自动对齐;A Vue component that supports dragging, stretching, rotating, scaling, and auto-alignment;
Stars: ✭ 42 (-94.7%)
Mutual labels:  draggable, resizable
Vue3 Draggable Resizable
[Vue3 组件] 用于拖拽调整位置和大小的的组件,同时支持冲突检测,元素吸附对齐,实时参考线。
Stars: ✭ 159 (-79.92%)
Mutual labels:  draggable, resizable
Qt Nice Frameless Window
Qt Frameless Window for both Windows and OS X, support Aero Snap, drop shadow on Windows, and support Native Style such as round corner, drop shadow on OS X. Based on QMainWindow.
Stars: ✭ 430 (-45.71%)
Mutual labels:  draggable, resizable
Magnify
🖼 A jQuery plugin to view images just like in Windows. Browser support IE7+!
Stars: ✭ 177 (-77.65%)
Mutual labels:  draggable, resizable
Angular2 Draggable
Angular directive (for version >= 2.x ) that makes the DOM element draggable and resizable
Stars: ✭ 270 (-65.91%)
Mutual labels:  draggable, resizable
Vue Draggable Resizable
Vue2 Component for draggable and resizable elements.
Stars: ✭ 2,431 (+206.94%)
Mutual labels:  draggable, resizable
Jspanel4
A JavaScript library to create highly configurable floating panels, modals, tooltips, hints/notifiers/alerts or contextmenus for use in backend solutions and other web applications.
Stars: ✭ 217 (-72.6%)
Mutual labels:  draggable, resizable
Angular Grid Layout
Responsive grid with draggable and resizable items for Angular applications.
Stars: ✭ 163 (-79.42%)
Mutual labels:  draggable, resizable
react-web-editor
The react-web-editor is a WYSIWYG editor library. you can resize and drag your component. It also has simple rich text editor
Stars: ✭ 191 (-75.88%)
Mutual labels:  draggable, resizable
Vue Drag Resize
Vue Component for resize and drag elements
Stars: ✭ 1,007 (+27.15%)
Mutual labels:  draggable, resizable
Vue Responsive Dash
Responsive, Draggable & Resizable Dashboard (Grid) for Vue
Stars: ✭ 128 (-83.84%)
Mutual labels:  draggable, resizable
vue-smart-widget
🗃️Smart widget is a flexible and extensible content container component for Vue2.x / Vue3.x in Next branch.
Stars: ✭ 110 (-86.11%)
Mutual labels:  draggable, resizable
jsPanel3
A jQuery Plugin to create highly configurable floating panels, modals, tooltips, hints/notifiers or contextmenus for use in a backend solution and other web applications.
Stars: ✭ 89 (-88.76%)
Mutual labels:  draggable, resizable

Vue Moveable

npm version github stars license Minified library size React Preact Angular Vue

A Vue Component that create Moveable, Draggable, Resizable, Scalable, Rotatable, Warpable, Pinchable, Groupable, Snappable.

Edit Vue Moveable Demo

Moveable
Draggable Resizable Scalable Rotatable
Warpable Pinchable Groupable Snappable
Clippable Roundable OriginDraggable Selecto

🔥 Features

  • Draggable refers to the ability to drag and move targets.
  • Resizable indicates whether the target's width and height can be increased or decreased.
  • Scalable indicates whether the target's x and y can be scale of transform.
  • Rotatable indicates whether the target can be rotated.
  • Warpable indicates whether the target can be warped (distorted, bented).
  • Pinchable indicates whether the target can be pinched with draggable, resizable, scalable, rotatable.
  • Groupable indicates Whether the targets can be moved in group with draggable, resizable, scalable, rotatable.
  • Snappable indicates whether to snap to the guideline.
  • OriginDraggable* indicates Whether to drag origin.
  • Clippable indicates Whether to clip the target.
  • Roundable indicates Whether to show and drag or double click border-radius.
  • Support SVG Elements (svg, path, line, ellipse, g, rect, ...etc)
  • Support Major Browsers
  • Support 3d Transform

⚙️ Installation

$ npm i vue-moveable

📄 Documents

🚀 How to use

<template>
  <Moveable
    class="moveable"
    v-bind="moveable"
    @drag="handleDrag"
    @resize="handleResize"
    @scale="handleScale"
    @rotate="handleRotate"
    @warp="handleWarp"
    @pinch="handlePinch"
  >
    <span>Vue Moveable</span>
  </Moveable>
</template>
<script>
import Moveable from 'vue-moveable';

export default {
  name: 'app',
  components: {
    Moveable,
  },
  data: () => ({
    moveable: {
      draggable: true,
      throttleDrag: 0,
      resizable: false,
      throttleResize: 1,
      keepRatio: false,
      scalable: true,
      throttleScale: 0,
      rotatable: true,
      throttleRotate: 0,
      pinchable: true, // ["draggable", "resizable", "scalable", "rotatable"]
      origin: false,
    }
  }),
  methods: {
    handleDrag({ target, transform }) {
      console.log('onDrag left, top', transform);
      target.style.transform = transform;
    },
    handleResize({
      target, width, height, delta,
    }) {
      console.log('onResize', width, height);
      delta[0] && (target.style.width = `${width}px`);
      delta[1] && (target.style.height = `${height}px`);
    },
    handleScale({ target, transform, scale }) {
      console.log('onScale scale', scale);
      target.style.transform = transform;
    },
    handleRotate({ target, dist, transform }) {
      console.log('onRotate', dist);
      target.style.transform = transform;
    },
    handleWarp({ target, transform }) {
      console.log('onWarp', transform);
      target.style.transform = transform;
    },
    handlePinch({ target }) {
      console.log('onPinch', target);
    },
  }
}
</script>

Calling moveable methods

All moveable instance methods are supported. Just use reference to call them.

E.g. this.$refs.<moveable_ref>.<moveable_method>.

Here is an example:

<template>
  <Moveable
    ref="moveable"
    class="moveable"
  >
    <span>Vue Moveable</span>
  </Moveable>
</template>
<script>
import Moveable from 'vue-moveable';

export default {
  name: 'app',
  components: {
    Moveable,
  },
  mounted() {
   console.log("getRect: ", this.$refs.moveable.getRect()); 
   // -> getRect: Object {width: 300, height: 200, left: 127, top: 120.5, pos1: Array[2]…}
   console.log("isMoveableElement: ", this.$refs.moveable.isMoveableElement(document.body));
   // -> isMoveableElement: false

  },
}
</script>

Demo: https://codesandbox.io/s/vue-moveable-issue-84-xzblq

Polyfills

Library use few browser built-ins and doesn't include polyfills for them. This ensures you don't include unnecessary polyfills in your code, as it should be the responsibility of the consuming app to include them.

Vue CLI includes them in babel config by default but here is a list (in case you what to add them manually):

# for [email protected]
es6.array.filter
es6.object.keys
es6.symbol        # optional

# for [email protected]
es.array.filter
es.object.keys
es.symbol         # optional

For direct usage in browser consider using https://polyfill.io/v3/

⚙️ Developments

npm run serve

Runs the app in the development mode.
Open http://localhost:8080 to view it in the browser.

The page will reload if you make edits.
You will also see any lint errors in the console.

⭐️ Show Your Support

Please give a ⭐️ if this project helped you!

👏 Contributing

If you have any questions or requests or want to contribute to vue-moveable or other packages, please write the issue or give me a Pull Request freely.

🐞 Bug Report

If you find a bug, please report to us opening a new Issue on GitHub.

📝 License

This project is MIT licensed.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].