-
-
Notifications
You must be signed in to change notification settings - Fork 385
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
Add auto-panning when pointer goes beyond viewport edge with Select tool #1625
Add auto-panning when pointer goes beyond viewport edge with Select tool #1625
Conversation
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.
Looks good so far - although it would be nice if this updated when there was no mouse motion.
To implement this I think we could probably send a message on each animation frame which is received in the init_after_frontend_ready
so that as well as calling poll_node_graph_evaluation
we could also do something like:
call_closure_with_editor_and_handle(|editor, handle| {
for message in editor.handle_message(BroadcastMessage::TriggerEvent(BroadcastEvent::AnimationFrame)) {
handle.send_frontend_message_to_js(message);
}
});
Then subscribe to the broadcast event so that we can update the viewport position.
I have made the changes so that the viewport shifts when there is no mouse motion.
|
@elbertronnie thanks for this change. The approach seems reasonable, and I think that it would be good to have a struct to group the select tool modifier keys. |
I have grouped all modifier keys into |
!build |
|
Great work! Could you also please add it to these tools?: [list moved to #1527] Please try to structure it so as much code as possible can be reused across the implementations. |
@elbertronnie thanks for these changes - it feels much smoother now with the animation frame callback. I fixed a small bug whereby during the dragging of the bounding box, the shape would shift around (due to the message ordering - the modification to |
!build |
@Keavon I will do it but I won't be able to contribute for a week since my college exams are going on. |
Ok, let's merge this one today and then do the other tools as a followup PR once you're done with exams! |
|
c7358fb
to
3424db4
Compare
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 works nicely, thanks! I capped the speed with an overextension of 50px beyond the viewport bounds so it doesn't fly off uncontrollably. I love how fluid this feels, much better than a lot of other apps I've tried!
…ool (#1625) * Add code to shift viewport if mouse is beyond edge * Allow shifting viewport if mouse is stationary too * Group all modifier keys into SelectToolPointerKeys * Cleanup message ordering to remove shifting during resize * Slow down shifting by half * Clamp speed; code review cleanup --------- Co-authored-by: 0hypercube <0hypercube@gmail.com> Co-authored-by: Keavon Chambers <keavon@keavon.com>
…ool (#1625) * Add code to shift viewport if mouse is beyond edge * Allow shifting viewport if mouse is stationary too * Group all modifier keys into SelectToolPointerKeys * Cleanup message ordering to remove shifting during resize * Slow down shifting by half * Clamp speed; code review cleanup --------- Co-authored-by: 0hypercube <0hypercube@gmail.com> Co-authored-by: Keavon Chambers <keavon@keavon.com>
Partly closes #1527
Notes:
Dragging
,DrawingBox
,ResizingBounds
orDraggingPivot
state.