|
Duplicate :
|
|
|
Relates :
|
|
|
Relates :
|
|
|
Relates :
|
Right now there is no convenient way for fx code to convert points to/from screen coordinates.
We should add these utitilites to the api to make it easier out of the box:
e.g. from Stephen Chin's library:
protected function screenToLocal(screenX:Integer, screenY:Integer):Point2D {
return sceneToLocal(screenX - scene.x - scene.stage.x, screenY - scene.y - scene.stage.y);
}
protected function localToScreen(localX:Integer, localY:Integer):Point2D {
var sceneCoord = localToScene(localX, localY);
return Point2D {
x: sceneCoord.x + scene.x + scene.stage.x
y: sceneCoord.y + scene.y + scene.stage.y
}
}
|