advanced-cropper
Advanced tools
Comparing version 0.8.2 to 0.8.3
@@ -38,5 +38,5 @@ import 'tslib'; | ||
}; | ||
// Bounding box ограничений для текущих координат | ||
// Bounding box for the current coordinates | ||
var angleRestrictions = imageToSizeRestrictions(image, Math.min(aspectRatio.maximum, Math.max(aspectRatio.minimum, ratio(coordinates))), boundingBox); | ||
// Рассматриваем как теущий размер, так и обрубленный максимальным bounding box: | ||
// Consider the current size and the cropped by maximum bounding box size | ||
var candidates = [ | ||
@@ -49,13 +49,11 @@ coordinates, | ||
]; | ||
// Если есть ограничения на соотношения сторон | ||
if (aspectRatio) { | ||
[aspectRatio.minimum, aspectRatio.maximum].forEach(function (ratio) { | ||
if (ratio && ratio !== Infinity) { | ||
var fittedSizeRestrictions = mergeSizeRestrictions(sizeRestrictions, imageToSizeRestrictions(image, ratio, boundingBox)); | ||
var width_1 = Math.min(coordinates.width, fittedSizeRestrictions.maxWidth); | ||
var height_1 = Math.min(coordinates.height, fittedSizeRestrictions.maxHeight); | ||
candidates.push({ width: width_1, height: width_1 / ratio }, { width: height_1 * ratio, height: height_1 }); | ||
} | ||
}); | ||
} | ||
// If we have some aspect ratio | ||
[aspectRatio.minimum, aspectRatio.maximum].forEach(function (ratio) { | ||
if (ratio && ratio !== Infinity) { | ||
var fittedSizeRestrictions = mergeSizeRestrictions(sizeRestrictions, imageToSizeRestrictions(image, ratio, boundingBox)); | ||
var width_1 = Math.min(coordinates.width, fittedSizeRestrictions.maxWidth); | ||
var height_1 = Math.min(coordinates.height, fittedSizeRestrictions.maxHeight); | ||
candidates.push({ width: width_1, height: width_1 / ratio }, { width: height_1 * ratio, height: height_1 }); | ||
} | ||
}); | ||
// Resize the candidates as much as possible to prevent breaking minimum size | ||
@@ -62,0 +60,0 @@ candidates = candidates.map(function (candidate) { |
@@ -22,3 +22,3 @@ export { updateStretcher } from './html/updateStretcher.js'; | ||
export { isEqualStates } from './service/isEqualStates.js'; | ||
export { getMimeType } from './service/mimes.js'; | ||
export { getMimeType } from './images/index.js'; | ||
export { moveCoordinatesAlgorithm } from './algorithms/moveCoordinatesAlgorithm.js'; | ||
@@ -25,0 +25,0 @@ export { fitDirections, resizeCoordinatesAlgorithm } from './algorithms/resizeCoordinatesAlgorithm.js'; |
@@ -168,3 +168,3 @@ import { __assign, __spreadArrays } from 'tslib'; | ||
else { | ||
if (process.env.NODE_ENV !== '1production') { | ||
if (process.env.NODE_ENV !== 'production') { | ||
console.error("Reconcile error: can't reconcile state. Perhaps, the restrictions are contradictory."); | ||
@@ -171,0 +171,0 @@ } |
{ | ||
"name": "advanced-cropper", | ||
"version": "0.8.2", | ||
"version": "0.8.3", | ||
"description": "The core of the advanced cropper libraries family", | ||
@@ -5,0 +5,0 @@ "author": "Norserium", |
@@ -10,2 +10,2 @@ export * from "./fitCoordinates"; | ||
export * from "./isEqualStates"; | ||
export * from "./mimes"; | ||
export * from "../images/index"; |
@@ -10,2 +10,2 @@ export { applyDirections, applyMove, applyScale, aspectRatioIntersection, coordinatesToPositionRestrictions, createAspectRatio, diff, fitToPositionRestrictions, fitToSizeRestrictions, getBrokenRatio, getCenter, getCloserSize, getIntersections, getTransitionStyle, inverseMove, isConsistentPosition, isConsistentSize, maxScale, mergePositionRestrictions, minScale, moveToPositionRestrictions, positionToSizeRestrictions, ratio, resizeToSizeRestrictions, rotatePoint, rotateSize, sizeDistance } from './utils.js'; | ||
export { isEqualStates } from './isEqualStates.js'; | ||
export { getMimeType } from './mimes.js'; | ||
export { getMimeType } from '../images/index.js'; |
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
231538
4816