JDK-8090357 : [Text] Make public API's for hit_test/selection
  • Type: Sub-task
  • Component: javafx
  • Sub-Component: graphics
  • Affected Version: 8
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2013-03-28
  • Updated: 2016-03-14
  • Resolved: 2016-03-14
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 9
9Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Description
Public API for hit_test/selection for obtaining the text under cursor, etc. See #RT-29077 for more details.
Comments
As I'm only using the impl_hitTestChar which if i got right will get "public final HitInfo hitTest(Point2D point)" I'm fine with only this method
24-11-2015

As long as the workaround is using public API...
24-11-2015

Sorry, I'm going to have to withdraw the distance test/info for this release. There isn't enough time, and there are workarounds. I will post an easier workaround in JDK-8091012. So, we're left with just the one method for hit testing.
24-11-2015

Alternatively, we could have only the first method, but with the HitInfo object containing a distance value.
24-11-2015

As per discussions in JDK-8091012 and JDK-8136971, I propose the following API for Text. The javadoc will need more work. /** * Maps local point to index in the content. Returns position info for the nearest char found. * * @since 9 */ public final HitInfo hitTest(Point2D point); /** * Maps local point to index in the content. Returns null if point is beyond the given distance to the nearest char. * * @since 9 */ public final HitInfo hitTest(Point2D point, float maxDistance);
24-11-2015

Yes, it is in progress under the new parent issue JDK-8143158. I'll post an API review soon.
17-11-2015

Just to mention it is impossible to implement a code-editor without this API. So I hope you consider makeing this API public for Java9 or all currently available code-editors won't run
17-11-2015

We haven't scoped out the content of JDK 9 yet. It is on the list of possible features for JDK 9.
04-10-2014

But it'll be part of JDK9?
04-10-2014

We have no update on this feature request. It will not happen before JDK 9.
04-10-2014

Any progress on this fundamental issue?
04-10-2014

It can be made to work, see RT-28485.
22-07-2014

Felipe, it also seems like impl_hitTestChar works fine on Text nodes, but not when contained in a TextFlow (the hit stops working after moving the mouse after a certain amount of characters). Any workarounds?
16-07-2014

1) I hope so, but that is not the highest priority. 2) Nobody has request that till now, please open a bug report (not hard a thing to do). 3) Not in the plan at this time. We use logical navigation like Windows does. This is something we should address together with (1). >SWT's text layout should be an inspiration, as it just works :) Thanks! I implement it ;-)
14-07-2014

Thanks Felipe. 1) Will there also be something like TextLayout and LineBreakMeasurer? Without those, it's hard to make text editors for international text in javafx... 2) That also means handling tab characters properly even for hit testing (how to set \t stops in the current API? Seem impossible.) Any plans for this? 3) API for navigating a virtual cursor, as in AWT (next/prev) ? That means understanding BIDI text. SWT's text layout should be an inspiration, as it just works :)
12-07-2014

Yes, FX 9 is a good bet.
09-07-2014

When will there be a hit test api for TextFlow? FX9 ?
08-07-2014

Note: HitInfo#isLeading is bad API as it doesn't make easy to handle clusters. Changing that a int field would probably fix RT-26961.
03-07-2014

Thanks for the clarification.
28-03-2013

Yes Kevin, I asked Edub to create a new jira for Text. In Text we already have the functionality implemented (and exposed to controls by impl* methods). It is matter to deciding how to expose in a public API (much easier). TextFlow has nothing, and the same set of API does not apply. It will need something similar to DOM Range (harder). I felt it was better to track the two efforts in separate bugs.
28-03-2013

Why is this a separate feature request from RT-29077 then?
28-03-2013