5000ピクセル×5000ピクセルの画像があります。画像のさまざまな部分がウィンドウに収まるように、定期的に拡大および縮小されます。
画像のさまざまな場所(地図など)に焦点を合わせてから、指定した特定の縮尺にズームインする関数を作成しています。
私は自分のポイントをこの関数(たとえばnew Point(2000,2500))に渡しますが、これは特に画像に関連していないため、常に壊れます。
いつでも画像の指定された縮尺で画像に対してポイントを作成するにはどうすればよいですか?
追加情報:パンとズーム機能については、こちらのガイドhttp://www.adobe.com/devnet/flex/samples/fig_panzoom.htmlを使用しています。
解決済み:
私の落とし穴の1つは、スケーリングを台無しにする可能性のあるbitmapScaleFactor>1を使用していたことでした。これが私の使用法で機能した最後の関数でした。
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();
}