我的问题是如何拖放形状,但克隆可拖动形状,并将该克隆拖动到可放置形状。
我是 Konva 的新手。在查看文档和示例时,我可以找到如何拖放形状。
我找到了形状克隆的参考,但我不知道如何做到这一点。
如果有人能告诉我方法,我将不胜感激。
谢谢
rect.on('dragstart', function() {
// stop dragging original rect
rect.stopDrag();
// clone it
var clone = rect.clone({
x : 50,
y : 50
});
// events will also be cloned
// so we need to disable dragstart
clone.off('dragstart');
// then add to layer and start dragging new shape
layer.add(clone);
clone.startDrag();
});
http://jsbin.com/hujulasaro/1/edit?html,js,输出 http://jsbin.com/hujulasaro/1/edit?html,js,output
对于放置事件,请参阅演示:http://konvajs.github.io/docs/drag_and_drop/Drop_Events.html http://konvajs.github.io/docs/drag_and_drop/Drop_Events.html
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)