Conversation
Adds CompasViewerOptions.plugins and a narrow ViewerExtensionContext so authoring tools can live in separate packages: an overlay layer that is never picked or reset, pointer rays and plane/object raycasts, object bounds, resize/dispose hooks, and beginInteraction() to take over pointer and keyboard input for a session. The scene, camera, renderer and controls stay internal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A session started from a button outside the viewer left focus on that button, so keystrokes such as Escape never reached the session's onKeyDown until the user clicked the canvas. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nd edit materials Adds send(), selection(), onSelectionChange(), getMaterial() and setMaterial() to ViewerExtensionContext, so add-ons can create backend objects (create_geometry) and host the material editor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
Adds setTransformSnap({ grid, angle }) to ViewerExtensionContext. Translate
and scale snap while dragging, and on release the object's bounding-box
faces that moved land exactly on the grid (the correction from
feature/bidirectional-sync's grid snap). Rotate snaps to the angle step.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Polygon renders as a filled face triangulated in its own plane (so concave shapes fill correctly), facing up when horizontal, with its outline. Arc renders as a line sampled between its start and end angles. Both move from "deferred" to "included" in the support matrix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…jects Adds objectVertices() to ViewerExtensionContext: each visible backend object's vertices with its kind - points, line (in drawing order) or mesh (deduplicated, at most 2000) - so add-ons can snap to real endpoints and corners rather than bounding boxes. Also clarifies that keyboard shortcuts on the canvas are fine; only pointer takeover goes through beginInteraction. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a plugin extension API so authoring tools can live in separate packages instead of the core viewer ("compas_threejs should not be a CAD library"). The first add-on built on it is
compas_threejs_draw(drawing tools, snapping, drawing planes, material editing), which uses only this public API.Stacked on #26 (
feature/toolbar-schema): plugins andextraToolbarModuleswork together, so an add-on can put its tools in the toolbar.API
createViewer(container, { plugins: [plugin] }), where aViewerPluginis{ id, install(context) }andinstallmay return a cleanup run on dispose. TheViewerExtensionContextit gets is deliberately narrow - the scene, camera, renderer and controls stay internal:addOverlay(object)- plugin-owned objects, rendered but never picked or resetpointerRay,pointerOnPlane,pickObjects,objectBounds,objectVertices- raycasting and reading visible backend objectsbeginInteraction(handlers)- takes over pointer/keyboard input for a session (picking, gizmo and built-in shortcuts stand down; orbiting keeps working); focuses the canvassend(message)- messages to the backend over the viewer's transportselection/onSelectionChange,getMaterial/setMaterialsetTransformSnap({ grid, angle })- snaps gizmo edits; on release, faces that moved land exactly on the grid (the correction fromfeature/bidirectional-sync's grid snap)viewportSize,onResize,requestRender,onDisposeAlso:
examples/embedded_extension_plugin.html, a README section, and the package smoke test typechecks a consumer plugin.Included from other PRs
This branch also carries two changes that are opened on their own against
main, because the draw add-on needs them - they drop out of this diff once those merge:fix(viewer): keep material edits on a picked object after deselecting itfeat(viewer): display COMPAS Polygon and ArcTest plan
tests/viewer_extensions.test.tscovers the API (install order, duplicate ids, cleanup order and errors, overlays, rays, picking, bounds, vertices, interaction handoff and interruption, focus, send, selection, materials);tests/viewer_lifecycle.test.tscoverssetTransformSnapand the move/scale correction.prettier,lint,typecheck,test(58),build:app,build:librarypass;test:packagepasses with fix(ci): pass shell: true so test:package can spawn npm.cmd on Windows #31's Windows fix applied locally.compas_threejs_drawand a runningcompas_threejsApp (drawing, snapping, gizmo snap, material edits).🤖 Generated with Claude Code