Snap.svg - drag event handler

后端 未结 6 944
广开言路
广开言路 2021-02-13 12:46

Question is about the onstart event handler for Element.drag in the newly announced Snap.svg.

The intention of the code below is to register event handlers for the start

6条回答
  •  半阙折子戏
    2021-02-13 13:45

    After struggling for some hours to do this with snap.js, I finally discovered svg.js and its draggable plugin, with which it is so much easier:

    var draw = SVG('svg');
    var circle = draw.circle(10).attr({cx:30,cy:30,fill:'#f06'});
    circle.dragend = function(delta, event) {
        alert(this.attr('cx'))
    }
    circle.draggable();
    

    So, I switched to svg.js ...

提交回复
热议问题