Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

advanced-cropper

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

advanced-cropper - npm Package Compare versions

Comparing version 0.11.0 to 0.11.1

4

node/service/utils.js

@@ -321,3 +321,5 @@ 'use strict';

size.height) {
return !minimum || sizeDistance(size, reference) < sizeDistance(minimum, reference) ? size : minimum;
return !minimum || index.isLower(sizeDistance(size, reference), sizeDistance(minimum, reference))
? size
: minimum;
}

@@ -324,0 +326,0 @@ else {

@@ -21,5 +21,12 @@ 'use strict';

// Fit the size of coordinates to existing size restrictions and visible area
result.coordinates = tslib.__assign(tslib.__assign({}, state.coordinates), approximateSize.approximateSize({
width: state.coordinates.width,
height: state.coordinates.height,
var brokenRatio = utils.getBrokenRatio(utils.ratio(state.coordinates), aspectRatio);
var desiredSize = brokenRatio
? {
height: state.coordinates.height,
width: state.coordinates.height * brokenRatio,
}
: state.coordinates;
result.coordinates = tslib.__assign(tslib.__assign({}, result.coordinates), approximateSize.approximateSize({
width: desiredSize.width,
height: desiredSize.height,
aspectRatio: aspectRatio,

@@ -30,3 +37,3 @@ sizeRestrictions: sizeRestrictions.mergeSizeRestrictions(areaSizeRestrictions, sizeRestrictions$1),

result.coordinates = utils.applyMove(result.coordinates, utils.diff(utils.getCenter(state.coordinates), utils.getCenter(result.coordinates)));
var scaleModifier = Math.max(result.coordinates.width / state.coordinates.width, result.coordinates.height / state.coordinates.height);
var scaleModifier = Math.max(result.coordinates.width / result.visibleArea.width, result.coordinates.height / result.visibleArea.height, 1);
// Fit the visible area to its size restrictions and boundary aspect ratio:

@@ -33,0 +40,0 @@ result.visibleArea = tslib.__assign(tslib.__assign({}, state.visibleArea), approximateSize.approximateSize({

{
"name": "advanced-cropper",
"version": "0.11.0",
"version": "0.11.1",
"description": "The core of the advanced cropper libraries family",

@@ -5,0 +5,0 @@ "author": "Norserium",

@@ -317,3 +317,5 @@ import { __assign } from 'tslib';

size.height) {
return !minimum || sizeDistance(size, reference) < sizeDistance(minimum, reference) ? size : minimum;
return !minimum || isLower(sizeDistance(size, reference), sizeDistance(minimum, reference))
? size
: minimum;
}

@@ -320,0 +322,0 @@ else {

import { __assign } from 'tslib';
import { applyMove, diff, getCenter, ratio, moveToPositionRestrictions, mergePositionRestrictions, coordinatesToPositionRestrictions } from '../service/utils.js';
import { getBrokenRatio, ratio, applyMove, diff, getCenter, moveToPositionRestrictions, mergePositionRestrictions, coordinatesToPositionRestrictions } from '../service/utils.js';
import { mergeSizeRestrictions } from '../service/sizeRestrictions.js';

@@ -17,5 +17,12 @@ import { isInitializedState, getAspectRatio, getSizeRestrictions, getAreaSizeRestrictions, getAreaPositionRestrictions, getPositionRestrictions } from '../service/helpers.js';

// Fit the size of coordinates to existing size restrictions and visible area
result.coordinates = __assign(__assign({}, state.coordinates), approximateSize({
width: state.coordinates.width,
height: state.coordinates.height,
var brokenRatio = getBrokenRatio(ratio(state.coordinates), aspectRatio);
var desiredSize = brokenRatio
? {
height: state.coordinates.height,
width: state.coordinates.height * brokenRatio,
}
: state.coordinates;
result.coordinates = __assign(__assign({}, result.coordinates), approximateSize({
width: desiredSize.width,
height: desiredSize.height,
aspectRatio: aspectRatio,

@@ -26,3 +33,3 @@ sizeRestrictions: mergeSizeRestrictions(areaSizeRestrictions, sizeRestrictions),

result.coordinates = applyMove(result.coordinates, diff(getCenter(state.coordinates), getCenter(result.coordinates)));
var scaleModifier = Math.max(result.coordinates.width / state.coordinates.width, result.coordinates.height / state.coordinates.height);
var scaleModifier = Math.max(result.coordinates.width / result.visibleArea.width, result.coordinates.height / result.visibleArea.height, 1);
// Fit the visible area to its size restrictions and boundary aspect ratio:

@@ -29,0 +36,0 @@ result.visibleArea = __assign(__assign({}, state.visibleArea), approximateSize({

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc