Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polish the G/R/S feature behavior, visualizations, and hints #2229

Merged
merged 17 commits into from
Jan 30, 2025

Conversation

mTvare6
Copy link
Contributor

@mTvare6 mTvare6 commented Jan 27, 2025

Followup to this feedback in #2195, which gets closer to close #1128.

  • Another change: when typing values, we shouldn't round the number to 2 decimal places, instead it should show the exact number the user types, including trailing zeros if the user types those.
  • For Scale, the solid vs. dashed line that follows the cursor is following the projected location of the cursor onto that line. It should not be doing that, instead it should be displaying the actual scale ratio. 0 means at the center. 1 means at the starting point of the Sscale. 0.5 means half is solid, half is dashed. Notice in my video below, I'm able to make the solid line's end go all the way to the center, which should occur at a scale factor of 0, without ever having the scale factor even go below 0.5. Because currently the two values aren't related. Furthermore, this is necessary to visualize snapping when Ctrl is pressed and to properly handle slowing when Shift is pressed. Video
  • Implement integer-value snapping for Grab when Ctrl is pressed? It should work whether we're freely moving or constrained to X or Y (but still mouse controlled; Ctrl doesn't affect typed numbers). So when Ctrl is held, we shouldn't see decimal values. You'll need to zoom in past 100% to see decimal values.
  • We don't enter G, R, or S mode until after pressing one of those keys and then moving the mouse cursor. It should happen immediately upon pressing the key, before needing to move the cursor.
  • The hints need to be updated to work dynamically with the state of global vs. local X and Y constraint, and include - negation, numbers, and Backspace if numbers are typed.
  • In the Path tool, we actually do want the Rotation to start from the direction of the cursor rather than the local rotation of the layer. So if you can undo that change specifically for the Path tool, but keep it for the Select tool, that would be ideal.
  • When G is constrained to Y in both Path and Select tools, the number label shouldn't swap sides based on moving the mouse left and right offset by the pivot-to-start-point X offset distance. Alternatively, you could keep this behavior but make it swap to the side that the mouse is currently on (removing the pivot-to-start-point X offset from the current mouse position). When solving this, just be sure you don't break the correct behavior for G when unconstrained to an axis, since we like how the Y component label swaps sides. Please also double-check that you're not drawing any extra (overlapping) overlay lines than the necessary 1 when in X or Y constraint mode, or when X or Y happen to be precisely 0. Video
  • Remove the bottom-left viewport overlay labels for the G/R/S status
  • If you type - it negates the mouse-controlled GRS. Then if you type a number, it becomes that negative number. If you then type - it negates that number, etc.

@mTvare6 mTvare6 marked this pull request as draft January 27, 2025 10:04
@mTvare6 mTvare6 marked this pull request as ready for review January 29, 2025 10:00
- [ ] Another change: when typing values, we shouldn't round the number to 2 decimal places, instead it should show the exact number the user types, including trailing zeros if the user types those.
- [ ] For Scale, the solid vs. dashed line that follows the cursor is following the projected location of the cursor onto that line. It should not be doing that, instead it should be displaying the actual scale ratio. 0 means at the center. 1 means at the starting point of the Sscale. 0.5 means half is solid, half is dashed. Notice in my video below, I'm able to make the solid line's end go all the way to the center, which should occur at a scale factor of 0, without ever having the scale factor even go below 0.5. Because currently the two values aren't related. Furthermore, this is necessary to visualize snapping when Ctrl is pressed and to properly handle slowing when Shift is pressed.
    https://files.keavon.com/-/QuirkyYummyGrayfox/capture_38_.mp4
- [ ] Implement integer-value snapping for Grab when Ctrl is pressed? It should work whether we're freely moving or constrained to X or Y (but still mouse controlled; Ctrl doesn't affect typed numbers). So when Ctrl is held, we shouldn't see decimal values. You'll need to zoom in past 100% to see decimal values.
- [ ] We don't enter G, R, or S mode until after pressing one of those keys and then moving the mouse cursor. It should happen immediately upon pressing the key, before needing to move the cursor.
- [ ] The hints need to be updated to work dynamically with the state of global vs. local X and Y constraint, and include - negation, numbers, and Backspace if numbers are typed.
- [ ] In the Path tool, we actually do want the Rotation to start from the direction of the cursor rather than the local rotation of the layer. So if you can undo that change specifically for the Path tool, but keep it for the Select tool, that would be ideal.
- [ ] When G is constrained to Y in both Path and Select tools, the number label shouldn't swap sides based on moving the mouse left and right offset by the pivot-to-start-point X offset distance. Alternatively, you could keep this behavior but make it swap to the side that the mouse is currently on (removing the pivot-to-start-point X offset from the current mouse position). When solving this, just be sure you don't break the correct behavior for G when unconstrained to an axis, since we like how the Y component label swaps sides. Please also double-check that you're not drawing any extra (overlapping) overlay lines than the necessary 1 when in X or Y constraint mode, or when X or Y happen to be precisely 0. https://files.keavon.com/-/EachWeeArcticseal/capture_39_.mp4
- [ ] Remove the bottom-left viewport overlay labels for the G/R/S status
@Keavon
Copy link
Member

Keavon commented Jan 29, 2025

!build

