i'm trying to do an app that when u click outside a figure it let you pan the viewport using setviewbox(); i have done something close to it, but i'm not pleased with it, i'm using a rectangle:
canvas = new Raphael(0,0,canvas_size, canvas_size);
var rectan = paper.rect(0,0,canvas_size,ca开发者_如何学JAVAnvas_size);
using .drag(move,dragger,up);
and in the function of move
var bboxx=this.getBBox(false)
paper.setViewBox(bboxx.x,bboxx.y,canvas_size,canvas_size,true);
this.toBack();
i send back so it cant mess with the others objects animations(drag....) it works but i still need to know if is possible and better click/ touch on the canvas instead of the rectangle
I recommend tihs library for panning and zooming, works great for me.
https://github.com/andrewseddon/raphael-zpd
Then if you want to pan only when click outside a shape, you just need to prevent or stop the events when click on any shape.
精彩评论