Skip to content
This repository has been archived by the owner on Jun 11, 2022. It is now read-only.

symmetric zoom in and zoom out #43

Merged
merged 1 commit into from
Jul 25, 2017
Merged

symmetric zoom in and zoom out #43

merged 1 commit into from
Jul 25, 2017

Conversation

dirk-thomas
Copy link
Contributor

When clicking zoom-in once and then zoom-out once you are currently not back at the original scale. E.g. from 100% you get to 90% and then back to 99% whereas the user expects to be back to where he started.

This patch modifies the arguments to the zoom function to actually be symmetric.

@@ -81,9 +81,9 @@ class SvgPreviewView extends View {
this.controls.find('a').on('click', (e) => {
this.changeBackground($(e.target).attr('value'))
})
this.zoomOutButton.on('click', (e) => this.zoom(-0.1))
this.zoomOutButton.on('click', (e) => this.zoom(9 / 10 - 1))
Copy link
Owner

Choose a reason for hiding this comment

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

9 / 10 - 1 = -0.1, what's the point of this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The value of the formular is the same. I only updated it to match the zoom-in formular.

this.resetZoomButton.on('click', (e) => this.zoomReset())
this.zoomInButton.on('click', (e) => this.zoom(0.1))
this.zoomInButton.on('click', (e) => this.zoom(10 / 9 - 1))
Copy link
Owner

Choose a reason for hiding this comment

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

10 / 9 - 1 = `0.11...´, why would that be better?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As describe above of you use the argument 0.1 and -0.1 the scaling factor is not symmetric. Clicking each zoom button (in and out) once does not get you back to the original zoom factor.

With the updated argument for zoom-in (0.111... instead of 0.1) the two scaling factors are exact inverse operations. So after clicking both you are exactly back to where you started.

@dirk-thomas
Copy link
Contributor Author

I have commented on the questions. Is there anything else preventing this from being merged?

@josa42 josa42 merged commit ba5d663 into josa42:master Jul 25, 2017
@josa42
Copy link
Owner

josa42 commented Jul 25, 2017

Thank you!

@dirk-thomas dirk-thomas deleted the symmetric_zoom branch July 25, 2017 22:10
@dirk-thomas
Copy link
Contributor Author

Thank you for merging this. Are you planning on other changes in the near term or could this change be released?

@dirk-thomas
Copy link
Contributor Author

Thank you for merging this. Are you planning on other changes in the near term or could this change be released?

@josa42 Any chance to get this fix released to make it available to users?

@josa42
Copy link
Owner

josa42 commented Aug 4, 2017

@dirk-thomas I'll release it when the I have figured out, why the test are failing. But I do nor have much time to spare currently.

@dirk-thomas
Copy link
Contributor Author

dirk-thomas commented Oct 23, 2017

@josa42 I noticed that you recently got master to pass CI again. Any reason not to release a new version?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants