Search code examples
javascriptzoomingraphaelpan

raphael js Pan functionality using raphael-pan-zoom


I found a plugin called raphael-pan-zoom that I use to zoom-in and zoom-out my raphaeljs elements in my paper, the zoom worked perfectly, but when I wanted to move the paper to the left, right, top or down I didn't success. I found in the "raphael.pan-zoom.js" the pan function :

pan: function (deltaX, deltaY) {
    },

I don't know what is deltaX and deltaY and how to calculate them, can you help me please. in this jsfiddle you can find an example : http://jsfiddle.net/xperali/g6Xav/4/


Solution

  • version 0.2.1 now has implemented the pan function, the deltaX and deltaY are the number of points in X and Y you want to move the paper.

    panZoom.pan(0, -10);
    

    I've updated the fiddle: http://jsfiddle.net/g6Xav/8/

    Let me now if you have any problems