Skip to content

fix: Gizmo picking, stuck drags, scale snapping, parentless local translate and ViewCube colorNeg - #9799

Merged
kpal81xd merged 1 commit into
mainfrom
fix/gizmo-review-fixes
Oct 19, 2026
Merged

kpal81xd merged 1 commit into
mainfrom
fix/gizmo-review-fixes

Conversation

@kpal81xd

Copy link
Copy Markdown
Contributor

Description

Fixes five bugs in the gizmos in src/extras/gizmo:

  • Picking: _getSelection reused the same temporary vector for the ray direction and the triangle hit point. After the first hit, every later shape was tested with the wrong ray, so overlapping shapes could pick the wrong axis (for example the X plane when hovering the Y arrow).
  • Stuck drag: pointerup was ignored while the gizmo was disabled or the pointer was locked. Disabling the gizmo mid-drag left it dragging, and moving the mouse after re-enabling kept moving the node. The release now always ends the drag.
  • Scale snapping: ScaleGizmo snapped before dividing by the gizmo's screen scale, so the snap step changed with camera distance. It now snaps the scale factor itself, so snapIncrement = 1 always gives whole-number steps.
  • Parentless local translate: in local coordinate space, a node with no parent used a stale scale value and could end up at Infinity/NaN. It now uses a unit scale.
  • ViewCube.colorNeg: the setter colored the positive (labelled) circles instead of the negative ones.

Behavior change

Gizmo now fires pointer:up on button release even while disabled or while the pointer is locked. In those cases no shape is selected.

Manual smoke test

  1. Open the gizmos/transform-translate example. Hover the arrows, planes and center sphere where they overlap on screen. Expected: the shape under the cursor highlights and drags along its own axis or plane.
  2. In the same example, start dragging an arrow, set gizmo.enabled = false before releasing, release, then set gizmo.enabled = true and move the mouse without pressing a button. Expected: the box does not move.
  3. Open gizmos/transform-scale and turn snapping on with an increment of 1. Drag the X arrow once zoomed in and once zoomed out. Expected: the box scale is a whole number both times.
  4. Open misc/editor and set viewCube.colorNeg = new Color(1, 0, 1). Expected: only the three unlabelled circles turn magenta, and X/Y/Z keep their axis colors.

Fixes #

Checklist

  • I have read the contributing guidelines
  • My code follows the project's coding standards
  • This PR focuses on a single change

@github-actions

Copy link
Copy Markdown

Build size report

This PR changes the size of the minified bundles.

Bundle Minified Gzip Brotli
playcanvas.min.js 2673.2 KB (+25 B, +0.00%) 693.3 KB (+66 B, +0.01%) 537.6 KB (+10 B, +0.00%)
playcanvas.min.mjs 2669.9 KB (+25 B, +0.00%) 691.9 KB (+7 B, +0.00%) 537.0 KB (+139 B, +0.03%)

@kpal81xd kpal81xd self-assigned this Oct 19, 2026
@kpal81xd
kpal81xd merged commit 9ae8813 into main Oct 19, 2026
11 of 12 checks passed
@kpal81xd
kpal81xd deleted the fix/gizmo-review-fixes branch October 19, 2026 13:05

This branch was successfully deployed

2 active deployments
Preview – engine — 900d8610 Deployed Oct 19, 2026 by vercel[bot]
Preview – engine-api-docs — 900d8610 Deployed Oct 19, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant