Fixed invalid text selection behaviour 59/258959/1
authorBowon Ryu <bowon.ryu@samsung.com>
Fri, 28 May 2021 08:17:00 +0000 (17:17 +0900)
committerBowon Ryu <bowon.ryu@samsung.com>
Fri, 28 May 2021 08:25:07 +0000 (17:25 +0900)
This patch fixes an issue where selection handles are not updated.
(issue of visual update, not value)

// test case
textField.SetProperty(DevelTextField::Property::PRIMARY_CURSOR_POSITION, 5);
textField.SetProperty(DevelTextField::Property::SELECTED_TEXT_START, 5);
textField.SetProperty(DevelTextField::Property::SELECTED_TEXT_END, 10);

In the test case above, the selection handle is not updated.

* Internal flag status when PRIMARY_CURSOR_POSITION is set :
in SetPrimaryCursorPosition(),

mUpdateCursorPosition = true;

* Internal flag status when SELECTED_TEXT_START, SELECTED_TEXT_END is set :
in SetTextSelectionRange(),

mUpdateHighlightBox = true;
mUpdateLeftSelectionPosition = true;
mUpdateRightSelectionPosition = true;

By the way,
the actual updates such as cursor, selection, grab handle, are handled at once
in ProcessInputEvents() based on the flags above.

In the test case, since mUpdateCursorPosition is true, "else" can not be reached.
That's why the selection handle doesn't update.
This issue is solved by fixing conditional statement.

Also due to this patch,
Issues arising from mPrimaryCursorPosition inside SetTextSelectionRange() are also resolved.

Change-Id: I77890fd3744406a885325e53e2354c1ac9d454d6
Signed-off-by: Bowon Ryu <bowon.ryu@samsung.com>
dali-toolkit/internal/text/text-controller-impl-event-handler.cpp

index 22525db..29f6ba3 100644 (file)
@@ -155,7 +155,10 @@ bool ControllerImplEventHandler::ProcessInputEvents(Controller::Impl& impl)
     eventData->mUpdateCursorPosition     = false;
     eventData->mUpdateGrabHandlePosition = false;
   }
-  else
+
+  if(eventData->mUpdateHighlightBox ||
+     eventData->mUpdateLeftSelectionPosition ||
+     eventData->mUpdateRightSelectionPosition)
   {
     CursorInfo leftHandleInfo;
     CursorInfo rightHandleInfo;