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.10.3 to 0.11.0

2

index.js

@@ -18,3 +18,3 @@ export { debounce, deepClone, deepCompare, distance, emptyCoordinates, getCloserAngle, getDirectionNames, getOptions, isArray, isArrayBufferLike, isBlob, isCardinalDirection, isCrossOriginURL, isDataUrl, isFunction, isGreater, isLocal, isLower, isMouseEvent, isNaN, isNumber, isNumeric, isObject, isOrdinalDirection, isRoughlyEqual, isString, isTouchEvent, isUndefined, isWheelEvent, parseNumber, promiseTimeout, sign } from './utils/index.js';

export { fitVisibleArea } from './service/fitVisibleArea.js';
export { fillMoveDirections, fillResizeDirections, normalizeCenter, normalizeImageTransform, normalizeMoveDirections, normalizeResizeDirections } from './service/normalize.js';
export { fillMoveDirections, fillResizeDirections, normalizeCenter, normalizeFlip, normalizeImageTransform, normalizeMoveDirections, normalizeResizeDirections } from './service/normalize.js';
export { touchesToImageTransform, wheelEventToImageTransform } from './service/imageTransforms.js';

@@ -21,0 +21,0 @@ export { isEqualState } from './service/isEqualState.js';

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

import { reconcileState } from '../state/reconcileState.js';
import { normalizeImageTransform, normalizeMoveDirections, fillMoveDirections, normalizeResizeDirections, fillResizeDirections } from '../service/normalize.js';
import { normalizeImageTransform, normalizeFlip, normalizeMoveDirections, fillMoveDirections, normalizeResizeDirections, fillResizeDirections } from '../service/normalize.js';
import { hasInteractions } from '../service/interactions.js';

@@ -248,8 +248,10 @@

if (options === void 0) { options = {}; }
var _a = options.interaction, interaction = _a === void 0 ? false : _a, _b = options.immediately, immediately = _b === void 0 ? true : _b, _c = options.transitions, transitions = _c === void 0 ? true : _c;
var _a = options.interaction, interaction = _a === void 0 ? false : _a, _b = options.immediately, immediately = _b === void 0 ? true : _b, _c = options.transitions, transitions = _c === void 0 ? true : _c, _d = options.normalize, normalize = _d === void 0 ? true : _d;
var state = _this.getState();
var flip = {
horizontal: horizontal,
vertical: vertical,
};
_this.transformImage({
flip: {
horizontal: horizontal,
vertical: vertical,
},
flip: state && normalize ? normalizeFlip(state, flip) : flip,
}, { interaction: interaction, immediately: immediately, transitions: transitions });

@@ -256,0 +258,0 @@ };

@@ -159,2 +159,3 @@ 'use strict';

exports.normalizeCenter = normalize.normalizeCenter;
exports.normalizeFlip = normalize.normalizeFlip;
exports.normalizeImageTransform = normalize.normalizeImageTransform;

@@ -161,0 +162,0 @@ exports.normalizeMoveDirections = normalize.normalizeMoveDirections;

@@ -251,8 +251,10 @@ 'use strict';

if (options === void 0) { options = {}; }
var _a = options.interaction, interaction = _a === void 0 ? false : _a, _b = options.immediately, immediately = _b === void 0 ? true : _b, _c = options.transitions, transitions = _c === void 0 ? true : _c;
var _a = options.interaction, interaction = _a === void 0 ? false : _a, _b = options.immediately, immediately = _b === void 0 ? true : _b, _c = options.transitions, transitions = _c === void 0 ? true : _c, _d = options.normalize, normalize$1 = _d === void 0 ? true : _d;
var state = _this.getState();
var flip = {
horizontal: horizontal,
vertical: vertical,
};
_this.transformImage({
flip: {
horizontal: horizontal,
vertical: vertical,
},
flip: state && normalize$1 ? normalize.normalizeFlip(state, flip) : flip,
}, { interaction: interaction, immediately: immediately, transitions: transitions });

