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

min-scale does not take effect immediately when tied to a variable. #58

Closed
jmikh opened this issue Apr 18, 2020 · 2 comments
Closed

min-scale does not take effect immediately when tied to a variable. #58

jmikh opened this issue Apr 18, 2020 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@jmikh
Copy link

jmikh commented Apr 18, 2020

when min-scale prop is tied to a variable, and that variable changes to something that is larger than the current zoom level, the min-scale does not get enforced immediately. It only gets enforced when I actually try to change zoom level using the scroll.

In the example GIF, the 4:3 button sets the min-scale to 1.333. You should expect the image get zoomed in immediately but it doesn't.

ezgif-3-8e3f77b63b62

@jmikh jmikh added the bug Something isn't working label Apr 18, 2020
@timtnleeProject
Copy link
Owner

When ratio change, the component will reset the scaling.

resetData: function () {
  this.setTL$.next({ left: 0, top: 0 })
  const scale = (this.ratio > this.imgRatio)
    ? this.imgRatio / this.ratio
    : 1
  // origin --->
  this.setWH$.next(scale)
  // will be update in next version --->
  this.setWH$.next(Math.max(scale, this.minScale))
}

Also, be aware that the component will adjust the initial scaling by image ratio, so be careful of setting the min-scale too large.
image

@timtnleeProject
Copy link
Owner

Fixed: v1.1.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants