Add guide lines feature - #3644
Conversation
|
It still looks strange when rotating a document with guides in: rotating_document_with_guide.mp4Also the snapping doesn't work when the document is rotated. |
0HyperCube
left a comment
There was a problem hiding this comment.
Seems to work well; I have a few suggestions for the code structure. I won't comment on the JS changes.
Please mark the PR as «Ready to review» when you are happy with it.
|
!build |
|
|
Some of the ~750 lines of code is for snapping, right? At least when I glanced over it last, I thought I saw that. In testing this build link, I am not seeing any snapping to objects in the document. The "Move Guide" hint should be removed since the user is already dragging the guide. More review to follow when I have time. My previously stated concern that the line count seems way too high still applies and I'm hesitant to merge it before that can be either resolved or justified to me as to why it's about double the number of lines I would expect from this feature. |
| let transform = document | ||
| .navigation_handler | ||
| .calculate_offset_transform(viewport.center_in_viewport_space().into(), &document.document_ptz); |
There was a problem hiding this comment.
Please use document.metadata().transform_to_viewport directly. There should be no need to use the calculate_offset_transform anywhere in your code since it is already cached.
d6228da to
e58c1de
Compare
9b97ab7 to
2e842cb
Compare
f07c79b to
76938eb
Compare
Co-authored-by: James Lindsay <78500760+0HyperCube@users.noreply.github.com>
Co-authored-by: James Lindsay <78500760+0HyperCube@users.noreply.github.com>
- Fix isInRulerArea to check all four viewport edges (not just one) - Add pointercancel handler to abort guide drag on cancelled interactions - Guard hit_test with guide_lines_visible so hidden guides don't capture hover/drag - Gate intersection snap on guide_lines_visible to match get_snap_lines() behaviour - Validate direction string in create_guide_line; panic on invalid values instead of silently defaulting to vertical
There was a problem hiding this comment.
2 issues found across 7 files (changes from recent commits).
Confidence score: 3/5
- In
frontend/src/utility-functions/colors.ts, the new guard checksGradient.colorinstead of the backend’sGradient.stops.color, so valid gradient ramps can be treated asNoneand silently dropped, causing incorrect or missing gradient rendering — restore the.stopspath check or normalize the payload shape before validation. - In
frontend/src/components/widgets/inputs/SpectrumInput.svelte, midpoint diamonds are now shown for stepped interpolation even though midpoint bias has no effect there, which can mislead users into editing a control that cannot change output — reintroduce the stepped-interpolation guard so midpoint handles only appear for interpolations that support them.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="frontend/src/components/widgets/inputs/SpectrumInput.svelte">
<violation number="1" location="frontend/src/components/widgets/inputs/SpectrumInput.svelte:369">
P2: Stepped gradients now show draggable midpoint diamonds even though stepped interpolation has no midpoint bias, exposing a control that cannot affect the rendered gradient. Preserve the stepped-interpolation guard when calculating `midpointPositions`.</violation>
</file>
<file name="frontend/src/utility-functions/colors.ts">
<violation number="1" location="frontend/src/utility-functions/colors.ts:185">
P1: Existing gradient values are discarded as `None` because the backend sends `Gradient.stops.color`, but this new guard looks for `Gradient.color`; keeping the `.stops` boundary (or explicitly normalizing the ramp before these helpers) preserves gradient swatches and contrast calculations.</violation>
</file>
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic

Adds feature for guide lines that can be dragged from the rulers to help with alignment .closes #2601

image of guide lines: