缩放后如何更正文本的轴?鼠标指针似乎对文本位置没有响应。但是当最初创建时,我可以响应鼠标指针拖放我的文本。这是我的示例项目的链接。
var paper = Raphael(document.getElementById("area"), 500, 500);
var attr = {"fill":"red","font-family": "arial", "font-size": "50px","cursor":"move"};
var text = paper.text(250, 250, "Some\nTEST").attr(attr);
start = function () {
this.ox = parseFloat( this.attr("x") );
this.oy = parseFloat( this.attr("y") );
},
move = function (dx, dy) {
this.attr({x: this.ox + dx, y: this.oy + dy});
this.odx = dx;
this.ody = dy;
},
up = function () {
this.attr({cursor:"move"});
};
text.drag(move, start, up);
$("button.fontsize-control").click(function(){
var action = $(this).data("action");
if( action == "down" ){
text.transform("s.80...");
}else{
text.transform("s1.2...");
}
});