gsknbabu Posted July 12, 2018 Share Posted July 12, 2018 Hi, I want to allow the user to either scroll to document bound borders endlessly i.e Infinitely drag on the canvas. Please help!!! Ex: A canvas created with 1000*1000. And Enabled PAN and Zoom on the canvas. Draw a rectangle on the canvas and move the rectangle with mouse to the edge of the boundaries( top,right, bottom, left) it should scroll the the rectangle to the end of the canvas. Right now my issue is I can drag the rectangle till the browser boundaries. I need to allow the rectangle to drag beyond the content so that I can use the full canvas. I can PAN the canvas to move around the browser. Please refer the link https://gojs.net/latest/samples/scrollModes.html where user can start dragging the rectangle to the boundaries, scrolls automatically towards the mouse pointer. Thanks, Naveen. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted July 12, 2018 Share Posted July 12, 2018 Search for "camera pivot" explanation in this subforum to understand how container transform works. As for drag&drop, the idea is to remember mouse position in container local coordinates and then restore it every time mouse moves. http://www.html5gamedevs.com/topic/33198-beginner-using-piximatrix-to-perform-zoom-has-strange-initial-behavior/?tab=comments#comment-190615 has pushPivot / popPivot. Try pushPivot when you start drag and popPivot every frame until mouseup. Quote Link to comment Share on other sites More sharing options...
gsknbabu Posted July 12, 2018 Author Share Posted July 12, 2018 Thanks Ivan. Will try this. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.