@@ -259,0 +261,0 @@ };

@@ -68,2 +68,3 @@ 'use strict';

exports.normalizeCenter = normalize.normalizeCenter;
exports.normalizeFlip = normalize.normalizeFlip;
exports.normalizeImageTransform = normalize.normalizeImageTransform;

@@ -70,0 +71,0 @@ exports.normalizeMoveDirections = normalize.normalizeMoveDirections;

@@ -25,5 +25,18 @@ 'use strict';

}
else {
return center;
return center;
}
function normalizeFlip(state, flip) {
if (state) {
var normalizedAngle = Math.abs(state.transforms.rotate % 180);
if (normalizedAngle <= 45 || normalizedAngle >= 135) {
return flip;
}
else {
return {
horizontal: flip.vertical,
vertical: flip.horizontal,
};
}
}
return flip;
}

@@ -77,4 +90,5 @@ function fillMoveDirections(directions) {

exports.normalizeCenter = normalizeCenter;
exports.normalizeFlip = normalizeFlip;
exports.normalizeImageTransform = normalizeImageTransform;
exports.normalizeMoveDirections = normalizeMoveDirections;
exports.normalizeResizeDirections = normalizeResizeDirections;
{
"name": "advanced-cropper",
"version": "0.10.3",
"version": "0.11.0",
"description": "The core of the advanced cropper libraries family",

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

@@ -7,4 +7,4 @@ 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 { fitVisibleArea } from './fitVisibleArea.js';
export { fillMoveDirections, fillResizeDirections, normalizeCenter, normalizeImageTransform, normalizeMoveDirections, normalizeResizeDirections } from './normalize.js';
export { fillMoveDirections, fillResizeDirections, normalizeCenter, normalizeFlip, normalizeImageTransform, normalizeMoveDirections, normalizeResizeDirections } from './normalize.js';
export { touchesToImageTransform, wheelEventToImageTransform } from './imageTransforms.js';
export { isEqualState } from './isEqualState.js';

@@ -1,4 +0,5 @@

import { CropperState, ImageTransform, MoveDirections, Point, ResizeDirections } from "../types/index";
import { CropperState, Flip, ImageTransform, MoveDirections, Point, ResizeDirections } from "../types/index";
declare function normalizeResizeDirections(state: CropperState, directions: Partial<ResizeDirections>): ResizeDirections;
declare function normalizeCenter(state: CropperState, center: Point): Point;
declare function normalizeFlip(state: CropperState, flip: Flip): Flip;
declare function fillMoveDirections(directions: Partial<MoveDirections>): MoveDirections;

@@ -8,2 +9,2 @@ declare function fillResizeDirections(directions: Partial<ResizeDirections>): ResizeDirections;

declare function normalizeImageTransform(state: CropperState, transform: ImageTransform): ImageTransform;
export { normalizeResizeDirections, normalizeCenter, fillMoveDirections, fillResizeDirections, normalizeMoveDirections, normalizeImageTransform };
export { normalizeResizeDirections, normalizeCenter, normalizeFlip, fillMoveDirections, fillResizeDirections, normalizeMoveDirections, normalizeImageTransform };

@@ -21,5 +21,18 @@ import { isNumber } from '../utils/index.js';

}
else {
return center;
return center;
}
function normalizeFlip(state, flip) {
if (state) {
var normalizedAngle = Math.abs(state.transforms.rotate % 180);
if (normalizedAngle <= 45 || normalizedAngle >= 135) {
return flip;
}
else {
return {
horizontal: flip.vertical,
vertical: flip.horizontal,
};
}
}
return flip;
}

@@ -70,2 +83,2 @@ function fillMoveDirections(directions) {

export { fillMoveDirections, fillResizeDirections, normalizeCenter, normalizeImageTransform, normalizeMoveDirections, normalizeResizeDirections };
export { fillMoveDirections, fillResizeDirections, normalizeCenter, normalizeFlip, normalizeImageTransform, normalizeMoveDirections, normalizeResizeDirections };
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