Skip to content

Conversation

@cbentejac
Copy link
Contributor

Description

This PR updates the layout for Text shapes to improve the display of large texts (e.g. image captions) by enabling the text wrapping. Additionally, the text is not centered anymore on the obervation's x- and y-coordinates, which now represent its top-left corner.

Features list

  • Changed the calculation of x and y so that text is now positioned directly at the observation's coordinates, rather than being centered using the implicit width and height.
  • Set the width and height of the Text element to the remaining space from the observation center to the edge of the container, allowing for better text wrapping and layout.
  • Updated wrapMode from Text.NoWrap to Text.Wrap to allow text to wrap within the specified width, improving readability.

@codecov
Copy link

codecov bot commented Oct 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.86%. Comparing base (cff6ac5) to head (1cf9a27).
⚠️ Report is 4 commits behind head on develop.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #2930   +/-   ##
========================================
  Coverage    80.86%   80.86%           
========================================
  Files           57       57           
  Lines         7792     7792           
========================================
  Hits          6301     6301           
  Misses        1491     1491           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@gregoire-dl
Copy link
Member

I have two minor comments, up for discussion:

  • If I’m not mistaken, the shape BaseLayer completely fills the Viewer2D image container. So, you could use parent.width and parent.height instead of relying on ShapeViewerHelper.containerWidth and ShapeViewerHelper.containerHeight.
    That would help to keep ShapeViewerHelper scope focused solely on the automatic positioning of shapes.

  • If the coordinates of a Text shape now represent the top-left corner, you might want to rename textLayer.observation.center.x and textLayer.observation.center.y, for exemple:

    • textLayer.observation.x
    • textLayer.observation.position.x
    • textLayer.observation.coordinates.x
    • textLayer.observation.topLeft.x
    • etc.

    This change should only affect TextLayer.qml, since this shape doesn’t have any associated ShapeAttribute.
    Might be best to do this now, before this shape gets widely used in JSON files.

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.

3 participants