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

@interactjs/modifiers

Package Overview
Dependencies
Maintainers
2
Versions
136
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@interactjs/modifiers - npm Package Compare versions

Comparing version 1.8.0-alpha.0 to 1.8.0-alpha.1

16

aspectRatio.js

@@ -72,3 +72,3 @@ /* eslint-disable */

});
startAll({ ...arg,
return startAll({ ...arg,
states: state.subStates

@@ -89,3 +89,3 @@ });

if (!state.subStates) {
return;
return null;
}

@@ -110,10 +110,10 @@

if (!result.changed) {
return;
if (result.changed) {
const xIsCriticalAxis = Math.abs(delta.x) > Math.abs(delta.y); // do aspect modification again with critical edge axis as primary
aspectMethod(state, xIsCriticalAxis, result.coords, result.rect);
extend(coords, result.coords);
}
const xIsCriticalAxis = Math.abs(delta.x) > Math.abs(delta.y); // do aspect modification again with critical edge axis as primary
aspectMethod(state, xIsCriticalAxis, result.coords, result.rect);
extend(coords, result.coords);
return result.eventProps;
},

@@ -120,0 +120,0 @@

@@ -81,2 +81,3 @@ import extend from "../utils/extend.js";

rect: arg.rect,
eventProps: [],
changed: true

@@ -96,13 +97,14 @@ };

const lastModifierCoords = extend({}, arg.coords);
let returnValue = null;
if (!state.methods.set || !shouldDo(options, preEnd, requireEndOnly, phase)) {
continue;
if (state.methods.set && shouldDo(options, preEnd, requireEndOnly, phase)) {
arg.state = state;
returnValue = state.methods.set(arg);
rectUtils.addEdges(edges, arg.rect, {
x: arg.coords.x - lastModifierCoords.x,
y: arg.coords.y - lastModifierCoords.y
});
}
arg.state = state;
state.methods.set(arg);
rectUtils.addEdges(edges, arg.rect, {
x: arg.coords.x - lastModifierCoords.x,
y: arg.coords.y - lastModifierCoords.y
});
result.eventProps.push(returnValue);
}

@@ -405,2 +407,16 @@

}
function addEventModifiers({
iEvent,
interaction: {
modifiers: {
result
}
}
}) {
if (result) {
iEvent.modifiers = result.eventProps;
}
}
const modifiersBase = {

@@ -422,3 +438,2 @@ id: 'modifiers/base',

},
offsets: {},
states: null,

@@ -434,2 +449,5 @@ result: null,

},
'interactions:after-action-start': restoreCoords,
'interactions:before-action-move': beforeMove,
'interactions:after-action-move': restoreCoords,
'interactions:action-resume': arg => {

@@ -444,6 +462,6 @@ const {

},
'interactions:after-action-move': restoreCoords,
'interactions:before-action-move': beforeMove,
'interactions:after-action-start': restoreCoords,
'interactions:before-action-end': beforeEnd,
'interactions:action-start': addEventModifiers,
'interactions:action-move': addEventModifiers,
'interactions:action-end': addEventModifiers,
'interactions:stop': stop

@@ -450,0 +468,0 @@ },

{
"name": "@interactjs/modifiers",
"version": "1.8.0-alpha.0",
"version": "1.8.0-alpha.1",
"license": "MIT",
"peerDependencies": {
"@interactjs/core": "1.8.0-alpha.0",
"@interactjs/utils": "1.8.0-alpha.0"
"@interactjs/core": "1.8.0-alpha.1",
"@interactjs/utils": "1.8.0-alpha.1"
},

@@ -9,0 +9,0 @@ "publishConfig": {

@@ -35,3 +35,3 @@ /**

edges
} = arg.interaction.prepared;
} = arg;

@@ -46,9 +46,5 @@ if (!edges) {

function set(arg) {
return snapSize.set(arg);
}
const snapEdges = {
start,
set,
set: snapSize.set,
defaults: extend(clone(snapSize.defaults), {

@@ -55,0 +51,0 @@ offset: {

@@ -15,3 +15,2 @@ import * as utils from "../../utils/index.js";

} = state;
const offsets = [];
const origin = options.offsetWithOrigin ? getOrigin(arg) : {

@@ -38,22 +37,14 @@ x: 0,

const relativePoints = options.relativePoints || [];
if (rect && options.relativePoints && options.relativePoints.length) {
for (let index = 0; index < relativePoints.length; index++) {
const relativePoint = relativePoints[index];
offsets.push({
index,
relativePoint,
x: startOffset.left - rect.width * relativePoint.x + snapOffset.x,
y: startOffset.top - rect.height * relativePoint.y + snapOffset.y
});
}
} else {
offsets.push(utils.extend({
index: 0,
relativePoint: null
}, snapOffset));
}
state.offsets = offsets;
const {
relativePoints
} = options;
state.offsets = rect && relativePoints && relativePoints.length ? relativePoints.map((relativePoint, index) => ({
index,
relativePoint,
x: startOffset.left - rect.width * relativePoint.x + snapOffset.x,
y: startOffset.top - rect.height * relativePoint.y + snapOffset.y
})) : [utils.extend({
index: 0,
relativePoint: null
}, snapOffset)];
}

@@ -74,3 +65,2 @@

const targets = [];
let target;

@@ -82,5 +72,2 @@ if (!options.offsetWithOrigin) {

state.realX = page.x;
state.realY = page.y;
for (const offset of offsets) {

@@ -92,2 +79,3 @@ const relativeX = page.x - offset.x;

const snapTarget = options.targets[index];
let target;

@@ -107,3 +95,6 @@ if (utils.is.func(snapTarget)) {

y: (utils.is.number(target.y) ? target.y : relativeY) + offset.y,
range: utils.is.number(target.range) ? target.range : options.range
range: utils.is.number(target.range) ? target.range : options.range,
source: snapTarget,
index,
offset
});

@@ -118,8 +109,9 @@ }

range: 0,
dx: 0,
dy: 0
delta: {
x: 0,
y: 0
}
};
for (let i = 0, len = targets.length; i < len; i++) {
target = targets[i];
for (const target of targets) {
const range = target.range;

@@ -146,5 +138,4 @@ const dx = target.x - page.x;

closest.inRange = inRange;
closest.dx = dx;
closest.dy = dy;
state.range = range;
closest.delta.x = dx;
closest.delta.y = dy;
}

@@ -159,2 +150,3 @@ }

state.closest = closest;
return closest;
}

@@ -161,0 +153,0 @@

@@ -9,4 +9,4 @@ // This module allows snapping of the size of targets during resize

const {
interaction,
state
state,
edges
} = arg;

@@ -16,5 +16,2 @@ const {

} = state;
const {
edges
} = interaction.prepared;

@@ -87,4 +84,5 @@ if (!edges) {

snap.set(arg);
const returnValue = snap.set(arg);
state.options = options;
return returnValue;
}

@@ -91,0 +89,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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