gsknbabu

Infinite Scroll

Recommended Posts

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.

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.