@@ -191,6 +191,9 @@ const ALLOWED_FILE_TYPES = {
AUDIO: 'audio',
};
+const MAX_ZOOM_LEVEL = 2;
+const MIN_ZOOM_LEVEL = 1;
+
export default {
components: {
Thumbnail,
@@ -269,7 +272,7 @@ export default {
imageRotationStyle() {
return {
transform: `rotate(${this.activeImageRotation}deg) scale(${this.zoomScale})`,
- cursor: this.zoomScale < 1.5 ? 'zoom-in' : 'zoom-out',
+ cursor: this.zoomScale < MAX_ZOOM_LEVEL ? 'zoom-in' : 'zoom-out',
};
},
},
@@ -336,19 +339,19 @@ export default {
}
},
onClickZoomImage() {
- this.onZoom(0.05);
+ this.onZoom(0.1);
},
onZoom(scale) {
if (!this.isImage) {
return;
}
- // Reset zoom scale if it is 1.5
- if (scale > 0 && this.zoomScale >= 1.5) {
+
+ if (scale > 0 && this.zoomScale >= MAX_ZOOM_LEVEL) {
this.zoomScale = 1;
return;
}
- // Reset zoom scale if it is 0.5
- if (scale < 0 && this.zoomScale <= 0.5) {
+
+ if (scale < 0 && this.zoomScale <= MIN_ZOOM_LEVEL) {
this.zoomScale = 1;
return;
}
@@ -358,7 +361,7 @@ export default {
if (!this.isImage) {
return;
}
- const scale = e.deltaY > 0 ? -0.05 : 0.05;
+ const scale = e.deltaY > 0 ? -0.1 : 0.1;
this.onZoom(scale);
},
},