Separate polar / azimuth rotation actions (mouse + touch)#633
Open
codedpalette wants to merge 6 commits into
Open
Separate polar / azimuth rotation actions (mouse + touch)#633codedpalette wants to merge 6 commits into
codedpalette wants to merge 6 commits into
Conversation
…hes.one table pipes
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.
Fixes #618
Summary
Adds four new actions that let a binding drive a single rotation axis:
ACTION.ROTATE_AZIMUTH/ACTION.ROTATE_POLAR(mouse)ACTION.TOUCH_ROTATE_AZIMUTH/ACTION.TOUCH_ROTATE_POLAR(touch)Setting the existing
ACTION.ROTATE/ACTION.TOUCH_ROTATEstill enables bothaxes — because they're now defined as the composite of the two new primitives:
Works for mouse buttons, mouse wheel, and single-finger touch.
Motivation
Previously rotation was all-or-nothing per binding; the only way to lock an axis
was to zero
azimuthRotateSpeed/polarRotateSpeedglobally. These actions makeaxis restriction a per-binding choice (e.g. left-drag = azimuth only).
What changed
ACTIONis now composable. Each capability owns one primitive bit, and everyexisting named action is a bitwise-OR of primitives (e.g.
TOUCH_DOLLY_ROTATE = TOUCH_DOLLY | TOUCH_ROTATE). No combined action needs itsown dedicated bit anymore.
state & PRIMITIVE) instead ofexact-matching whole composites, so single-axis actions fire correctly and
combined touch gestures decompose cleanly.
_rotateInternalgates each axis by the rotate bits present in the currentstate (azimuth from
deltaX, polar fromdeltaY).examples/config.htmlexposes them in every mouse/touch picker.Bug fix (bonus)
The collapse fixes a latent bug in the drag-start handler where
TOUCH_ZOOM_SCREEN_PANwas compared againstTOUCH_DOLLY_SCREEN_PAN(mismatchedconstants), so two-finger zoom+screen-pan never reset target movement on drag start.
Backward compatibility
All existing
ACTIONmember names are retained. Their numeric valueschange (the enum was re-laid-out around primitives), so code that persisted raw
numeric action values rather than referencing
CameraControls.ACTION.*would needupdating. Behavior of all existing bindings is unchanged.
Verification
This repo has no unit-test suite; verified via:
npx tsc --noEmit— cleaneslint src— cleannpm run build— succeeds; bundle exports the new actionsexamples/config.html(mouse + touch):ROTATEmoves bothaxes;
ROTATE_AZIMUTHmoves azimuth only (polar unchanged);ROTATE_POLARmoves polar only (azimuth unchanged). Existing composite actions like
TOUCH_DOLLY_ROTATEstill work as expected