Skip to main content
Participant
May 25, 2009
Question

Get Position under MouseCursor

  • May 25, 2009
  • 1 reply
  • 981 views

Hi,

I want to use Drag and Drop functionality within TLF. I implemented a version where I can drop an image on the TLF-Container and it is inserted on the current cursor position (activePosition). But I want to insert the image at the position where the mouseUp event happens which is not equal to the active position. (How) is it possible to get the TextFlow position where the mouse is currently over in order to insert the target correctly?

This topic has been closed for replies.

1 reply

Adobe Employee
May 26, 2009

There is a static tlf_internal function in SelectionManager you can try out.

computeSelectionIndex(textFlow:TextFlow, target:Object, currentTarget:Object, localX:Number,localY:Number):int

textFlow is the TextFlow of interest

target would normally be the current container in your case.

currentTarget is the object localX and localY are relative to.   Normally the same as target

localX and localY are the coordinates in currentTarget

The return value is a absolute position in textFlow.  That's the position you want.

This is tlf_internal so its subject to change.  There's been a fair amount of churn recently in the code when target is a container - its more reliable when its a TextLine.  Recent builds are more reliable in the container case.

Hope that helps.

Richard

Inspiring
May 2, 2010

Has this changed in the current version of TLF?