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.13.0 to 0.14.0

styles/CropperSource.scss

4

canvas/index.js

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

}
ctx.drawImage(source, coordinates.left, coordinates.top, coordinates.width, coordinates.height, 0, 0, canvas.width, canvas.height);
var offsetX = coordinates.left < 0 ? -coordinates.left : 0;
var offsetY = coordinates.top < 0 ? -coordinates.top : 0;
ctx.drawImage(source, coordinates.left + offsetX, coordinates.top + offsetY, coordinates.width, coordinates.height, offsetX, offsetY, canvas.width, canvas.height);
}

@@ -55,0 +57,0 @@ return canvas;

@@ -21,3 +21,2 @@ import 'tslib';

result.visibleArea.width = visibleAreaSize.height * ratio(result.boundary);
result.visibleArea = moveToPositionRestrictions(result.visibleArea, getAreaPositionRestrictions(result, settings));
}

@@ -27,4 +26,4 @@ else {

result.visibleArea.height = visibleAreaSize.width / ratio(result.boundary);
result.visibleArea = moveToPositionRestrictions(result.visibleArea, getAreaPositionRestrictions(result, settings));
}
result.visibleArea = moveToPositionRestrictions(result.visibleArea, getAreaPositionRestrictions(result, settings));
return fitCoordinates(result, settings);

@@ -31,0 +30,0 @@ }

import { Coordinates, CropperImage, CropperState, CropperTransitions, Transforms } from "../types/index";
declare function getStyleTransforms({ rotate, flip, scale }: Transforms & {
scale: number;
declare function getStyleTransforms(transforms: Partial<Transforms> & {
scale?: number;
}): string;

@@ -5,0 +5,0 @@ interface LoadImageSettings {

@@ -120,9 +120,5 @@ import { __assign } from 'tslib';

}
function getStyleTransforms(_a) {
var rotate = _a.rotate, flip = _a.flip, scale = _a.scale;
var transform = '';
transform += " rotate(" + rotate + "deg) ";
transform += " scaleX(" + scale * (flip.horizontal ? -1 : 1) + ") ";
transform += " scaleY(" + scale * (flip.vertical ? -1 : 1) + ") ";
return transform;
function getStyleTransforms(transforms) {
var _a = transforms.rotate, rotate = _a === void 0 ? 0 : _a, _b = transforms.flip, flip = _b === void 0 ? { horizontal: false, vertical: false } : _b, _c = transforms.scale, scale = _c === void 0 ? 1 : _c;
return " rotate(" + rotate + "deg) scaleX(" + scale * (flip.horizontal ? -1 : 1) + ") scaleY(" + scale * (flip.vertical ? -1 : 1) + ")";
}

@@ -129,0 +125,0 @@ function getStringFromCharCode(dataView, start, length) {

@@ -68,3 +68,4 @@ import { Boundary, CoordinatesTransform, CoreSettings, CropperImage, CropperInteractions, CropperState, CropperTransitionsSettings, DefaultTransforms, ImageTransform, ModifierSettings, MoveDirections, Nullable, PostprocessAction, PostprocessFunction, Priority, ResizeDirections, Rotate, Scale, VisibleArea } from "../types/index";

hasInteractions: () => boolean;
protected disableTransitions: {
startTransitions: () => void;
protected endTransitions: {
(): void;

@@ -92,3 +93,3 @@ clear(): void;

moveCoordinatesEnd: (options?: ImmediatelyOptions & TransitionOptions) => void;
resizeCoordinates: (directions: Partial<ResizeDirections>, parameters?: Record<string, unknown>, options?: InteractionOptions & ImmediatelyOptions & NormalizeOptions & TransitionOptions) => void;
resizeCoordinates: (directions: Partial<ResizeDirections>, parameters: unknown, options?: InteractionOptions & ImmediatelyOptions & NormalizeOptions & TransitionOptions) => void;
resizeCoordinatesEnd: (options?: ImmediatelyOptions & TransitionOptions) => void;

@@ -104,3 +105,8 @@ getStencilCoordinates: () => {

}) => import("../types/index").Coordinates | null;
getVisibleArea: () => {} | null;
getVisibleArea: () => {
width: number;
height: number;
top: number;
left: number;
} | null;
getSettings: () => Settings;

@@ -107,0 +113,0 @@ getState: () => CropperState | null;

@@ -1,3 +0,3 @@

import { __assign } from 'tslib';
import { getOptions, deepClone, debounce, isArray, isFunction, deepCompare, isUndefined } from '../utils/index.js';
import { __assign, __rest } from 'tslib';
import { getOptions, deepClone, debounce, isArray, isFunction, deepCompare, isUndefined, isObject } from '../utils/index.js';
import { getCoefficient, isConsistentState, getStencilCoordinates, getRoundedCoordinates } from '../service/helpers.js';

@@ -53,3 +53,12 @@ import { copyState } from '../state/copyState.js';

};
this.disableTransitions = debounce(function () {
this.startTransitions = function () {
var _a = _this.getProps(), onTransitionsStart = _a.onTransitionsStart, getInstance = _a.getInstance;
var _b = _this.getData(), transitions = _b.transitions, data = __rest(_b, ["transitions"]);
_this.setData(__assign(__assign({}, data), { transitions: true }));
if (!transitions) {
runCallback(onTransitionsStart, getInstance);
}
_this.endTransitions();
};
this.endTransitions = debounce(function () {
var _a = _this.getProps(), onTransitionsEnd = _a.onTransitionsEnd, getInstance = _a.getInstance;

@@ -99,3 +108,3 @@ _this.setData(__assign(__assign({}, _this.getData()), { transitions: false }));

if (transitions && affectTransitionProperties) {
_this.disableTransitions();
_this.endTransitions();
}

@@ -357,3 +366,2 @@ currentData = __assign(__assign({}, currentData), { state: copyState(state), transitions: transitions && affectTransitionProperties });

this.resizeCoordinates = function (directions, parameters, options) {
if (parameters === void 0) { parameters = {}; }
if (options === void 0) { options = {}; }

@@ -369,3 +377,3 @@ var state = _this.getData().state;

: fillResizeDirections(directions);
var result = _this.applyPostProcess({ name: 'resizeCoordinates', interaction: interaction, immediately: immediately, transitions: transitions }, (resizeCoordinatesAlgorithm || resizeCoordinates)(state, settings, normalizedDirections, parameters));
var result = _this.applyPostProcess({ name: 'resizeCoordinates', interaction: interaction, immediately: immediately, transitions: transitions }, (resizeCoordinatesAlgorithm || resizeCoordinates)(state, settings, normalizedDirections, isObject(parameters) ? parameters : {}));
callbacks.push(onResize);

@@ -421,3 +429,3 @@ if (interaction) {

var state = _this.getData().state;
if (state) {
if (state === null || state === void 0 ? void 0 : state.visibleArea) {
return __assign({}, state.visibleArea);

@@ -424,0 +432,0 @@ }

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

}
ctx.drawImage(source, coordinates.left, coordinates.top, coordinates.width, coordinates.height, 0, 0, canvas.width, canvas.height);
var offsetX = coordinates.left < 0 ? -coordinates.left : 0;
var offsetY = coordinates.top < 0 ? -coordinates.top : 0;
ctx.drawImage(source, coordinates.left + offsetX, coordinates.top + offsetY, coordinates.width, coordinates.height, offsetX, offsetY, canvas.width, canvas.height);
}

@@ -59,0 +61,0 @@ return canvas;

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

result.visibleArea.width = visibleAreaSize.height * utils.ratio(result.boundary);
result.visibleArea = utils.moveToPositionRestrictions(result.visibleArea, helpers.getAreaPositionRestrictions(result, settings));
}

@@ -31,4 +30,4 @@ else {

result.visibleArea.height = visibleAreaSize.width / utils.ratio(result.boundary);
result.visibleArea = utils.moveToPositionRestrictions(result.visibleArea, helpers.getAreaPositionRestrictions(result, settings));
}
result.visibleArea = utils.moveToPositionRestrictions(result.visibleArea, helpers.getAreaPositionRestrictions(result, settings));
return fitCoordinates.fitCoordinates(result, settings);

@@ -35,0 +34,0 @@ }

@@ -124,9 +124,5 @@ 'use strict';

}
function getStyleTransforms(_a) {
var rotate = _a.rotate, flip = _a.flip, scale = _a.scale;
var transform = '';
transform += " rotate(" + rotate + "deg) ";
transform += " scaleX(" + scale * (flip.horizontal ? -1 : 1) + ") ";
transform += " scaleY(" + scale * (flip.vertical ? -1 : 1) + ") ";
return transform;
function getStyleTransforms(transforms) {
var _a = transforms.rotate, rotate = _a === void 0 ? 0 : _a, _b = transforms.flip, flip = _b === void 0 ? { horizontal: false, vertical: false } : _b, _c = transforms.scale, scale = _c === void 0 ? 1 : _c;
return " rotate(" + rotate + "deg) scaleX(" + scale * (flip.horizontal ? -1 : 1) + ") scaleY(" + scale * (flip.vertical ? -1 : 1) + ")";
}

@@ -133,0 +129,0 @@ function getStringFromCharCode(dataView, start, length) {

@@ -57,3 +57,12 @@ 'use strict';

};
this.disableTransitions = index.debounce(function () {
this.startTransitions = function () {
var _a = _this.getProps(), onTransitionsStart = _a.onTransitionsStart, getInstance = _a.getInstance;
var _b = _this.getData(), transitions = _b.transitions, data = tslib.__rest(_b, ["transitions"]);
_this.setData(tslib.__assign(tslib.__assign({}, data), { transitions: true }));
if (!transitions) {
runCallback(onTransitionsStart, getInstance);
}
_this.endTransitions();
};
this.endTransitions = index.debounce(function () {
var _a = _this.getProps(), onTransitionsEnd = _a.onTransitionsEnd, getInstance = _a.getInstance;

@@ -103,3 +112,3 @@ _this.setData(tslib.__assign(tslib.__assign({}, _this.getData()), { transitions: false }));

if (transitions && affectTransitionProperties) {
_this.disableTransitions();
_this.endTransitions();
}

@@ -361,3 +370,2 @@ currentData = tslib.__assign(tslib.__assign({}, currentData), { state: copyState.copyState(state), transitions: transitions && affectTransitionProperties });

this.resizeCoordinates = function (directions, parameters, options) {
if (parameters === void 0) { parameters = {}; }
if (options === void 0) { options = {}; }

@@ -373,3 +381,3 @@ var state = _this.getData().state;

: normalize.fillResizeDirections(directions);
var result = _this.applyPostProcess({ name: 'resizeCoordinates', interaction: interaction, immediately: immediately, transitions: transitions }, (resizeCoordinatesAlgorithm || resizeCoordinates.resizeCoordinates)(state, settings, normalizedDirections, parameters));
var result = _this.applyPostProcess({ name: 'resizeCoordinates', interaction: interaction, immediately: immediately, transitions: transitions }, (resizeCoordinatesAlgorithm || resizeCoordinates.resizeCoordinates)(state, settings, normalizedDirections, index.isObject(parameters) ? parameters : {}));
callbacks.push(onResize);

@@ -425,3 +433,3 @@ if (interaction) {

var state = _this.getData().state;
if (state) {
if (state === null || state === void 0 ? void 0 : state.visibleArea) {
return tslib.__assign({}, state.visibleArea);

@@ -428,0 +436,0 @@ }

@@ -147,7 +147,3 @@ 'use strict';

}
function autoZoom(state, settings, action) {
return zoomStencil(fitStencilToImage(state, settings, action), settings, action);
}
exports.autoZoom = autoZoom;
exports.defaultSize = defaultSize;

@@ -154,0 +150,0 @@ exports.fitStencilToImage = fitStencilToImage;

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

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

@@ -29,3 +29,2 @@ import { Coordinates, CoreSettings, CropperState, ImageTransform, InitializedCropperState, PostprocessAction, RawAspectRatio, ResizeDirections } from "../../types/index";

declare function zoomStencil(state: ExtendedState | ExtendedInitializedState, settings: CoreSettings & FitToImageSettings, action: PostprocessAction<AbstractCropperPostprocess>): ExtendedState;
declare function autoZoom(state: ExtendedState | ExtendedInitializedState, settings: CoreSettings & FitToImageSettings, action: PostprocessAction<AbstractCropperPostprocess>): ExtendedState;
export { stencilConstraints, transformImage, resizeCoordinates, defaultSize, fitStencilToImage, zoomStencil, autoZoom };
export { stencilConstraints, transformImage, resizeCoordinates, defaultSize, fitStencilToImage, zoomStencil };

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

}
function autoZoom(state, settings, action) {
return zoomStencil(fitStencilToImage(state, settings, action), settings, action);
}
export { autoZoom, defaultSize, fitStencilToImage, resizeCoordinates, stencilConstraints, transformImage, zoomStencil };
export { defaultSize, fitStencilToImage, resizeCoordinates, stencilConstraints, transformImage, zoomStencil };

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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