JDK-8098203 : need utility methods for converting to/from screen coordinates
  • Type: Enhancement
  • Component: javafx
  • Sub-Component: scenegraph
  • Affected Version: fx2.0
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2009-02-02
  • Updated: 2015-06-12
  • Resolved: 2013-01-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8
8Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Description
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
       }
   }
Comments
Verified for 8.0 b122
07-01-2014

Yes, javafx.scene.NodeTest#testLocalToScreen javafx.scene.NodeTest#testScreenToLocal
01-03-2013

Are there any unit tests on this feature?
01-03-2013

We've had several requests for this.
23-07-2009

Consider for Marina
03-02-2009