Repository navigation
feat: add JoggingJointSlider, jogging a joint toward a pressed point - #652
Merged
Merged
Conversation
One joint as a slider across its limits, with the thumb at the joint's value, the limits below and a mark at zero; an app shows one per joint. Hovering the track shows the goal under the pointer, and pressing there jogs the joint toward it: it stops when it gets there or when the slider is let go. While held, the goal follows the pointer, and the joint turns around when the goal passes it. An arrow key held on the focused slider jogs toward that limit. It takes value, min and max in NOVA's units (radians, or mm with linear) and onJogStart(direction) / onJogStop, and moves nothing itself. A hold ends on release, pointer cancel, lost capture, no button pressed, blur, window blur, a hidden tab, disabled and unmount; Cmd and Ctrl+click are ignored, as macOS would swallow their release. Exported from /core. The playground has a JoggingJointSlider section (joint 1, and joint 2 disabled), with a Playwright test that jogs joint 1 and checks it stops.
From the review of the PR: - The positions of the thumb, the goal band and the zero mark go in style, not sx: sx added a CSS rule for each new joint value and never removed it. The drawing is its own component, JointSliderTrack. - A turn-around brings onJogStop and the onJogStart of the other way in one event. The docs say so, the playground's stopJogging keeps the jogging connection when a newer press came in, and the Playwright test drags past the joint and expects it to turn around. - A revolute joint without limits spans the turn it stands in, and with one limit one turn from it; an arrow key never jogs against its way. A linear axis without both limits only shows its value. - The hold is recorded before the app is called, so a failing onJogStart still gets its onJogStop; the pointer is captured before the jog starts. - After it stops at its goal, the joint holds there until the pointer moves away from that spot, so an overshoot does not jog it back. - Keyboard focus shows the design system's outline; the halo is for the hovered or held thumb. Releasing the primary button ends a hold while another button stays pressed. The hover goal follows the pointer and is hidden while disabled. Limits in radians keep two decimals, halves round away from zero. The thumb is border-box, the limits are captions. - The README's one-joint-at-a-time pattern guards with a ref. - Tests for pointercancel, lost capture, blur, a hidden tab, a second pointer's release, ArrowUp/Down, key repeat, the live value, one start per direction, and a track that does not start at x = 0.
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.
Adds
JoggingJointSlider: one joint as a slider across its limits, held to jog the joint toward a point on its track. An app shows one per joint, as withJoggingJointValueControl.JoggingJointSlider(from/core): the thumb at the joint's value, the limits below the track and a mark at zero, as in the Figma "Panel Robot Pad Joint Limits" frame. Hovering the track shows the goal under the pointer ("43.8° / 86.4°" and the stretch to it). Pressing there jogs the joint toward it until it gets there or the slider is let go. While held, the goal follows the pointer, and the joint turns around when the goal passes it. An arrow key held on the focused slider jogs toward that limit.label,name,value,min,maxin NOVA's units (radians, or mm withlinear),angleUnit(degrees by default),onJogStart(direction),onJogStop,disabled. LikeJoggingGizmoandJoggingButtons, it moves nothing itself. One press can bring several starts and stops, always in turn: the joint stops at the goal, holds there while the pointer rests, and starts again when the goal moves on. On a turn-around,onJogStopand theonJogStartof the other way come in one event.onJogStartstill gets itsonJogStop. One joint at a time is up to the app; the README shows it with a ref./core:JoggingJointSliderandJoggingJointSliderProps. Nothing existing changes.stopJoggingkeeps the jogging connection when a newer press came in, so a turn-around works.