wiki:TEXT_INPLACE_EDITOR_R1

Version 8 (modified by dancho, 16 years ago) (diff)

--

Error: Macro BackLinksMenu(None) failed
compressed data is corrupt

Error: Macro TicketQuery(summary=TEXT_INPLACE_EDITOR_R1, format=table, col=summary|owner|status|type|component|priority|effort|importance, rows=description|analysis_owners|analysis_reviewers|analysis_score|design_owners|design_reviewers|design_score|implementation_owners|implementation_reviewers|implementation_score|test_owners|test_reviewers|test_score|) failed
current transaction is aborted, commands ignored until end of transaction block

Analysis

Overview

The inplace editor provides functionality for editing text into the frame where the same text is laid out. Currently editing functionality is present, but the cursor position can be changed only with left and right arrows.

Task requirements

  • The cursor position should be changeable by mouse click on text area.
    • When the user has clicked in the text, the cursor is placed there.
    • When the user has clicked in the text area, but not in the text, the cursor is placed as near as possible to the position where there is text.
  • The cursor position should be changeable by up/down arrows.
    • When the position has characters before/after it on the previous/next row, the cursor goes there
    • When there is no such position, the cursor goes to the first/last character of the row.
    • When there is no such row, the cursor does not change it's position.

Task result

Code.

Implementation idea

Error: Macro Image(textpos.jpg) failed
current transaction is aborted, commands ignored until end of transaction block

Shows behavior on up/down arrows. With red is the carriage, with blue dots is mouse click.

TEXT_INPLACE_EDITOR_R0

How to demo

Show navigation in sample text.

Design

Mouse click navigation

Mouse click navigation logic is going to be placed in the event handling method of the HotTextPlaceLogic class.

It is going to use the modified getHitPos() method present in HotTextLayout for calculating the closest character position to the mouse click position (in relative coordinates). The method finds the line (area) of text, that collides with the mouse position, then iterates trough the character positions in the line to find the one closest (so in the case there are no characters near the horizontal mouse coordinate, the caret will be placed after the last character of the line). The caret position will also have additional calculations to correct the specific case when the user clicks near the middle of a character (in other words, the mouse arrow collides with the character):

Error: Macro Image(mousepoint.PNG) failed
current transaction is aborted, commands ignored until end of transaction block


Red is the mouse click position, blue is where the caret will be placed after the calculation.

Up/Down arrow navigation

Design is still in the making.

Implementation

(Describe and link the implementation results here (from the wiki or the repository).)

Testing

(Place the testing results here.)

Comments

(Write comments for this or later revisions here.)

Attachments