The OpenD Programming Language

TextLayouter.offsetOfClick

Selections have two parts: an anchor (typically set to where the user clicked the mouse down) and a focus (typically where the user released the mouse button). As you click and drag, you want to change the focus while keeping the anchor the same.

The caret is drawn at the focus. If the anchor and focus are the same point, the selection is empty.

Please note that the selection focus is different than a keyboard focus. (I'd personally prefer to call it a terminus, but I'm trying to use the same terminology as the web standards, even if I don't like it.)

After calling this, you don't need to call relayout(), but you might want to redraw to show the user the result of this action.

class TextLayouter
int
offsetOfClick

Meta