Search code examples
javascripthtml5-canvaskineticjs

Zoom in on mouse position in KineticJS


Question:

How do I zoom in on the mouse position on mouse wheel scrolls?

Details:

I am trying to merge this complete solution on Stack Overflow, which allows for zooming of the stage, with this incomplete solution, which allows for zooming in around the mouse when clicked. I have forked the jsfiddle code here. The code works fine once you get it zoomed in, but upon first scrolling, the stage jumps to a different location and I can't figure out why. Can anyone tell me why it is happening, and how to solve it. Thanks.


Solution

  • Just a guess, but you are using the mouse position relative to the page not the canvas