Skip to content

SlopeAnnotationsTool: the label is upside down when the slope arrow points left (no readability flip, unlike linear and angle annotations) #849

Open

Description

@cmartif

Describe the bug 📝

SlopeAnnotationsTool._positionLabel (packages/front/src/drawings/DrawingEditor/src/SlopeAnnotationsTool/index.ts, 3.6.0 and main, line 498) rotates the label by the exact angle of the arrow:

labelGroup.rotation.y = Math.atan2(-ann.direction.z, ann.direction.x);

So when the surface slopes down towards the left of the sheet, the label is rotated 180° and reads upside down. When it slopes straight down the sheet, it reads from top to bottom instead of from bottom to top. A slope arrow points downhill, so on a roof plan half of the arrows point left.

The other annotation tools already keep their text readable:

  • LinearAnnotationsTool/index.ts, line 411: if (angle > Math.PI / 2 || angle <= -Math.PI / 2) angle += Math.PI;
  • AngleAnnotationsTool/index.ts, lines 344–345: the same normalization to (−90°, 90°].

Suggested fix (the same rule as the linear annotations; the arrow is unchanged and the label stays on the same side, since its position does not depend on the angle):

let angle = Math.atan2(-ann.direction.z, ann.direction.x);
if (angle > Math.PI / 2 || angle <= -Math.PI / 2) angle += Math.PI;
labelGroup.rotation.y = angle;

The preview label (line 399, same _positionLabel) would follow.

Reproduction ▶️

No response

Steps to reproduce 🔢

  1. Open a technical drawing in the DrawingEditor with SlopeAnnotationsTool in use (it creates the labels).
  2. Add two slope annotations: slopeTool.system.add(drawing, { position: new THREE.Vector3(0, 0, 0), direction: new THREE.Vector3(1, 0, 0), slope: 0.6, style: "default" }), and the same with direction: new THREE.Vector3(-1, 0, 0).
  3. The first label reads normally; the second one is rotated 180° and reads upside down. With direction: new THREE.Vector3(0, 0, 1) (down the sheet) it reads from top to bottom.

System Info 💻

OS: Windows 11 Pro 10.0.26200
Node: 22.17.0 · npm 10.9.2
Browser: Chrome 155
@thatopen/components 3.6.0 · @thatopen/components-front 3.6.0 · @thatopen/fragments 3.6.0 · three 0.185.0

Used Package Manager 📦

npm

Error Trace/Logs 📃

No response

Validations ✅

  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Make sure this is a repository issue and not a framework-specific issue. For example, if it's a THREE.js related bug, it should likely be reported to mrdoob/threejs instead.
  • Check that this is a concrete bug. For Q&A join our Community.
  • The provided reproduction is a minimal reproducible example of the bug.

Activity

  1. Zizou-PM commented on Nov 14, 2026

    @Zizou-PM

    Hi!
    I'd like to take this one. My plan is to apply the same angle
    normalization as LinearAnnotationsTool (lines 388/411) inside
    _positionLabel, which also fixes the preview label. I'll use Claude Code
    for assistance and review every change myself before opening the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions