Raphael.js 2.0.0在IE8中拖放图像无法正常工作(vml)

时间:2011-08-23 14:20:20

标签: svg raphael vml

我正在使用rapahel版本2.0.0,由于某种原因,图像是 没有在IE8中被拖动(开始和移动被解雇但图像不是 移动)没有例外也没有错误...... 我尝试使用1.5.2它的工作,但我没有 onDragOver和snapTo方法,我需要这两种方法!!!

是否有任何人有同样的问题和解决方案?

这是代码:

var start = function () {
   this.onDragOver(function(event){
   this.animate({"x":Raphael.snapTo(this.attr("x"), event.attr("x")
+3, 1), "y":Raphael.snapTo(this.attr("y"), event.attr("y")+3, 1)},
100);
   if(event.data("bin") == 1){this.animate({"opacity": 0.1}, 1000,
function(){this.remove();});}
});
  this.ox = this.type == "rect" || this.type == "image" ?
this.attr("x") : this.attr("cx");
  this.oy = this.type == "rect" || this.type == "image" ?
this.attr("y") : this.attr("cy");
  this.attr({cursor: "move"});
  this.toFront();
};
var move = function (dx, dy) {
       this.attr(this.type=="rect" || this.type == "image" ?{x: this.ox +
dx, y: this.oy + dy}:{cx: this.ox + dx, cy: this.oy + dy});
};
var end = function () {
    //this.animate({"fill-opacity": 1}, 500);
};

var width = 800, height = 450;
var paper = Raphael("canvas", width, height);
var lbl1 = paper.image("img/label.png", 10, 40, 100, 22);
lbl1.drag(move, start, end);

var start = function () { this.onDragOver(function(event){ this.animate({"x":Raphael.snapTo(this.attr("x"), event.attr("x") +3, 1), "y":Raphael.snapTo(this.attr("y"), event.attr("y")+3, 1)}, 100); if(event.data("bin") == 1){this.animate({"opacity": 0.1}, 1000, function(){this.remove();});} }); this.ox = this.type == "rect" || this.type == "image" ? this.attr("x") : this.attr("cx"); this.oy = this.type == "rect" || this.type == "image" ? this.attr("y") : this.attr("cy"); this.attr({cursor: "move"}); this.toFront(); }; var move = function (dx, dy) { this.attr(this.type=="rect" || this.type == "image" ?{x: this.ox + dx, y: this.oy + dy}:{cx: this.ox + dx, cy: this.oy + dy}); }; var end = function () { //this.animate({"fill-opacity": 1}, 500); }; var width = 800, height = 450; var paper = Raphael("canvas", width, height); var lbl1 = paper.image("img/label.png", 10, 40, 100, 22); lbl1.drag(move, start, end);

谢谢!

1 个答案:

答案 0 :(得分:0)

它已修复,只需获取raphael.js v2beta的新副本...... Dmitry更新了它! https://github.com/DmitryBaranovskiy/raphael/tree/2.0