Hello, I just want to drag the 'global' view with the mouse.
I tryed this:
function onMouseDrag(event) {
view.center -= event.delta;
}
But the results isn't really great : https://youtu.be/5fygEzR61eA
Globally it's work but there is some 'bumps'.
note : i prefer do not use jQuery
Thank you
Below code might be less fluctuation. Please try it.
var c = new Point();
function onMouseDown(event){
c = view.center.subtract(event.point)
}
function onMouseDrag(event){
view.center = c.add(event.point);
}
Btw, support questions should be posted to the mailing list: http://groups.google.com/group/paperjs
This is a bug database, thus, please help to keep free from support questions. Thanks.
The example above pans the view relative on each step (drag event). It's a very annoying behavior. Try this to absolutely drag the view like expected. It's 1:1 pixel perfect position.
function onMouseDrag(event) {
// The first lastMousePoint comes from onMouseDown.
lastViewCenter = view.center;
view.center = view.center.add(
lastMousePoint.subtract(event.point)
);
lastMousePoint = event.point.add(view.center.subtract(lastViewCenter));
}

Most helpful comment
The example above pans the view relative on each step (drag event). It's a very annoying behavior. Try this to absolutely drag the view like expected. It's 1:1 pixel perfect position.