Socket
Socket
Sign inDemoInstall

@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.10.2 to 1.10.3

6

aspectRatio.js

@@ -62,7 +62,3 @@ /**

extend(arg.edges, linkedEdges);
if (!modifiers || !modifiers.length) {
return;
}
if (!modifiers || !modifiers.length) return;
const subModification = new Modification(arg.interaction);

@@ -69,0 +65,0 @@ subModification.copyFrom(arg.interaction.modification);

15

base.js

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

import { InteractEvent } from "../core/InteractEvent.js";
import Interaction from "../core/Interaction.js";
import Modification from "./Modification.js";

@@ -21,2 +19,3 @@ export function makeModifier(module, name) {

if (!(prop in options)) {
;
options[prop] = defaults[prop];

@@ -52,8 +51,6 @@ }

iEvent,
interaction: {
modification: {
result
}
}
interaction
}) {
const result = interaction.modification.result;
if (result) {

@@ -76,5 +73,3 @@ iEvent.modifiers = result.eventProps;

'interactions:before-action-start': arg => {
const {
modification
} = arg.interaction;
const modification = arg.interaction.modification;
modification.start(arg, arg.interaction.coords.start.page);

@@ -81,0 +76,0 @@ arg.interaction.edges = modification.edges;

@@ -1,2 +0,2 @@

import{InteractEvent as t}from"../core/InteractEvent.prod.js";import o from"../core/Interaction.prod.js";import i from"./Modification.prod.js";export function makeModifier(t,o){const{defaults:i}=t,e={start:t.start,set:t.set,beforeEnd:t.beforeEnd,stop:t.stop},n=t=>{const n=t||{};n.enabled=!1!==n.enabled;for(const t in i)t in n||(n[t]=i[t]);const r={options:n,methods:e,name:o,enable:()=>(n.enabled=!0,r),disable:()=>(n.enabled=!1,r)};return r};return o&&"string"==typeof o&&(n._defaults=i,n._methods=e),n}export function addEventModifiers({iEvent:t,interaction:{modification:{result:o}}}){o&&(t.modifiers=o.eventProps)}const e={id:"modifiers/base",before:["actions"],install(t){t.defaults.perAction.modifiers=[]},listeners:{"interactions:new"({interaction:t}){t.modification=new i(t)},"interactions:before-action-start"(t){const{modification:o}=t.interaction;o.start(t,t.interaction.coords.start.page),t.interaction.edges=o.edges,o.applyToInteraction(t)},"interactions:before-action-move":t=>t.interaction.modification.setAndApply(t),"interactions:before-action-end":t=>t.interaction.modification.beforeEnd(t),"interactions:action-start":addEventModifiers,"interactions:action-move":addEventModifiers,"interactions:action-end":addEventModifiers,"interactions:after-action-start":t=>t.interaction.modification.restoreInteractionCoords(t),"interactions:after-action-move":t=>t.interaction.modification.restoreInteractionCoords(t),"interactions:stop":t=>t.interaction.modification.stop(t)}};export default e;
import t from"./Modification.prod.js";export function makeModifier(t,i){const{defaults:n}=t,o={start:t.start,set:t.set,beforeEnd:t.beforeEnd,stop:t.stop},e=t=>{const e=t||{};e.enabled=!1!==e.enabled;for(const t in n)t in e||(e[t]=n[t]);const a={options:e,methods:o,name:i,enable:()=>(e.enabled=!0,a),disable:()=>(e.enabled=!1,a)};return a};return i&&"string"==typeof i&&(e._defaults=n,e._methods=o),e}export function addEventModifiers({iEvent:t,interaction:i}){const n=i.modification.result;n&&(t.modifiers=n.eventProps)}const i={id:"modifiers/base",before:["actions"],install(t){t.defaults.perAction.modifiers=[]},listeners:{"interactions:new"({interaction:i}){i.modification=new t(i)},"interactions:before-action-start"(t){const i=t.interaction.modification;i.start(t,t.interaction.coords.start.page),t.interaction.edges=i.edges,i.applyToInteraction(t)},"interactions:before-action-move":t=>t.interaction.modification.setAndApply(t),"interactions:before-action-end":t=>t.interaction.modification.beforeEnd(t),"interactions:action-start":addEventModifiers,"interactions:action-move":addEventModifiers,"interactions:action-end":addEventModifiers,"interactions:after-action-start":t=>t.interaction.modification.restoreInteractionCoords(t),"interactions:after-action-move":t=>t.interaction.modification.restoreInteractionCoords(t),"interactions:stop":t=>t.interaction.modification.stop(t)}};export default i;
//# sourceMappingURL=base.prod.js.map

@@ -13,5 +13,5 @@ import clone from "../utils/clone.js";

};
this.startDelta = null;
this.result = null;
this.endResult = null;
this.startDelta = void 0;
this.result = void 0;
this.endResult = void 0;
this.edges = void 0;

@@ -37,7 +37,7 @@ this.interaction = void 0;

};
const arg = {
const arg = this.fillArg({
phase,
pageCoords,
preEnd: false
};
});
this.result = createResult();

@@ -59,7 +59,6 @@ this.startAll(arg);

arg.startOffset = this.startOffset;
return arg;
}
startAll(arg) {
this.fillArg(arg);
for (const state of this.states) {

@@ -74,3 +73,2 @@ if (state.methods.start) {

setAll(arg) {
this.fillArg(arg);
const {

@@ -88,2 +86,4 @@ phase,

for (const state of states) {
var _state$methods;
const {

@@ -95,3 +95,3 @@ options

if (state.methods.set && this.shouldDo(options, preEnd, phase)) {
if ((_state$methods = state.methods) != null && _state$methods.set && this.shouldDo(options, preEnd, phase)) {
arg.state = state;

@@ -172,7 +172,7 @@ returnValue = state.methods.set(arg);

} = arg;
const result = this.setAll({
const result = this.setAll(this.fillArg({
preEnd,
phase,
pageCoords: arg.modifiedCoords || interaction.coords.cur.page
});
}));
this.result = result; // don't fire an action move if a modifier would keep the event in the same

@@ -296,6 +296,3 @@ // cordinates as before

}) {
if (!modification.result) {
return;
}
if (!modification.result) return;
const {

@@ -302,0 +299,0 @@ startDelta

@@ -1,2 +0,2 @@

import t from"../utils/clone.prod.js";import e from"../utils/extend.prod.js";import*as s from"../utils/rect.prod.js";export default class o{constructor(t){this.states=[],this.startOffset={left:0,right:0,top:0,bottom:0},this.startDelta=null,this.result=null,this.endResult=null,this.edges=void 0,this.interaction=void 0,this.interaction=t,this.result=r()}start({phase:t},s){const{interaction:o}=this,i=(t=>{const e=t.interactable.options[t.prepared.name],s=e.modifiers;return s&&s.length?s:["snap","snapSize","snapEdges","restrict","restrictEdges","restrictSize"].map((t=>{const s=e[t];return s&&s.enabled&&{options:s,methods:s._methods}})).filter((t=>!!t))})(o);this.prepareStates(i),this.edges=e({},o.edges),this.startOffset=getRectOffset(o.rect,s),this.startDelta={x:0,y:0};const n={phase:t,pageCoords:s,preEnd:!1};return this.result=r(),this.startAll(n),this.result=this.setAll(n)}fillArg(t){const{interaction:e}=this;t.interaction=e,t.interactable=e.interactable,t.element=e.element,t.rect=t.rect||e.rect,t.edges=this.edges,t.startOffset=this.startOffset}startAll(t){this.fillArg(t);for(const e of this.states)e.methods.start&&(t.state=e,e.methods.start(t))}setAll(t){this.fillArg(t);const{phase:o,preEnd:i,skipModifiers:n,rect:a}=t;t.coords=e({},t.pageCoords),t.rect=e({},a);const l=n?this.states.slice(n):this.states,c=r(t.coords,t.rect);for(const r of l){const{options:n}=r,a=e({},t.coords);let l=null;r.methods.set&&this.shouldDo(n,i,o)&&(t.state=r,l=r.methods.set(t),s.addEdges(this.interaction.edges,t.rect,{x:t.coords.x-a.x,y:t.coords.y-a.y})),c.eventProps.push(l)}c.delta.x=t.coords.x-t.pageCoords.x,c.delta.y=t.coords.y-t.pageCoords.y,c.rectDelta.left=t.rect.left-a.left,c.rectDelta.right=t.rect.right-a.right,c.rectDelta.top=t.rect.top-a.top,c.rectDelta.bottom=t.rect.bottom-a.bottom;const h=this.result.coords,d=this.result.rect;if(h&&d){const t=c.rect.left!==d.left||c.rect.right!==d.right||c.rect.top!==d.top||c.rect.bottom!==d.bottom;c.changed=t||h.x!==c.coords.x||h.y!==c.coords.y}return c}applyToInteraction(t){const{interaction:s}=this,{phase:o}=t,r=s.coords.cur,i=s.coords.start,{result:n,startDelta:a}=this,l=n.delta;"start"===o&&e(this.startDelta,n.delta);for(const[t,e]of[[i,a],[r,l]])t.page.x+=e.x,t.page.y+=e.y,t.client.x+=e.x,t.client.y+=e.y;const{rectDelta:c}=this.result,h=t.rect||s.rect;h.left+=c.left,h.right+=c.right,h.top+=c.top,h.bottom+=c.bottom,h.width=h.right-h.left,h.height=h.bottom-h.top}setAndApply(t){const{interaction:e}=this,{phase:s,preEnd:o,skipModifiers:r}=t,i=this.setAll({preEnd:o,phase:s,pageCoords:t.modifiedCoords||e.coords.cur.page});if(this.result=i,!i.changed&&(!r||r<this.states.length)&&e.interacting())return!1;if(t.modifiedCoords){const{page:s}=e.coords.cur,o={x:t.modifiedCoords.x-s.x,y:t.modifiedCoords.y-s.y};i.coords.x+=o.x,i.coords.y+=o.y,i.delta.x+=o.x,i.delta.y+=o.y}this.applyToInteraction(t)}beforeEnd(t){const{interaction:e,event:s}=t,o=this.states;if(!o||!o.length)return;let r=!1;for(const e of o){t.state=e;const{options:s,methods:o}=e,i=o.beforeEnd&&o.beforeEnd(t);if(i)return this.endResult=i,!1;r=r||!r&&this.shouldDo(s,!0,t.phase,!0)}r&&e.move({event:s,preEnd:!0})}stop(t){const{interaction:s}=t;if(!this.states||!this.states.length)return;const o=e({states:this.states,interactable:s.interactable,element:s.element,rect:null},t);this.fillArg(o);for(const t of this.states)o.state=t,t.methods.stop&&t.methods.stop(o);this.states=null,this.endResult=null}prepareStates(t){this.states=[];for(let e=0;e<t.length;e++){const{options:s,methods:o,name:r}=t[e];this.states.push({options:s,methods:o,index:e,name:r})}return this.states}restoreInteractionCoords({interaction:{coords:t,rect:e,modification:s}}){if(!s.result)return;const{startDelta:o}=s,{delta:r,rectDelta:i}=s.result,n=[[t.start,o],[t.cur,r]];for(const[t,e]of n)t.page.x-=e.x,t.page.y-=e.y,t.client.x-=e.x,t.client.y-=e.y;e.left-=i.left,e.right-=i.right,e.top-=i.top,e.bottom-=i.bottom}shouldDo(t,e,s,o){return!(!t||!1===t.enabled||o&&!t.endOnly||t.endOnly&&!e||"start"===s&&!t.setStart)}copyFrom(s){this.startOffset=s.startOffset,this.startDelta=s.startDelta,this.edges=s.edges,this.states=s.states.map((e=>t(e))),this.result=r(e({},s.result.coords),e({},s.result.rect))}destroy(){for(const t in this)this[t]=null}}function r(t,e){return{rect:e,coords:t,delta:{x:0,y:0},rectDelta:{left:0,right:0,top:0,bottom:0},eventProps:[],changed:!0}}export function getRectOffset(t,e){return t?{left:e.x-t.left,top:e.y-t.top,right:t.right-e.x,bottom:t.bottom-e.y}:{left:0,top:0,right:0,bottom:0}}
import t from"../utils/clone.prod.js";import e from"../utils/extend.prod.js";import*as s from"../utils/rect.prod.js";export default class o{constructor(t){this.states=[],this.startOffset={left:0,right:0,top:0,bottom:0},this.startDelta=void 0,this.result=void 0,this.endResult=void 0,this.edges=void 0,this.interaction=void 0,this.interaction=t,this.result=r()}start({phase:t},s){const{interaction:o}=this,i=(t=>{const e=t.interactable.options[t.prepared.name],s=e.modifiers;return s&&s.length?s:["snap","snapSize","snapEdges","restrict","restrictEdges","restrictSize"].map((t=>{const s=e[t];return s&&s.enabled&&{options:s,methods:s._methods}})).filter((t=>!!t))})(o);this.prepareStates(i),this.edges=e({},o.edges),this.startOffset=getRectOffset(o.rect,s),this.startDelta={x:0,y:0};const n=this.fillArg({phase:t,pageCoords:s,preEnd:!1});return this.result=r(),this.startAll(n),this.result=this.setAll(n)}fillArg(t){const{interaction:e}=this;return t.interaction=e,t.interactable=e.interactable,t.element=e.element,t.rect=t.rect||e.rect,t.edges=this.edges,t.startOffset=this.startOffset,t}startAll(t){for(const e of this.states)e.methods.start&&(t.state=e,e.methods.start(t))}setAll(t){const{phase:o,preEnd:i,skipModifiers:n,rect:a}=t;t.coords=e({},t.pageCoords),t.rect=e({},a);const l=n?this.states.slice(n):this.states,c=r(t.coords,t.rect);for(const r of l){var d;const{options:n}=r,a=e({},t.coords);let l=null;null!=(d=r.methods)&&d.set&&this.shouldDo(n,i,o)&&(t.state=r,l=r.methods.set(t),s.addEdges(this.interaction.edges,t.rect,{x:t.coords.x-a.x,y:t.coords.y-a.y})),c.eventProps.push(l)}c.delta.x=t.coords.x-t.pageCoords.x,c.delta.y=t.coords.y-t.pageCoords.y,c.rectDelta.left=t.rect.left-a.left,c.rectDelta.right=t.rect.right-a.right,c.rectDelta.top=t.rect.top-a.top,c.rectDelta.bottom=t.rect.bottom-a.bottom;const h=this.result.coords,p=this.result.rect;if(h&&p){const t=c.rect.left!==p.left||c.rect.right!==p.right||c.rect.top!==p.top||c.rect.bottom!==p.bottom;c.changed=t||h.x!==c.coords.x||h.y!==c.coords.y}return c}applyToInteraction(t){const{interaction:s}=this,{phase:o}=t,r=s.coords.cur,i=s.coords.start,{result:n,startDelta:a}=this,l=n.delta;"start"===o&&e(this.startDelta,n.delta);for(const[t,e]of[[i,a],[r,l]])t.page.x+=e.x,t.page.y+=e.y,t.client.x+=e.x,t.client.y+=e.y;const{rectDelta:c}=this.result,d=t.rect||s.rect;d.left+=c.left,d.right+=c.right,d.top+=c.top,d.bottom+=c.bottom,d.width=d.right-d.left,d.height=d.bottom-d.top}setAndApply(t){const{interaction:e}=this,{phase:s,preEnd:o,skipModifiers:r}=t,i=this.setAll(this.fillArg({preEnd:o,phase:s,pageCoords:t.modifiedCoords||e.coords.cur.page}));if(this.result=i,!i.changed&&(!r||r<this.states.length)&&e.interacting())return!1;if(t.modifiedCoords){const{page:s}=e.coords.cur,o={x:t.modifiedCoords.x-s.x,y:t.modifiedCoords.y-s.y};i.coords.x+=o.x,i.coords.y+=o.y,i.delta.x+=o.x,i.delta.y+=o.y}this.applyToInteraction(t)}beforeEnd(t){const{interaction:e,event:s}=t,o=this.states;if(!o||!o.length)return;let r=!1;for(const e of o){t.state=e;const{options:s,methods:o}=e,i=o.beforeEnd&&o.beforeEnd(t);if(i)return this.endResult=i,!1;r=r||!r&&this.shouldDo(s,!0,t.phase,!0)}r&&e.move({event:s,preEnd:!0})}stop(t){const{interaction:s}=t;if(!this.states||!this.states.length)return;const o=e({states:this.states,interactable:s.interactable,element:s.element,rect:null},t);this.fillArg(o);for(const t of this.states)o.state=t,t.methods.stop&&t.methods.stop(o);this.states=null,this.endResult=null}prepareStates(t){this.states=[];for(let e=0;e<t.length;e++){const{options:s,methods:o,name:r}=t[e];this.states.push({options:s,methods:o,index:e,name:r})}return this.states}restoreInteractionCoords({interaction:{coords:t,rect:e,modification:s}}){if(!s.result)return;const{startDelta:o}=s,{delta:r,rectDelta:i}=s.result,n=[[t.start,o],[t.cur,r]];for(const[t,e]of n)t.page.x-=e.x,t.page.y-=e.y,t.client.x-=e.x,t.client.y-=e.y;e.left-=i.left,e.right-=i.right,e.top-=i.top,e.bottom-=i.bottom}shouldDo(t,e,s,o){return!(!t||!1===t.enabled||o&&!t.endOnly||t.endOnly&&!e||"start"===s&&!t.setStart)}copyFrom(s){this.startOffset=s.startOffset,this.startDelta=s.startDelta,this.edges=s.edges,this.states=s.states.map((e=>t(e))),this.result=r(e({},s.result.coords),e({},s.result.rect))}destroy(){for(const t in this)this[t]=null}}function r(t,e){return{rect:e,coords:t,delta:{x:0,y:0},rectDelta:{left:0,right:0,top:0,bottom:0},eventProps:[],changed:!0}}export function getRectOffset(t,e){return t?{left:e.x-t.left,top:e.y-t.top,right:t.right-e.x,bottom:t.bottom-e.y}:{left:0,top:0,right:0,bottom:0}}
//# sourceMappingURL=Modification.prod.js.map
{
"name": "@interactjs/modifiers",
"version": "1.10.2",
"version": "1.10.3",
"license": "MIT",
"dependencies": {
"@interactjs/snappers": "1.10.2"
"@interactjs/snappers": "1.10.3"
},
"peerDependencies": {
"@interactjs/core": "1.10.2",
"@interactjs/utils": "1.10.2"
"@interactjs/core": "1.10.3",
"@interactjs/utils": "1.10.3"
},
"optionalDependencies": {
"@interactjs/interact": "1.10.2"
"@interactjs/interact": "1.10.3"
},

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

@@ -63,7 +63,3 @@ import extend from "../../utils/extend.js";

const restriction = getRestrictionRect(options.restriction, interaction, coords);
if (!restriction) {
return;
}
if (!restriction) return;
const rect = rectUtils.xywhToTlbr(restriction);

@@ -70,0 +66,0 @@ coords.x = Math.max(Math.min(rect.right - offset.right, coords.x), rect.left + offset.left);

@@ -49,6 +49,8 @@ import extend from "../../utils/extend.js";

y: startOffset.top - rect.height * relativePoint.y + snapOffset.y
})) : [extend({
})) : [{
index: 0,
relativePoint: null
}, snapOffset)];
relativePoint: null,
x: snapOffset.x,
y: snapOffset.y
}];
}

@@ -127,6 +129,6 @@

if (!closest.target || (inRange // is the closest target in range?
? closest.inRange && range !== Infinity // the pointer is relatively deeper in this target
? distance / range < closest.distance / closest.range // this target has Infinite range and the closest doesn't
: range === Infinity && closest.range !== Infinity || // OR this target is closer that the previous closest
if (!closest.target || (inRange ? // is the closest target in range?
closest.inRange && range !== Infinity ? // the pointer is relatively deeper in this target
distance / range < closest.distance / closest.range : // this target has Infinite range and the closest doesn't
range === Infinity && closest.range !== Infinity || // OR this target is closer that the previous closest
distance < closest.distance : // The other is not in range and the pointer is closer to this target

@@ -133,0 +135,0 @@ !closest.inRange && distance < closest.distance)) {

@@ -1,2 +0,2 @@

import t from"../../utils/extend.prod.js";import e from"../../utils/getOriginXY.prod.js";import n from"../../utils/hypot.prod.js";import r from"../../utils/is.prod.js";import{resolveRectLike as o,rectToXY as s}from"../../utils/rect.prod.js";import{makeModifier as a}from"../base.prod.js";const i={start(n){const{interaction:r,interactable:a,element:i,rect:l,state:g,startOffset:f}=n,{options:c}=g,x=c.offsetWithOrigin?(t=>{const{element:n}=t.interaction;return s(o(t.state.options.origin,null,null,[n]))||e(t.interactable,n,t.interaction.prepared.name)})(n):{x:0,y:0};let d;if("startCoords"===c.offset)d={x:r.coords.start.page.x,y:r.coords.start.page.y};else{const t=o(c.offset,a,i,[r]);d=s(t)||{x:0,y:0},d.x+=x.x,d.y+=x.y}const{relativePoints:p}=c;g.offsets=l&&p&&p.length?p.map(((t,e)=>({index:e,relativePoint:t,x:f.left-l.width*t.x+d.x,y:f.top-l.height*t.y+d.y}))):[t({index:0,relativePoint:null},d)]},set(o){const{interaction:s,coords:a,state:i}=o,{options:l,offsets:g}=i,f=e(s.interactable,s.element,s.prepared.name),c=t({},a),x=[];l.offsetWithOrigin||(c.x-=f.x,c.y-=f.y);for(const t of g){const e=c.x-t.x,n=c.y-t.y;for(let o=0,a=l.targets.length;o<a;o++){const a=l.targets[o];let i;i=r.func(a)?a(e,n,s._proxy,t,o):a,i&&x.push({x:(r.number(i.x)?i.x:e)+t.x,y:(r.number(i.y)?i.y:n)+t.y,range:r.number(i.range)?i.range:l.range,source:a,index:o,offset:t})}}const d={target:null,inRange:!1,distance:0,range:0,delta:{x:0,y:0}};for(const t of x){const e=t.range,r=t.x-c.x,o=t.y-c.y,s=n(r,o);let a=s<=e;e===1/0&&d.inRange&&d.range!==1/0&&(a=!1),d.target&&!(a?d.inRange&&e!==1/0?s/e<d.distance/d.range:e===1/0&&d.range!==1/0||s<d.distance:!d.inRange&&s<d.distance)||(d.target=t,d.distance=s,d.range=e,d.inRange=a,d.delta.x=r,d.delta.y=o)}return d.inRange&&(a.x=d.target.x,a.y=d.target.y),i.closest=d,d},defaults:{range:1/0,targets:null,offset:null,offsetWithOrigin:!0,origin:null,relativePoints:null,endOnly:!1,enabled:!1}};export default a(i,"snap");export{i as snap};
import t from"../../utils/extend.prod.js";import e from"../../utils/getOriginXY.prod.js";import n from"../../utils/hypot.prod.js";import r from"../../utils/is.prod.js";import{resolveRectLike as o,rectToXY as s}from"../../utils/rect.prod.js";import{makeModifier as a}from"../base.prod.js";const i={start(t){const{interaction:n,interactable:r,element:a,rect:i,state:l,startOffset:g}=t,{options:f}=l,c=f.offsetWithOrigin?(t=>{const{element:n}=t.interaction;return s(o(t.state.options.origin,null,null,[n]))||e(t.interactable,n,t.interaction.prepared.name)})(t):{x:0,y:0};let x;if("startCoords"===f.offset)x={x:n.coords.start.page.x,y:n.coords.start.page.y};else{const t=o(f.offset,r,a,[n]);x=s(t)||{x:0,y:0},x.x+=c.x,x.y+=c.y}const{relativePoints:d}=f;l.offsets=i&&d&&d.length?d.map(((t,e)=>({index:e,relativePoint:t,x:g.left-i.width*t.x+x.x,y:g.top-i.height*t.y+x.y}))):[{index:0,relativePoint:null,x:x.x,y:x.y}]},set(o){const{interaction:s,coords:a,state:i}=o,{options:l,offsets:g}=i,f=e(s.interactable,s.element,s.prepared.name),c=t({},a),x=[];l.offsetWithOrigin||(c.x-=f.x,c.y-=f.y);for(const t of g){const e=c.x-t.x,n=c.y-t.y;for(let o=0,a=l.targets.length;o<a;o++){const a=l.targets[o];let i;i=r.func(a)?a(e,n,s._proxy,t,o):a,i&&x.push({x:(r.number(i.x)?i.x:e)+t.x,y:(r.number(i.y)?i.y:n)+t.y,range:r.number(i.range)?i.range:l.range,source:a,index:o,offset:t})}}const d={target:null,inRange:!1,distance:0,range:0,delta:{x:0,y:0}};for(const t of x){const e=t.range,r=t.x-c.x,o=t.y-c.y,s=n(r,o);let a=s<=e;e===1/0&&d.inRange&&d.range!==1/0&&(a=!1),d.target&&!(a?d.inRange&&e!==1/0?s/e<d.distance/d.range:e===1/0&&d.range!==1/0||s<d.distance:!d.inRange&&s<d.distance)||(d.target=t,d.distance=s,d.range=e,d.inRange=a,d.delta.x=r,d.delta.y=o)}return d.inRange&&(a.x=d.target.x,a.y=d.target.y),i.closest=d,d},defaults:{range:1/0,targets:null,offset:null,offsetWithOrigin:!0,origin:null,relativePoints:null,endOnly:!1,enabled:!1}};export default a(i,"snap");export{i as snap};
//# sourceMappingURL=pointer.prod.js.map

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

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

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

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