Skip to content

fix(viewer): keep material edits on a picked object after deselecting it - #35

Open
ericgozzi wants to merge 1 commit into
mainfrom
fix/material-edit-while-picked
Open

ericgozzi wants to merge 1 commit into
mainfrom
fix/material-edit-while-picked

Conversation

@ericgozzi

Copy link
Copy Markdown
Collaborator

Summary

Fixes material edits on a picked object being lost when it is deselected.

A picked object wears the pick highlight, with its own material parked in pickedMaterial until deselection. A material update for it (e.g. the backend's echo of a Material toolbar edit) replaced the highlight but left the stale parked material, so deselecting put the old color back - until the object was rebuilt, for example by moving it. This mostly showed on objects added without a material of their own (add_geometry(box)).

  • A material update for the picked object now replaces the parked material.
  • A local setMaterial edit shows the object's real material at once instead of leaving it hidden under the highlight.

Test plan

  • New regression test in tests/viewer_lifecycle.test.ts (fails without the fix: the box falls back to the default #0092d2 after deselecting).
  • prettier, lint, typecheck, test, build:app, build:library pass.
  • Checked in a browser against a running compas_threejs App: the edited color survives deselection.

🤖 Generated with Claude Code

A picked object wears the pick highlight, with its own material parked
until deselection. A material update for it replaced the highlight but
left the stale parked material, so deselecting put the old color back
until the object was rebuilt (e.g. by moving it). Updates now replace the
parked material, and a local edit shows the real material at once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant