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.5.2 to 0.6.0

defaults/postProcess/autoZoom/staticAutoZoom.d.ts

4

algorithms/flipImageAlgorithm.js
import 'tslib';
import { rotatePoint, getCenter, applyMove, diff, moveToPositionRestrictions } from '../service/utils.js';
import { isInitialized, getTransformedImageSize, getAreaPositionRestrictions } from '../service/helpers.js';
import { isInitializedState, getTransformedImageSize, getAreaPositionRestrictions } from '../service/helpers.js';
import { copyState } from '../state/copyState.js';

@@ -8,3 +8,3 @@ import '../types.js';

function flipImageAlgorithm(state, settings, horizontal, vertical) {
if (isInitialized(state)) {
if (isInitializedState(state)) {
var result = copyState(state);

@@ -11,0 +11,0 @@ var rotate = state.transforms.rotate;

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

import { mergeSizeRestrictions } from '../service/sizeRestrictions.js';
import { isInitialized, getTransformedImageSize, getSizeRestrictions, getAspectRatio, getAreaSizeRestrictions, getPositionRestrictions, getAreaPositionRestrictions } from '../service/helpers.js';
import { isInitializedState, getTransformedImageSize, getSizeRestrictions, getAspectRatio, getAreaSizeRestrictions, getPositionRestrictions, getAreaPositionRestrictions } from '../service/helpers.js';
import { copyState } from '../state/copyState.js';

@@ -12,3 +12,3 @@ import '../types.js';

function rotateImageAlgorithm(state, settings, rotate) {
if (isInitialized(state)) {
if (isInitializedState(state)) {
var result = copyState(state);

@@ -15,0 +15,0 @@ var angle = isNumber(rotate) ? rotate : rotate.angle;

import 'tslib';
import { isNumber, isRoughlyEqual } from '../utils.js';
import { applyMove, maxScale, positionToSizeRestrictions, minScale, applyScale, moveToPositionRestrictions, mergePositionRestrictions, coordinatesToPositionRestrictions, getCenter, inverseMove, fitToPositionRestrictions } from '../service/utils.js';
import { isInitialized, getSizeRestrictions, getPositionRestrictions, getAreaSizeRestrictions, getAreaPositionRestrictions } from '../service/helpers.js';
import { isInitializedState, getSizeRestrictions, getPositionRestrictions, getAreaSizeRestrictions, getAreaPositionRestrictions } from '../service/helpers.js';
import { copyState } from '../state/copyState.js';

@@ -11,3 +11,3 @@ import '../types.js';

var adjustStencil = settings.adjustStencil;
if (isInitialized(state)) {
if (isInitializedState(state)) {
var result = copyState(state);

@@ -14,0 +14,0 @@ // It's reversed because zooming in the image is actually zooming out visible area

import { __assign } from 'tslib';
import { isNumeric } from './utils.js';
import { rotateSize, rotatePoint, getCenter } from './service/utils.js';
import { isInitialized } from './service/helpers.js';
import { isInitializedState } from './service/helpers.js';
import './types.js';

@@ -56,3 +56,3 @@ import { approximateSize } from './service/approximateSize.js';

function drawCroppedArea(state, image, resultCanvas, spareCanvas, options) {
if (isInitialized(state)) {
if (isInitializedState(state)) {
var transforms = state.transforms, coordinates = state.coordinates;

@@ -59,0 +59,0 @@ var imageTransformed = transforms.rotate !== 0 || transforms.flip.horizontal || transforms.flip.vertical;

@@ -16,2 +16,3 @@ import { AreaPositionRestrictions, AreaSizeRestrictions, AspectRatio, CropperSettings, CropperState, DefaultCoordinates, DefaultPosition, DefaultSize, DefaultVisibleArea, ImageRestriction, PositionRestrictions, SizeRestrictions, Size } from "../types";

adjustStencil?: boolean;
scaleImage?: boolean;
aspectRatio?: AspectRatio | ((state: CropperState, setting: CropperSettings) => AspectRatio);

@@ -57,2 +58,3 @@ areaSizeRestrictions?: AreaSizeRestrictions | ((state: CropperState, settings: DefaultSettings) => AreaSizeRestrictions);

imageRestriction?: ImageRestriction | undefined;
scaleImage?: boolean | undefined;
};

@@ -82,2 +84,3 @@ declare function defaultSettings(): {

imageRestriction?: ImageRestriction | undefined;
scaleImage?: boolean | undefined;
};

@@ -84,0 +87,0 @@ declare const defaultPostprocess: typeof autoZoom;

import 'tslib';
import { applyScale, fitToSizeRestrictions, applyMove, diff, getCenter, moveToPositionRestrictions, mergePositionRestrictions, coordinatesToPositionRestrictions } from '../../../service/utils.js';
import { isInitialized, getAreaSizeRestrictions, getAreaPositionRestrictions } from '../../../service/helpers.js';
import { isInitializedState, getAreaSizeRestrictions, getAreaPositionRestrictions } from '../../../service/helpers.js';
import { copyState } from '../../../state/copyState.js';

@@ -9,3 +9,3 @@ import '../../../types.js';

function fixedStencilAutoZoomAlgorithm(state, settings) {
if (isInitialized(state)) {
if (isInitializedState(state)) {
var result = copyState(state);

@@ -12,0 +12,0 @@ var stencil = getFixedStencilSize(state, settings);

import 'tslib';
import { ratio, applyScale, fitToSizeRestrictions, applyMove, diff, getCenter, moveToPositionRestrictions, mergePositionRestrictions, coordinatesToPositionRestrictions } from '../../../service/utils.js';
import { isInitialized, getAreaSizeRestrictions, getAreaPositionRestrictions, getPositionRestrictions } from '../../../service/helpers.js';
import { isInitializedState, getAreaSizeRestrictions, getAreaPositionRestrictions, getPositionRestrictions } from '../../../service/helpers.js';
import { copyState } from '../../../state/copyState.js';

@@ -8,3 +8,3 @@ import '../../../types.js';

function hybridStencilAutoZoomAlgorithm(state, settings) {
if (isInitialized(state)) {
if (isInitializedState(state)) {
var result = copyState(state);

@@ -11,0 +11,0 @@ // Checks that coordinates has the same ratio that coordinates:

@@ -6,4 +6,5 @@ import { CropperSettings, CropperState, PostprocessAction } from "../../../types";

stencilSize?: StencilSize;
scaleImage?: boolean;
}
declare function autoZoom(state: CropperState, settings: AutoZoomCropperSettings, action?: PostprocessAction): CropperState;
export { autoZoom };

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

import { fixedStencilAutoZoom } from './fixedStencilAutoZoom.js';
import { staticAutoZoom } from './staticAutoZoom.js';

@@ -16,3 +17,5 @@ function autoZoom(state, settings, action) {

else {
return simplestAutoZoom(state, settings, action);
return settings.scaleImage === false
? staticAutoZoom(state, settings, action)
: simplestAutoZoom(state, settings, action);
}

@@ -19,0 +22,0 @@ }

import 'tslib';
import { applyScale, maxScale } from '../../../service/utils.js';
import { isInitialized, getAreaSizeRestrictions } from '../../../service/helpers.js';
import { isInitializedState, getAreaSizeRestrictions } from '../../../service/helpers.js';
import { copyState } from '../../../state/copyState.js';

@@ -9,3 +9,3 @@ import '../../../types.js';

function simplestAutoZoomAlgorithm(state, settings) {
if (isInitialized(state)) {
if (isInitializedState(state)) {
var result = copyState(state);

@@ -12,0 +12,0 @@ var widthIntersections = Math.max(0, result.coordinates.width - result.visibleArea.width);

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

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

import { CropperSettings, CropperState, InitializedCropperState } from "../types";
declare function isInitialized(state: CropperState | null): state is InitializedCropperState;
declare function isInitializedState(state: CropperState | null): state is InitializedCropperState;
declare function getAreaSizeRestrictions(state: CropperState, settings: CropperSettings): {

@@ -35,2 +35,2 @@ minWidth: number;

declare function getMinimumSize(state: CropperState): number;
export { isInitialized, getAreaSizeRestrictions, getAreaPositionRestrictions, getSizeRestrictions, getPositionRestrictions, getCoefficient, getStencilCoordinates, getAspectRatio, getDefaultCoordinates, getDefaultVisibleArea, getTransformedImageSize, getMinimumSize };
export { isInitializedState, getAreaSizeRestrictions, getAreaPositionRestrictions, getSizeRestrictions, getPositionRestrictions, getCoefficient, getStencilCoordinates, getAspectRatio, getDefaultCoordinates, getDefaultVisibleArea, getTransformedImageSize, getMinimumSize };

@@ -5,3 +5,3 @@ import { isFunction, emptyCoordinates, isNumeric } from '../utils.js';

function isInitialized(state) {
function isInitializedState(state) {
return Boolean(state && state.visibleArea && state.coordinates);

@@ -29,3 +29,3 @@ }

function getStencilCoordinates(state) {
if (isInitialized(state)) {
if (isInitializedState(state)) {
var _a = state.coordinates, width = _a.width, height = _a.height, left = _a.left, top_1 = _a.top;

@@ -80,2 +80,2 @@ var coefficient = getCoefficient(state);

export { getAreaPositionRestrictions, getAreaSizeRestrictions, getAspectRatio, getCoefficient, getDefaultCoordinates, getDefaultVisibleArea, getMinimumSize, getPositionRestrictions, getSizeRestrictions, getStencilCoordinates, getTransformedImageSize, isInitialized };
export { getAreaPositionRestrictions, getAreaSizeRestrictions, getAspectRatio, getCoefficient, getDefaultCoordinates, getDefaultVisibleArea, getMinimumSize, getPositionRestrictions, getSizeRestrictions, getStencilCoordinates, getTransformedImageSize, isInitializedState };
export { applyDirections, applyMove, applyScale, calculateAspectRatio, coordinatesToPositionRestrictions, diff, fitToPositionRestrictions, fitToSizeRestrictions, getBrokenRatio, getCenter, getIntersections, inverseMove, maxScale, mergePositionRestrictions, minScale, moveToPositionRestrictions, positionToSizeRestrictions, ratio, resizeToSizeRestrictions, rotatePoint, rotateSize, sizeDistance } from './utils.js';
export { calculateAreaSizeRestrictions, calculateSizeRestrictions, mergeSizeRestrictions, validateSizeRestrictions } from './sizeRestrictions.js';
export { getAreaPositionRestrictions, getAreaSizeRestrictions, getAspectRatio, getCoefficient, getDefaultCoordinates, getDefaultVisibleArea, getMinimumSize, getPositionRestrictions, getSizeRestrictions, getStencilCoordinates, getTransformedImageSize, isInitialized } from './helpers.js';
export { getAreaPositionRestrictions, getAreaSizeRestrictions, getAspectRatio, getCoefficient, getDefaultCoordinates, getDefaultVisibleArea, getMinimumSize, getPositionRestrictions, getSizeRestrictions, getStencilCoordinates, getTransformedImageSize, isInitializedState } from './helpers.js';
export { approximateSize } from './approximateSize.js';

@@ -5,0 +5,0 @@ export { fitCoordinates } from './fitCoordinates.js';

import { moveToPositionRestrictions } from './utils.js';
import { isInitialized, getSizeRestrictions, getPositionRestrictions } from './helpers.js';
import { isInitializedState, getSizeRestrictions, getPositionRestrictions } from './helpers.js';
function roundCoordinates(state, settings) {
if (isInitialized(state)) {
if (isInitializedState(state)) {
var sizeRestrictions = getSizeRestrictions(state, settings);

@@ -7,0 +7,0 @@ var positionRestrictions = getPositionRestrictions(state, settings);

import 'tslib';
import { applyMove, moveToPositionRestrictions, mergePositionRestrictions, coordinatesToPositionRestrictions } from '../service/utils.js';
import { isInitialized, getPositionRestrictions } from '../service/helpers.js';
import { isInitializedState, getPositionRestrictions } from '../service/helpers.js';
import { copyState } from './copyState.js';

@@ -8,3 +8,3 @@ import '../types.js';

function moveCoordinates(state, settings, directions) {
if (isInitialized(state)) {
if (isInitializedState(state)) {
var result = copyState(state);

@@ -11,0 +11,0 @@ result.coordinates = applyMove(result.coordinates, directions);

import { __assign } from 'tslib';
import { mergePositionRestrictions, coordinatesToPositionRestrictions } from '../service/utils.js';
import { getMinimumSize, getSizeRestrictions, isInitialized, getPositionRestrictions, getAspectRatio } from '../service/helpers.js';
import { getMinimumSize, getSizeRestrictions, isInitializedState, getPositionRestrictions, getAspectRatio } from '../service/helpers.js';
import { copyState } from './copyState.js';

@@ -11,3 +11,3 @@ import '../types.js';

var sizeRestrictions = getSizeRestrictions(state, settings);
return isInitialized(state)
return isInitializedState(state)
? __assign(__assign({}, copyState(state)), { coordinates: resizeCoordinatesAlgorithm(state.coordinates, directions, options, {

@@ -14,0 +14,0 @@ positionRestrictions: mergePositionRestrictions(getPositionRestrictions(state, settings), coordinatesToPositionRestrictions(state.visibleArea)),

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