selectTextBox method

void selectTextBox(
  1. Offset tapPosition
)

Selects a text box based on the tap position and triggers a UI update if selected.

Implementation

void selectTextBox(Offset tapPosition) {
  for (TextBox textBox in _textBoxes[_currentPage] ?? []) {
    Rect textBoxRect = Rect.fromLTWH(
      textBox.position.dx,
      textBox.position.dy,
      textBox.width,
      textBox.height,
    );

    if (textBoxRect.contains(tapPosition)) {
      notifyListeners(); // Notify if a text box is selected.
      return;
    }
  }
}