Skip to content

Commit 20c1257

Browse files
committed
text: Add doc to screen_position_to_index
1 parent cc1b40a commit 20c1257

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

core/src/display_object/edit_text.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,6 +1506,11 @@ impl<'gc> EditText<'gc> {
15061506
self.0.write(context.gc()).max_chars = value;
15071507
}
15081508

1509+
/// Map the position on the screen to caret index.
1510+
///
1511+
/// This method is used exclusively for placing a caret inside text.
1512+
/// It implements the Flash Player's behavior of placing a caret.
1513+
/// Characters are divided in half, the last line is extended, etc.
15091514
pub fn screen_position_to_index(self, position: Point<Twips>) -> Option<usize> {
15101515
let text = self.0.read();
15111516
let position = self.global_to_local(position)?;

0 commit comments

Comments
 (0)