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

Add additional logic for auto-scrolling workspace #749

Merged
merged 3 commits into from
Jun 10, 2021

Conversation

maribethb
Copy link
Contributor

Adds additional logic/conditions for when the workspace should auto-scroll. This version takes into account the mouse/cursor location, as well as the full block dimensions rather than just the corner of the block. The speed changes depending on how far out of bounds you are dragging.

I used the same options that code.org is using in their implementation. It seems a little fast to me, but I'm no expert.

In the next PR, I'll add the ability for a developer to supply any/all of these options, as well as the ability to disable the feature completely (and/or disable the mousewheel handler as well). In addition, everything in this class is overridable so a developer could also subclass the ScrollBlockDragger in order to provide different logic.

Screen.Recording.2021-06-07.at.1.47.17.PM.mov

@maribethb maribethb requested a review from alschmiedt June 7, 2021 21:28
Copy link
Contributor

@alschmiedt alschmiedt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is so cool! lgtm few small nits

@@ -34,7 +39,51 @@ export class ScrollBlockDragger extends Blockly.BlockDragger {
* @protected
*/
this.dragDelta_ = new Blockly.utils.Coordinate(0, 0);

// TODO(maribethb): See if we can actually check this
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have isMovable etc that I want to use to get these dynamically (no need to calculate if we can't even scroll horizontally) but I want to do more thorough testing, so in another PR. But I improved the todo.

plugins/scroll-options/src/ScrollBlockDragger.js Outdated Show resolved Hide resolved
plugins/scroll-options/src/ScrollBlockDragger.js Outdated Show resolved Hide resolved
plugins/scroll-options/src/ScrollBlockDragger.js Outdated Show resolved Hide resolved
@maribethb maribethb merged commit 6df8662 into google:q2_2021_release Jun 10, 2021
@maribethb maribethb deleted the drag-options branch April 1, 2022 19:26
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.

2 participants