Merge pull request #7918 from capilkey/fix-mobile-zoom

Add max and min zoom for mobile
This commit is contained in:
Anton Georgiev 2019-08-12 18:02:43 -04:00 committed by GitHub
commit a285568cdb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -318,8 +318,12 @@ export default class PresentationOverlay extends Component {
const currDiff = PresentationOverlay.calculateDistance(event.touches);
if (currDiff > 0) {
const newZoom = zoom + (currDiff - this.prevDiff);
let newZoom = zoom + (currDiff - this.prevDiff);
if (newZoom <= HUNDRED_PERCENT) {
newZoom = HUNDRED_PERCENT;
} else if (newZoom >= MAX_PERCENT) {
newZoom = MAX_PERCENT;
}
const svgPosition = this.getTransformedSvgPoint(touchCenterPoint.x, touchCenterPoint.y);
this.doZoomCall(newZoom, svgPosition.x, svgPosition.y);
}