Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to properly create a Point relative to an Image using FigPanZoom?
    primarykey
    data
    text
    <p>I have an Image that's 5000 pixels by 5000 pixels. It's scaled up and down regularly to fit different parts of the image into the window. </p> <p>I'm making a function that focuses in on different places on the image (like a map) and then zooms into a certain scale that I specify.</p> <p>I pass my point into this function (new Point(2000,2500) for example)) however this always breaks because it's not relative to the image specifically.</p> <p>How do I make the Point relative to the image at the image's given scale at any given time?</p> <p>Additional Info: I'm using the guide here <a href="http://www.adobe.com/devnet/flex/samples/fig_panzoom.html" rel="nofollow">http://www.adobe.com/devnet/flex/samples/fig_panzoom.html</a> for panning and zooming functionality.</p> <p><strong>Solved:</strong></p> <p>One of my pitfalls was that I was using a possible bitmapScaleFactor > 1 which would mess up the scaling. This was the final function that worked for my usage.</p> <pre><code>protected function testFocus(p:Point):void { var content:ContentRectangle = boardViewer._contentRectangle; var panToPoint:PanToPointCommand = new PanToPointCommand(boardViewer, content); var scale:Number = boardViewer.bitmapScaleFactor; var location = new Point((p.x*scale)+content.x, (p.y*scale)+content.y); var center = new Point(boardViewer.width/2, boardViewer.height/2); //Move the point to the center panToPoint.fromPoint = location; panToPoint.toPoint = center; panToPoint.execute(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload