我有个问题。我在画布中创建缩放图像,但我无法在 raphaeljs 中传输它如何放大光标坐标?
拉斐尔:http: //jsfiddle.net/qCzqF/2/
function zoomTo (x,y,z) {
c.translate(
originx,
originy
);
c.scale(z,z);
c.translate(
-( x / scale + originx - x / ( scale * z ) ),
-( y / scale + originy - y / ( scale * z ) )
);
originx = ( x / scale + originx - x / ( scale * z ) );
originy = ( y / scale + originy - y / ( scale * z ) );
scale *= z;
画布:http: //jsfiddle.net/JtctY/
function zoomTo (x,y,z) {
context.translate(
originx,
originy
);
context.scale(z,z);
context.translate(
-( x / scale + originx - x / ( scale * z ) ),
-( y / scale + originy - y / ( scale * z ) )
);
originx = ( x / scale + originx - x / ( scale * z ) );
originy = ( y / scale + originy - y / ( scale * z ) );
scale *= z;