@jsyg/draggable
v1.0.0
Published
Draggable plugin for JSYG framework
Maintainers
Readme
@jsyg/raggable
Draggable plugin for JSYG framework
Demo
http://yannickbochatay.github.io/jsyg-monorepo/docs/draggable
Installation
npm install @jsyg/draggableExample
HTML
<svg width="100%" height="300" class="container">
<rect class="drag" x="5%" width="80" height="40" fill="pink"/>
</svg>
<div class="container">
<div class="drag" style="width:80px;height:40px;background-color:pink"></div>
</div>javascript with es6 bundler
import JSYG from "@jsyg/core"
import Draggable from "@jsyg/draggable"
new Draggable("rect.drag",{
bounds:0, //no overflow
ondrag:function() {
var dim = JSYG(this).getDim();
console.log(dim.x,dim.y);
}
})it also works as a JSYG plugin
import JSYG from "@jsyg/core"
import "@jsyg/draggable"
JSYG(".drag").draggable({
bounds:0, //no overflow
ondrag:function() {
var dim = JSYG(this).getDim();
console.log(dim.x,dim.y);
}
})