I have a problem when zooming in/out of an image within a scrollviewer. When i use the zoom-in button i use a double animation for the image width/height to 1.25 of its original size each time the button is clicked. The same goes for the zoom-out button which sets the scale factor to 0.75. So far so good.
The problem is that based on where i click relative to the center of the scrollviewer id like to scroll towards the click-point. I calculate a delta x/y based on this which is used to determine the direction of the scrolling on the x and y axes.
double deltaX = (ClickPosition.X - center.X)
double deltaY = (ClickPosition.Y - center.Y)
Now i have to take into account the current zoom factor of the image when applying the delta to the vertical and horizontal scrollbars (which too are animated with a double animation).
When i zoom and scroll at the same time the final position doesnt end up where i expect it to. The origin of the image scaling appears to always be at 0,0 (top left corner) of the image so im not sure how to handle that, hence clicking on the left side of the center gives a stronger scrolling to the left than clicking on the right side of the center.
Example: http://212.214.41.66/SilverlightZoom/RealQImageMapTestPage.html