-
Notifications
You must be signed in to change notification settings - Fork 1
Reference image tool #16
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
Conversation
Reference mode
| if (o >= a) o = o - a; | ||
| } else if (event.deltaY < 5) { | ||
| if (o <= (1.0 - a)) o = o + a; | ||
| if (event.deltaX > 0 || event.deltaY > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is one part where I didn't understand the existing code, or why the magic number "5" was chosen for the cutoff in positive/negative scrolling?
At least on my system (macbook air m1 + razer deathaddr v2 mouse):
- Scrolling down is registered as
deltaX = 4.0 - Scrolling up is registered as
deltaX = -4.0 - Holding down the shift key changes the delta on scrolling from
deltaXtodeltaY - Using the touchpad to pinch-to-zoom gives me either positive or negative values centered around
0.
So scrolling was pretty much broken & glitchy for me without making these changes (I could zoom in but I couldn't zoom out).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure on the magic number either. maybe a resolution thing? some kind of threshold boundary that is crossed? maybe it was too sensitive? hrm.
…g reusable for other messages
Add ability to open reference images in separate windows
Fixes scroll behavior for 200% zoom.
Add outline/border to brush tool.
… recently clicked
Fix for mouse move events
|
@michael-lazar I completely didn't realize you were doing this! I'll integrate if possible and i can grok your PRs. |
This PR adds a new tool to the sidebar ("reference tool") that can be used to resize/orient the reference watermark image
I hooked everything up to work with the existing hotkeys and menu options. So for example, if you change opacity with the scroll wheel shortcut, it should reflect appropriately in the UI.
My first idea was to add draggable anchors at the corners of the reference image to allow dragging to resize/rotate the image, as commonly used in image editors. But this was a bit too complicated for me to implement in vanilla JS so I settled on putting the controls in the toolbar instead. The values are standard boxes so you can click in them to type in an exact value, or use the scroll wheel inside the input box to quickly increment/decrement the value.
demo.webm