Copy link

📦 Build Complete for ad7a346
https://4eed9269.graphite.pages.dev

@Keavon
Copy link
Member

Keavon commented Jan 29, 2025

  • Scale when controlled by mouse (not keyboard numbers):
    • Going to the opposite side should display a - sign in front of the number label.
    • When typing - to swap sides, the current mouse mapping is reversed from what's desired. Getting closer to the center should make it shrink, not grow.
    • I've decided that we want to control scaling by its radial value from the center to the mouse position (and negated across the reflection line from the cursor start point) like we have it implemented now for unconstrained scaling, but when X or Y constrained scaling is used, it should instead use linear instead of radial along that axis. The result is that the scaling visualization, where the dashed line meets the solid line, should be at the point projected from the mouse position. After testing, I think this produces the more intuitive behavior when axis-constrained.
  • Grab when Y-axis constrained (or not constrained but with zero X offset): we want the number label to be on the right of the vertical visualization line, not centered within it.
  • Let's actually add - inverting support for Grab as well. Doing this results in the X and Y offsets getting negated, but the mouse position stays correctly mapped but just with an offset (the same kind of offset that can occur from Shift slowing). This way using - to negate the mouse-controlled motion is consistent for all three modes. Add a hint for - during each mouse-controlled state
  • When grabbing, rotating, or scaling: hints should include the other two of G, R, and S, so two of these three (both the keys and slash-delimited text labels):
    capture
  • When Y constrained, the hints should still show X before Y. Also, "Unconstraint" should say "Clear Constraint". When in non-local mode (a single X or Y tap), a hint should also say "X X Clear Constraint" or "Y Y Clear Constraint." That's two X keys similar to the screenshot above that shows "G R S" as three keys in one hint.
  • Make sure your hint labels are Title Case, not Sentence case, please. But I'll probably tweak the exact wording after the final changes and before I merge this PR.
  • The NumKeys hint should be labeled 0-9 instead, and those should show up whenever you can start typing numbers.
  • Backspace still doesn't correctly remove the typed - sign, either for the reversed mouse-controlled S/R mode or for ensuring the next-typed number for G/R/S ends up not being negative.
  • (De-scoped from this PR) The visualization overlays don't correctly handle panning (e.g. with the mouse scroll wheel) or zooming.

That's everything I've noticed so far, thank you!

@Keavon
Copy link
Member

Keavon commented Jan 30, 2025

!build

Copy link

📦 Build Complete for 382601e
https://8debc9fc.graphite.pages.dev

@Keavon
Copy link
Member

Keavon commented Jan 30, 2025

  • In G, we can type a number and it applies to the X axis. That shouldn't happen unless an axis was first chosen.

  • We need the 0-9 hint showing at any time you can begin typing a number (so that's always except in unconstrained G). Likewise for a - hint to show you can negate the value.

  • I'd like to try, once more, seeing what it looks like for the uniform (non-axis-constrained) scaling to follow the cursor rather than sticking to the original angle when the scaling began. This should be a separate commit so it's easy to revert if the current behavior remains my preference.

  • A one-frame visual bug: if you S, Y, move the mouse so the scale becomes negative, then Y to turn it to a local scale; for one frame it becomes un-inverted:

    capture_56_.mp4
  • In R mode, there should be no separator line at the very end of the hints bar, when nothing comes after it.

  • All G/R/S modes and states need to have a separate section at the start for left click or Enter to confirm and right click or Esc to cancel (copy latter from the hints when drawing a line, and adapt it for the former case).

  • When resizing or rotating the transform cage, we'd like hints for cancel, Shift constrain aspect ratio (scaling the layer) or along axis (dragging the layer), Alt around the pivot (scaling the layer), and Ctrl snapping 15° increments (rotating the layer).

@Keavon Keavon changed the title Fix GRS overlays bugs Polish the G/R/S feature behavior, visualizations, and hints Jan 30, 2025
@Keavon Keavon merged commit fb7eae8 into GraphiteEditor:master Jan 30, 2025
4 checks passed
@Keavon Keavon mentioned this pull request Jan 30, 2025
4 tasks
mTvare6 added a commit to mTvare6/Graphite that referenced this pull request Jan 31, 2025
Keavon added a commit that referenced this pull request Feb 5, 2025
* Further polishing of G/R/S visualisation and features

Followup to #2229.

* Begin typing only if constrained or not in G

* Prevent adding empty group in R mode. Order fn alphabetically as was before

* Always show typing hints unless can't begin typing

* Fix one frame bug

* Add cancel and confirm groups for GRS hints

* Fix inconsistency in call increments, snaps

* Use top/bottom left/right methods with quads where more readable

* Fix inconsistent use of narrow/flat

* Add hints to transform cage

Fixes https://discord.com/channels/731730685944922173/881073965047636018/939265895509925898.

* Rename some hints

* Fix scale radial behaviour, grab constraints and local edge orientation

* Fix not being able to remove the whole selection with delete modifier

Fixes https://discord.com/channels/731730685944922173/881073965047636018/1336221441716391937.

* Fix compiling

* Fix crash when single point bbox

Fixes #2267

* Fix the same crash in scale and use better name for bbox

* cargo fmt

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

G/R/S visualization overlays
2 participants