![](/img/trans.png)
[英]Raphael.JS: How drag and drop image dom elements in raphael paper
[英]drag() on array-elements in raphael.js
我将很多Raphael元素放入数组:
var start = function () {
this.ox = this.attr("cx");
this.oy = this.attr("cy");
},
move = function (dx, dy) {
this.attr({cx: this.ox + dx, cy: this.oy + dy});
}
for(var i = 0; i < 149; i++) {
cubes = paper.rect(Math.floor(Math.random()*2000), Math.floor(Math.random()*2000), 0, 0);
cubes.animate({ width: 25, height: 25 }, 500, "bounce");
cubesmixed.push(cubes);
cubesmixed[i].drag(move, start);
}
但不幸的是我无法拖动它们。 最奇怪的是, start
和move
火,因为他们应该。 但是为什么他们不动。
提前致谢!
首先,属性cx,cy用于圆形和椭圆形,因此更新它们不会移动使用x和y属性的矩形。 如果您想同时移动它们(这是我开始阅读您的问题时的第一印象-但现在我不太确定:),那么请参考此问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.