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

__computeScrollMax computes wrong values #18

Closed
niieani opened this issue May 5, 2012 · 2 comments
Closed

__computeScrollMax computes wrong values #18

niieani opened this issue May 5, 2012 · 2 comments

Comments

@niieani
Copy link

niieani commented May 5, 2012

Hi there.
I've been using the Scroller for my last university project and it's really great!
But there's an error in logic that __computeScrollMax uses to compute the __maxScroll values.

As it is at the moment, the values computed are too large when zooming in on canvas elemenets:

self.__maxScrollLeft = Math.max((self.__contentWidth * zoomLevel) - self.__clientWidth, 0);
self.__maxScrollTop = Math.max((self.__contentHeight * zoomLevel) - self.__clientHeight, 0);

I've corrected the problem here:

self.__maxScrollLeft = Math.max(self.__contentWidth - (self.__clientWidth * (1/zoomLevel)), 0);
self.__maxScrollTop = Math.max(self.__contentHeight - (self.__clientHeight * (1/zoomLevel)), 0);

Cheers!

@niieani
Copy link
Author

niieani commented May 5, 2012

Actually, this seems quite odd, but the logic works differently in different examples.
For example when scaling the context of the canvas (ctx.scale) my logic works, but when redrawing the components like you do in the canvas example your logic works.
Maybe there should be a way to override the default logic in case of a different implementation of the rendering?

@swernerx
Copy link
Contributor

It mainly depends on whether your properties apply zooming on top of dimensions or the other way around. This is the reason why we recompute the dimensions and positions based on zooming in some examples and do not so in others.

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

No branches or pull requests

2 participants