-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Arrow key support signing #1143
Conversation
const target = document.querySelector('.draggable-canvas'); | ||
|
||
// Define the step size for each key press | ||
const step = 10; // Adjust step size as needed |
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 feel like step should be based on the size of the block.
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.
Fair, i will try and add that.
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 have adjusted the code, it is now based on a percentage of the size of the Element.
], | ||
inertia: true, | ||
}); | ||
if(window.location.pathname.endsWith('sign')) { |
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.
TODO: extend this to other features.
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.
Could any other features use this functionality? If not, we should move it into it's own thing.
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.
add-image could support this
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.
Yes, it already works for add image if the if statement is left out, but if two images are added, both are moving. I will try and figure out a way so only one is moving.
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 extended this feature to add-Image. Arrow key support is enabled for an element as soon as it is added. By clicking or dragging a different element arrow key support is enabled for that element.
Thanks! This is going to save so many headaches. :) |
Description
A signature can now also be moved with the arrow keys. Meaning if it is made so small that it can not be grabbed anymore to move it, the arrow keys still provide a drag functionality. This would be easy to implement for other uses cases as well (e.g. adding an image to a pdf), as of now it only works for the signing tool.
This is my first contribution, i am always happy about feedback :).
Closes #744
Checklist:
Contributor License Agreement
By submitting this pull request, I acknowledge and agree that my contributions will be included in Stirling-PDF and that they can be relicensed in the future under the MPL 2.0 (Mozilla Public License Version 2.0) license.
(This does not change the general open-source nature of Stirling-PDF, simply moving from one license to another license)