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

Pinch zoom ux #991

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

Pinch zoom ux #991

wants to merge 13 commits into from

Conversation

Alpt
Copy link

@Alpt Alpt commented Apr 11, 2020

This pull request is an experimentation on improving the UX of pinch-zoom.
It starts from pull request 990, which fixes two functional bugs, and it adds the following:

  • do not go out of the graph extremes (g.xAxisExtremes()), both during pan and during zoom. Use g.getNumericOption("panEdgeFraction") to have a tolerance about this. Perhaps, this fixes 713.
  • sensitiveness dampening: smaller pinches count much less for scaling
  • context.pinchOutOfExtremes: do not pinch-zoom if the center of the pinch is out of the extremes of the axes
  • There was this feature: "make pinches in a 45-degree swath around either axis 1-dimensional zooms". I found it needed improvement, so I disabled it. Without it, I find the graph to be very usable, perhaps thanks to the dampness of sensitiveness. But perhaps, you want to enable it. It is easy: just de-comment two lines.

@coveralls
Copy link

coveralls commented Apr 11, 2020

Coverage Status

Coverage decreased (-0.8%) to 89.354% when pulling 87f18e3 on Alpt:pinch-zoom-ux into e9155b2 on danvk:master.

Shinbar pushed a commit to Shinbar/dygraphs that referenced this pull request Apr 13, 2020
…eally well on mobile

touch devices, good job.
Copy link
Collaborator

@mirabilos mirabilos left a comment

Choose a reason for hiding this comment

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

Do you have a recommended procedure to test this? An example page, or just the one on https://dygraphs.com/ and then pinching around, or something better than that?

}

if (Math.abs(initHalfHeight) > minAllowed) {
var damp = 1 / (Math.abs(initHalfHeight) - minAllowed)
Copy link
Collaborator

Choose a reason for hiding this comment

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

AFAICT var has function scope, so this is an error. I’d say declare var damp above with the initHalf{Width,Height} and reuse it in both branches.

// ex is a tuple [a, b], with a <= b
function isOutOfExtremes(p, ex) {

return p < ex[0] || p > ex[1]
Copy link
Collaborator

Choose a reason for hiding this comment

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

please do add explicit semicola at the end of instructions (not just here but everywhere); semicolon insertion is considered harmful

@Alpt
Copy link
Author

Alpt commented Jan 14, 2025

Do you have a recommended procedure to test this? An example page, or just the one on https://dygraphs.com/ and then pinching around, or something better than that?

Try numericnews
It uses alpt/dygraphs#v0.0.5
I do not remember if it diverges from the pull requests I made. But if it does, it does slightly.

I am sorry, but 5 years later I do not find much time to give additional support.

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.

panEdgeFraction ignored on touch screen
3 participants