Skip to content

PAINTROID-759 Implement Text Tool #120

Merged
juliajulie95 merged 5 commits intoCatrobat:developfrom
Amit-Matth:Paintroid-759
Aug 21, 2025
Merged

PAINTROID-759 Implement Text Tool #120
juliajulie95 merged 5 commits intoCatrobat:developfrom
Amit-Matth:Paintroid-759

Conversation

@Amit-Matth
Copy link
Contributor

@Amit-Matth Amit-Matth commented Jun 4, 2025

This pull request introduces the new Text Tool and a completely revamped BoundingBox for easier and more powerful object editing. It also cleans up how shapes are handled.

PAINTROID-759

New Features and Enhancements

  • Added Text Tool: You can now add text to your drawings! The text can be moved, resized, and rotated using a new, more advanced bounding box.
  • Add comprehensive and reasonable tests for the Text Tool functionality.
  • Made the Bounding Box Smarter: The box that appears around shapes and text is now much better. It has new handles for easier rotation and for stretching edges, and it draws itself more clearly.

Refactorings and Bug Fixes

  • Modify the Bounding Box Code: The way the selection box (BoundingBox) works behind the scenes has been completely updated to support the new features and make it more reliable.
  • Simplified the Shapes Tool: The tool for drawing shapes now uses the new, smarter BoundingBox, making it simpler and more consistent with the Text Tool.
  • Cleaned up Shape Options: Removed the separate "rotate mode" button and rotate parameter for shapes because the new BoundingBox handles rotation more directly.
  • Updated Related Tests: Made sure all the tests for the BoundingBox are up-to-date with these big changes and that everything works as expected.

Checklist

Your checklist for this pull request

Please review the contributing guidelines and wiki pages of this repository.

  • Include the name of the Jira ticket in the PR’s title
  • Add the link to the ticket in Jira in the description of the PR
  • Include a summary of the changes plus the relevant context
  • Choose the proper base branch (develop)
  • Confirm that the changes follow the project’s coding guidelines (Wiki)
  • Verify that the changes generate no compiler or linter warnings
  • Perform a self-review of the changes
  • Verify to commit no other files than the intentionally changed ones
  • Include reasonable and readable tests verifying the added or changed behavior
  • Confirm that new and existing tests pass locally
  • Check that the commits’ message style matches the project’s guideline
  • Verify that your changes do not have any conflicts with the base branch
  • After the PR, verify that all CI checks have passed
  • Add new information to the Wiki

@bakicelebi
Copy link
Contributor

image

In text tool the guide lines are not drawn outside of the canvas. This is not the case for shape tool.

@bakicelebi
Copy link
Contributor

bakicelebi commented Jun 27, 2025

Please merge the bug fixes for the bounding box from this PR here. The logic does not need to be reverted anymore but please revert the guidelines.

Bounding Box Issues

  • Revert Bounding Box Logic: I suggest reverting most of the bounding box logic to its original implementation, as the recent changes were not the intended scope of the ticket and have introduced several problems.
    • Jumpy Scaling: Scaling the bounding box from a corner is described as "jumpy."
    • Edge Scaling: It is not possible to scale the bounding box from its edges; the desired behavior is to "elongate" the shape rather than uniformly scaling it.
    • Rotation Issues: The rotation guide on the bounding box is not functioning correctly. Attempts to rotate by dragging the rotation handle are being misinterpreted as a standard drag action.
    • Alignment and Scaling Problems:
      • The new bounding box does not align well with the shape it contains.
      • Scaling from an edge has a minor, incorrect impact on the overall scale of a rectangle instead of just elongating it.
      • Scaling a circle from an edge results in a uniform scale instead of the expected "elongating" effect, which would turn it into an ellipse.
  • Revert Guidelines: The new visual guidelines for the bounding box are not user-friendly, and the interactions do not work as expected. Please revert.

Text Tool Feedback

  • Positive Feedback:
    • The overall implementation of the text tool is looking really good.
    • The implementation of multiple fonts and text options is very cool, almost 1:1 to kotlin.
    • Props for implementing testcases without being told to!
  • Empty Bounding Box: The bounding box for an empty text element cannot be rotated or scaled until text has been entered.
    • Suggestion 1: Allow the empty text box to be resizable without any initial text.
    • Suggestion 2: Automatically add a dummy text (e.g., "Text") upon creation. If the user deletes this dummy text, display a grayed-out hint (e.g., "Enter text").

UI Nitpicks

  • Carousel Padding: Remove the padding on the left and right sides of the carousel view.
  • Button Styling: Ensure that the text buttons use the same style, including the borderRadius, as the other buttons in the application for a consistent look and feel.

@Amit-Matth Amit-Matth requested a review from bakicelebi July 3, 2025 13:40
@celebi-liebrecht-haas
Copy link

Hi Amit,

Nice work! It works great. But I noticed few bugs and inconsistencies.

image

These buttons should actually visualize what they are doing. Ex. U for underline should be underlined etc.

[ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: type 'Null' is not a subtype of type 'Map<String, dynamic>' in type cast
#0      _$PathCommandFromJson (package:paintroid/core/commands/command_implementation/graphic/path_command.g.dart:11:34)
path_command.g.dart:11
#1      new PathCommand.fromJson (package:paintroid/core/commands/command_implementation/graphic/path_command.dart:48:16)
path_command.dart:48
#2      new Command.fromJson (package:paintroid/core/commands/command_implementation/command.dart:25:28)
command.dart:25
#3      _$CatrobatImageFromJson.<anonymous closure> (package:paintroid/core/models/catrobat_image.g.dart:12:31)
catrobat_image.g.dart:12
#4      MappedListIterable.elementAt (dart:_internal/iterable.dart:442:31)
iterable.dart:442
#5      ListIterator.moveNext (dart:_internal/iterable.dart:371:26)
iterable.dart:371
#6      List.addAll (dart:core-patch/growable_array.dart:324:13)
growable_array.dart:324
#7      CommandManager.clearUndoStack (package:paintroid/core/commands/command_manager/command_manager.dart:54:18)
command_manager.dart:54
#8      CanvasStateProvider.resetCanvasWithNewCommands (package:paintroid/core/provider<…>

Saving it as catrobat project and laoding has issues. Something is broken with serialization. Please add a test for this after fixing it.

Also my previous UI nitpicks are also not fixed:

  • Carousel Padding: Remove the padding on the left and right sides of the carousel view.
  • Button Styling: Ensure that the text buttons use the same style, including the borderRadius, as the other buttons in the application for a consistent look and feel.

@celebi-liebrecht-haas
Copy link

image

This button has no functionality anymore in shapes tool. Please remove.

@juliajulie95
Copy link
Contributor

Good job! Works great

@juliajulie95 juliajulie95 merged commit 18d7c18 into Catrobat:develop Aug 21, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants