cloudimage-responsive-utils
Advanced tools
Comparing version 2.3.1-beta.0 to 2.3.1-beta.1
@@ -43,3 +43,4 @@ "use strict"; | ||
ignoreStyleImgSize = config.ignoreStyleImgSize, | ||
imageSizeAttributes = config.imageSizeAttributes; | ||
imageSizeAttributes = config.imageSizeAttributes, | ||
detectDimension = config.detectDimension; | ||
var ignoreNodeImgSize = typeof _ignoreNodeImgSize !== 'undefined' ? _ignoreNodeImgSize : imageSizeAttributes !== 'use'; | ||
@@ -74,3 +75,3 @@ var crop = (0, _isCrop.isCrop)(params.func || config.params.func); | ||
if (!crop) { | ||
if (!crop && detectDimension !== 'height') { | ||
return null; | ||
@@ -77,0 +78,0 @@ } |
@@ -16,3 +16,3 @@ "use strict"; | ||
parentNode = parentNode && parentNode.parentNode; | ||
size = typeof parentNode.getBoundingClientRect === 'function' ? parentNode.getBoundingClientRect()[type] : window.innerWidth; | ||
size = typeof parentNode.getBoundingClientRect === 'function' ? parentNode.getBoundingClientRect()[type] : null; | ||
maxCount = maxCount + 1; | ||
@@ -25,3 +25,3 @@ } while (parentNode && !size && maxCount > 5); | ||
if (!size) { | ||
size = window.innerWidth; | ||
size = getDefaultDimension(type); | ||
} | ||
@@ -32,2 +32,6 @@ | ||
exports.getParentContainerSize = getParentContainerSize; | ||
exports.getParentContainerSize = getParentContainerSize; | ||
function getDefaultDimension(type) { | ||
return type === 'width' ? window.innerWidth : window.innerHeight; | ||
} |
{ | ||
"name": "cloudimage-responsive-utils", | ||
"version": "2.3.1-beta.0", | ||
"version": "2.3.1-beta.1", | ||
"description": "cloudimage responsive utils", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -24,3 +24,3 @@ import { convertToPX } from '../utils/convert-to-px'; | ||
const { imgNode = null, config = {}, imgNodeHeight = null, params = {}, size, width } = props; | ||
const { ignoreNodeImgSize: _ignoreNodeImgSize, ignoreStyleImgSize, imageSizeAttributes } = config; | ||
const { ignoreNodeImgSize: _ignoreNodeImgSize, ignoreStyleImgSize, imageSizeAttributes, detectDimension } = config; | ||
const ignoreNodeImgSize = typeof _ignoreNodeImgSize !== 'undefined' ? | ||
@@ -56,3 +56,3 @@ _ignoreNodeImgSize : imageSizeAttributes !== 'use'; | ||
if (!crop) { | ||
if (!crop && detectDimension !== 'height') { | ||
return null; | ||
@@ -59,0 +59,0 @@ } |
@@ -8,3 +8,3 @@ export const getParentContainerSize = (img, type = 'width') => { | ||
parentNode = parentNode && parentNode.parentNode; | ||
size = typeof parentNode.getBoundingClientRect === 'function' ? parentNode.getBoundingClientRect()[type] : window.innerWidth; | ||
size = typeof parentNode.getBoundingClientRect === 'function' ? parentNode.getBoundingClientRect()[type] : null | ||
maxCount = maxCount + 1; | ||
@@ -17,3 +17,3 @@ } while (parentNode && !size && maxCount > 5) | ||
if (!size) { | ||
size = window.innerWidth; | ||
size = getDefaultDimension(type); | ||
} | ||
@@ -23,1 +23,5 @@ | ||
}; | ||
function getDefaultDimension(type) { | ||
return type === 'width' ? window.innerWidth : window.innerHeight; | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
104288
2500