Repository navigation
Conversation
Ported from the molstar-editor gizmos: three arrows (move) or three rings
(rotate) drawn in the Mol* scene, picked with Mol*'s own object picking, with
the camera's drag bindings suspended while a handle is held. An arrow follows
the closest point between the pointer ray and its axis; a ring turns by the
angle swept around the gizmo's projected centre, signed by which side of the
rotation plane the camera is on.
Move and Rotate sit at the start of the selection popover's action row, so Apply
stays where it was. Dragging previews the motion by redrawing the document with
only the selected atoms moved (moveCif now takes an atom selector), and Apply
commits it as one undoable edit before the popover's condition edits. Closing
the popover, or picking a different selection, drops the handles and puts the
document back.
The commit is a document mutation, POST /sessions/{id}/transform, so Undo,
validation and the changed notification behave as they do for any other edit:
rigid_transform rotates about a pivot -- the selection's own centroid unless
one is given -- and then translates. Atoms without coordinates keep their NaN
rather than being given an invented position, and a transform that moves
nothing is not an edit, so Undo gains no empty step.
Saved absolute-coordinate conditioning moves with the atoms. A model builds
from those stored positions, not from the CIF's columns, so moving one without
the other left the structure and its conditioning in different places and a
design came back where the atoms used to be -- visible only after generating,
since the file looks correct every time it is opened. Internal coordinates and
rigid-body shapes are relative and stay correct under a rigid motion, so they
are deliberately left alone; a chain's centroid target covers a whole chain a
selection may only partly cover, so it is left for the user to re-set.
The handles are Mol*-only for now (capabilities.transformGizmo), as they are
drawn with its shape representation; Patinae reports false and the controls do
not appear.
Co-Authored-By: Claude Opus 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.
Hi all,
this PR implements a move and rotate gizmo per issue #38
Screenshot:
I also have a version that works fully in the browser in combination with the web-based RFD4 generation as in https://web.rfd4-proteina.org/ (I wasn't able to find the source code but I made it work locally with the js bundles). I can provide more details if needed.
Claude's description of the PR:
Three arrows (move) or three rings (rotate) drawn in the Mol* scene, picked with Mol*'s own object picking, with the camera's drag bindings suspended while a handle is held.
An arrow follows the closest point between the pointer ray and its axis; a ring turns by the angle swept around the gizmo's projected centre, signed by which side of the rotation plane the camera is on.
Move and Rotate sit at the start of the selection popover's action row, so Apply stays where it was. Dragging previews the motion by redrawing the document with only the selected atoms moved (moveCif now takes an atom selector), and Apply commits it as one undoable edit before the popover's condition edits. Closing the popover, or picking a different selection, drops the handles and puts the document back.
The commit is a document mutation, POST /sessions/{id}/transform, so Undo, validation and the changed notification behave as they do for any other edit:
rigid_transform rotates about a pivot -- the selection's own centroid unless
one is given -- and then translates. Atoms without coordinates keep their NaN
rather than being given an invented position, and a transform that moves
nothing is not an edit, so Undo gains no empty step.
Saved absolute-coordinate conditioning moves with the atoms. A model builds from those stored positions, not from the CIF's columns, so moving one without the other left the structure and its conditioning in different places and a design came back where the atoms used to be -- visible only after generating, since the file looks correct every time it is opened. Internal coordinates and rigid-body shapes are relative and stay correct under a rigid motion, so they are deliberately left alone; a chain's centroid target covers a whole chain a selection may only partly cover, so it is left for the user to re-set.
The handles are Mol*-only for now (capabilities.transformGizmo), as they are drawn with its shape representation; Patinae reports false and the controls do not appear.