@cnbritain/merlin-frontend-elementmagnify-js
Advanced tools
Comparing version 1.5.3 to 1.5.4
@@ -39,4 +39,2 @@ "use strict"; | ||
// console.log(el); | ||
this.el = el; | ||
@@ -48,2 +46,5 @@ this.image = { | ||
}; | ||
options.minScale = calculateMinScale(this.image.width, this.image.height); | ||
this.isOpen = false; | ||
@@ -290,2 +291,16 @@ this.maxScale = options.maxScale; | ||
function calculateMinScale( imageWidth, imageHeight ){ | ||
var minScale = 1; | ||
// Landscape | ||
if( imageWidth > imageHeight ){ | ||
minScale = ( window.innerWidth - outerPadding - outerPadding ) / | ||
imageWidth; | ||
// Portrait or square | ||
} else { | ||
minScale = ( window.innerHeight - outerPadding - outerPadding ) / | ||
imageHeight; | ||
} | ||
return minScale; | ||
} | ||
function clampPosition(_x, _y, scale, imageWidth, imageHeight) { | ||
@@ -292,0 +307,0 @@ var maxX = Math.ceil(scale * imageWidth / 2); |
{ | ||
"name": "@cnbritain/merlin-frontend-elementmagnify-js", | ||
"cnOptions": {}, | ||
"version": "1.5.3", | ||
"version": "1.5.4", | ||
"description": "A handy-dandy reusuable front-end component for great justice.", | ||
@@ -6,0 +6,0 @@ "main": "js/index.js", |
41322
586