Skip to content

feat(mouserangemanipulator): adds a scale parameter to mouse listener… #1900

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

Merged
merged 2 commits into from
May 12, 2021

Conversation

WillCMcC
Copy link
Contributor

@WillCMcC WillCMcC commented May 7, 2021

…s to scale the delta

Adds a scale parameter to mouseRangeManipulator with a default value of 1. In processDelta, this
scale is applied to the step value. This allows users to achieve variable scroll speeds at a single
step value.

re #1894

-A clear and concise description of what the problem was and how this pull request solves it.

fix #1894

This contribution is funded by Sirona.

@WillCMcC
Copy link
Contributor Author

WillCMcC commented May 7, 2021

@agirault took a first pass at this with an optional param, passed in last, defaulting to 1. Let me know what you think and what changes you'd like to see here!

Copy link
Contributor

@agirault agirault left a comment

Choose a reason for hiding this comment

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

Hey @WillCMcC, great to see you here 👋 Thanks for the contribution!

So... which year did you come from?

1228095
Hoping you've seen that show, or my joke will fall flat.

I left a couple of comments below but haven't tested, so feel free to correct any of my assumptions below.

It would be ideal if you could update the example / API docs / tests... if those exist. If not, you're more than welcome to take a stab at adding them, but I understand if that's not high on your priority list. It would help to maintain the changes, if not we'll look into it eventually.

Thanks again!

@WillCMcC
Copy link
Contributor Author

WillCMcC commented May 7, 2021

Ok I made the changes that you requested. I played with the example locally and it appears to be behaving as you expected. I'm validating with my eyes so if you can think of something to log out to validate I'll post screenshots. Tests pass!

I added some comments to the public API methods that will hopefully help the next user. Im unsure if my language is precise enough so let me know if those are helpful or confusing.

I've updated the example as well so that horizontalListener has scale of 2 to demonstrate how to use that parameter.

EDIT - I realized in the example that each listener (horizontal, vertical, scroll) controls a different parameter of the scene so my updates to the example might be confusing. lmk

listener.setValue(value);
incrementalDelta.set(listener, 0); // TODO: could still store partial delta that's ignored due to the rounding?
} else if (value === listener.max && newDelta > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing min & negative newDelta?

@agirault agirault force-pushed the range_manipulator_scale branch 2 times, most recently from 76aa2bd to 8359a15 Compare May 12, 2021 18:39
WillCMcC and others added 2 commits May 12, 2021 14:46
Adds a scale parameter to mouseRangeManipulator with a default value of 1.
In processDelta, this scale is applied to the event delta. This allows users
to achieve variable scroll speeds at a single step value.

fix Kitware#1894

Co-Authored-By: Alexis Girault <alexis.girault@kitware.com>
Co-Authored-By: Will McCambley <willmccambley@gmail.com>
@agirault agirault force-pushed the range_manipulator_scale branch from 8359a15 to 39b92da Compare May 12, 2021 18:46
Copy link
Contributor

@agirault agirault left a comment

Choose a reason for hiding this comment

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

@WillCMcC: I took the liberty of fixing that + some improvements to the example + squashed, rebased, and forced push on the branch. I'll merge once the CI shows green. Thanks a lot for your work 👏

@WillCMcC
Copy link
Contributor Author

@agirault Thank you for humoring me as I put this together, and your guidance throughout 🙏

@agirault agirault merged commit a806d8f into Kitware:master May 12, 2021
@github-actions
Copy link

🎉 This PR is included in version 18.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot added the released Automated label label May 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released Automated label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add scale property on the MouseRangeManipulator to control its speed
2 participants