visualTransformOffset.x = roundf(padding.start + alignmentOffset.x);
visualTransformOffset.y = roundf(padding.top + alignmentOffset.y);
+ mController->SetVisualTransformOffset(visualTransformOffset);
+
Property::Map visualTransform;
visualTransform.Add(Toolkit::Visual::Transform::Property::SIZE, layoutSize)
.Add(Toolkit::Visual::Transform::Property::SIZE_POLICY, Vector2(Toolkit::Visual::Transform::Policy::ABSOLUTE, Toolkit::Visual::Transform::Policy::ABSOLUTE))
CharacterIndex cursorPosition = 0u;
// Convert from control's coords to text's coords.
+
const float xPosition = x - controller.mImpl->mModel->mScrollPosition.x;
const float yPosition = y - controller.mImpl->mModel->mScrollPosition.y;
+ Vector2 visualTransformOffset = controller.mImpl->mModel->mVisualTransformOffset;
+
// Whether to touch point hits on a glyph.
bool matchedCharacter = false;
cursorPosition = Text::GetClosestCursorIndex(controller.mImpl->mModel->mVisualModel,
controller.mImpl->mModel->mLogicalModel,
controller.mImpl->mMetrics,
xPosition,
- yPosition,
+ yPosition - visualTransformOffset.y,
CharacterHitTest::TAP,
matchedCharacter);
return mImpl->mModel->mVisualModel->GetCharacterSpacing();
}
+void Controller::SetVisualTransformOffset(Vector2 offset)
+{
+ mImpl->mModel->mVisualTransformOffset = offset;
+}
+
Controller::UpdateTextType Controller::Relayout(const Size& size, Dali::LayoutDirection::Type layoutDirection)
{
return Relayouter::Relayout(*this, size, layoutDirection);
*/
const float GetCharacterSpacing() const;
+ /**
+ * @brief Sets the visual transform offset.
+ *
+ * @param[in] offset The offset.
+ */
+ void SetVisualTransformOffset(Vector2 offset);
+
public: // Queries & retrieves.
/**
* @brief Return the layout engine.
bool mIgnoreSpacesAfterText : 1; ///< Whether ignoring spaces after text or not. Default is true.
DevelText::MatchLayoutDirection mMatchLayoutDirection; ///< Whether to match text alignment with layout direction or not.
DevelText::EllipsisPosition::Type mEllipsisPosition; ///< Where is the location the text elide
+ Vector2 mVisualTransformOffset; ///< The offset of the layout based on the controller due to alignment.
};
} // namespace Text