@interactjs/pointer-events
Advanced tools
Comparing version 1.9.18 to 1.9.19
@@ -6,3 +6,3 @@ import { Interaction } from "../core/Interaction.js"; | ||
import getOriginXY from "../utils/getOriginXY.js"; | ||
import { PointerEvent } from './PointerEvent'; | ||
import { PointerEvent } from "./PointerEvent.js"; | ||
const defaults = { | ||
@@ -9,0 +9,0 @@ holdDuration: 600, |
@@ -1,2 +0,2 @@ | ||
import{Interaction as t}from"../core/Interaction.min.js";import{Scope as e}from"../core/scope.min.js";import*as n from"../utils/domUtils.min.js";import o from"../utils/extend.min.js";import r from"../utils/getOriginXY.min.js";import{PointerEvent as i}from"./PointerEvent";const a={id:"pointer-events/base",install(t){t.pointerEvents=a,t.defaults.actions.pointerEvents=a.defaults,o(t.actions.phaselessTypes,a.types)},listeners:{"interactions:new"({interaction:t}){t.prevTap=null,t.tapTime=0},"interactions:update-pointer"({down:t,pointerInfo:e}){!t&&e.hold||(e.hold={duration:1/0,timeout:null})},"interactions:move"({interaction:t,pointer:e,event:n,eventTarget:o,duplicate:r},i){const a=t.getPointerIndex(e);r||t.pointerIsDown&&!t.pointerWasMoved||(t.pointerIsDown&&clearTimeout(t.pointers[a].hold.timeout),p({interaction:t,pointer:e,event:n,eventTarget:o,type:"move"},i))},"interactions:down"(t,e){!function({interaction:t,pointer:e,event:o,eventTarget:r,pointerIndex:i},a){const s=t.pointers[i].hold,l=n.getPath(r),c={interaction:t,pointer:e,event:o,eventTarget:r,type:"hold",targets:[],path:l,node:null};for(const t of l)c.node=t,a.fire("pointerEvents:collect-targets",c);if(!c.targets.length)return;let d=1/0;for(const t of c.targets){const e=t.eventable.options.holdDuration;e<d&&(d=e)}s.duration=d,s.timeout=setTimeout(()=>{p({interaction:t,eventTarget:r,pointer:e,event:o,type:"hold"},a)},d)}(t,e),p(t,e)},"interactions:up"(t,e){l(t),p(t,e),function({interaction:t,pointer:e,event:n,eventTarget:o},r){t.pointerWasMoved||p({interaction:t,eventTarget:o,pointer:e,event:n,type:"tap"},r)}(t,e)},"interactions:cancel"(t,e){l(t),p(t,e)}},PointerEvent:i,fire:p,collectEventTargets:s,defaults:{holdDuration:600,ignoreFrom:null,allowFrom:null,origin:{x:0,y:0}},types:{down:!0,move:!0,up:!0,cancel:!0,tap:!0,doubletap:!0,hold:!0}};function p(t,e){const{interaction:n,pointer:o,event:a,eventTarget:l,type:c,targets:d=s(t,e)}=t,v=new i(c,o,a,l,n,e.now());e.fire("pointerEvents:new",{pointerEvent:v});const u={interaction:n,pointer:o,event:a,eventTarget:l,targets:d,type:c,pointerEvent:v};for(let t=0;t<d.length;t++){const e=d[t];for(const t in e.props||{})v[t]=e.props[t];const n=r(e.eventable,e.node);if(v._subtractOrigin(n),v.eventable=e.eventable,v.currentTarget=e.node,e.eventable.fire(v),v._addOrigin(n),v.immediatePropagationStopped||v.propagationStopped&&t+1<d.length&&d[t+1].node!==v.currentTarget)break}if(e.fire("pointerEvents:fired",u),"tap"===c){const t=v.double?p({interaction:n,pointer:o,event:a,eventTarget:l,type:"doubletap"},e):v;n.prevTap=t,n.tapTime=t.timeStamp}return v}function s({interaction:t,pointer:e,event:o,eventTarget:r,type:i},a){const p=t.getPointerIndex(e),s=t.pointers[p];if("tap"===i&&(t.pointerWasMoved||!s||s.downTarget!==r))return[];const l=n.getPath(r),c={interaction:t,pointer:e,event:o,eventTarget:r,type:i,path:l,targets:[],node:null};for(const t of l)c.node=t,a.fire("pointerEvents:collect-targets",c);return"hold"===i&&(c.targets=c.targets.filter(e=>e.eventable.options.holdDuration===t.pointers[p].hold.duration)),c.targets}function l({interaction:t,pointerIndex:e}){t.pointers[e].hold&&clearTimeout(t.pointers[e].hold.timeout)}export default a; | ||
import{Interaction as t}from"../core/Interaction.min.js";import{Scope as e}from"../core/scope.min.js";import*as n from"../utils/domUtils.min.js";import o from"../utils/extend.min.js";import i from"../utils/getOriginXY.min.js";import{PointerEvent as r}from"./PointerEvent.min.js";const a={id:"pointer-events/base",install(t){t.pointerEvents=a,t.defaults.actions.pointerEvents=a.defaults,o(t.actions.phaselessTypes,a.types)},listeners:{"interactions:new"({interaction:t}){t.prevTap=null,t.tapTime=0},"interactions:update-pointer"({down:t,pointerInfo:e}){!t&&e.hold||(e.hold={duration:1/0,timeout:null})},"interactions:move"({interaction:t,pointer:e,event:n,eventTarget:o,duplicate:i},r){const a=t.getPointerIndex(e);i||t.pointerIsDown&&!t.pointerWasMoved||(t.pointerIsDown&&clearTimeout(t.pointers[a].hold.timeout),p({interaction:t,pointer:e,event:n,eventTarget:o,type:"move"},r))},"interactions:down"(t,e){!function({interaction:t,pointer:e,event:o,eventTarget:i,pointerIndex:r},a){const s=t.pointers[r].hold,l=n.getPath(i),c={interaction:t,pointer:e,event:o,eventTarget:i,type:"hold",targets:[],path:l,node:null};for(const t of l)c.node=t,a.fire("pointerEvents:collect-targets",c);if(!c.targets.length)return;let d=1/0;for(const t of c.targets){const e=t.eventable.options.holdDuration;e<d&&(d=e)}s.duration=d,s.timeout=setTimeout(()=>{p({interaction:t,eventTarget:i,pointer:e,event:o,type:"hold"},a)},d)}(t,e),p(t,e)},"interactions:up"(t,e){l(t),p(t,e),function({interaction:t,pointer:e,event:n,eventTarget:o},i){t.pointerWasMoved||p({interaction:t,eventTarget:o,pointer:e,event:n,type:"tap"},i)}(t,e)},"interactions:cancel"(t,e){l(t),p(t,e)}},PointerEvent:r,fire:p,collectEventTargets:s,defaults:{holdDuration:600,ignoreFrom:null,allowFrom:null,origin:{x:0,y:0}},types:{down:!0,move:!0,up:!0,cancel:!0,tap:!0,doubletap:!0,hold:!0}};function p(t,e){const{interaction:n,pointer:o,event:a,eventTarget:l,type:c,targets:d=s(t,e)}=t,v=new r(c,o,a,l,n,e.now());e.fire("pointerEvents:new",{pointerEvent:v});const u={interaction:n,pointer:o,event:a,eventTarget:l,targets:d,type:c,pointerEvent:v};for(let t=0;t<d.length;t++){const e=d[t];for(const t in e.props||{})v[t]=e.props[t];const n=i(e.eventable,e.node);if(v._subtractOrigin(n),v.eventable=e.eventable,v.currentTarget=e.node,e.eventable.fire(v),v._addOrigin(n),v.immediatePropagationStopped||v.propagationStopped&&t+1<d.length&&d[t+1].node!==v.currentTarget)break}if(e.fire("pointerEvents:fired",u),"tap"===c){const t=v.double?p({interaction:n,pointer:o,event:a,eventTarget:l,type:"doubletap"},e):v;n.prevTap=t,n.tapTime=t.timeStamp}return v}function s({interaction:t,pointer:e,event:o,eventTarget:i,type:r},a){const p=t.getPointerIndex(e),s=t.pointers[p];if("tap"===r&&(t.pointerWasMoved||!s||s.downTarget!==i))return[];const l=n.getPath(i),c={interaction:t,pointer:e,event:o,eventTarget:i,type:r,path:l,targets:[],node:null};for(const t of l)c.node=t,a.fire("pointerEvents:collect-targets",c);return"hold"===r&&(c.targets=c.targets.filter(e=>e.eventable.options.holdDuration===t.pointers[p].hold.duration)),c.targets}function l({interaction:t,pointerIndex:e}){t.pointers[e].hold&&clearTimeout(t.pointers[e].hold.timeout)}export default a; | ||
//# sourceMappingURL=base.min.js.map |
@@ -1,3 +0,3 @@ | ||
import PointerEvent from './PointerEvent'; | ||
import basePlugin from './base'; | ||
import PointerEvent from "./PointerEvent.js"; | ||
import basePlugin from "./base.js"; | ||
@@ -4,0 +4,0 @@ function install(scope) { |
@@ -1,2 +0,2 @@ | ||
import e from"./PointerEvent";import t from"./base";function n({interaction:e}){e.holdIntervalHandle&&(clearInterval(e.holdIntervalHandle),e.holdIntervalHandle=null)}const o={id:"pointer-events/holdRepeat",install(e){e.usePlugin(t);const{pointerEvents:n}=e;n.defaults.holdRepeatInterval=0,n.types.holdrepeat=e.actions.phaselessTypes.holdrepeat=!0},listeners:["move","up","cancel","endall"].reduce((e,t)=>(e["pointerEvents:"+t]=n,e),{"pointerEvents:new"({pointerEvent:e}){"hold"===e.type&&(e.count=(e.count||0)+1)},"pointerEvents:fired"({interaction:e,pointerEvent:t,eventTarget:n,targets:o},l){if("hold"!==t.type||!o.length)return;const r=o[0].eventable.options.holdRepeatInterval;r<=0||(e.holdIntervalHandle=setTimeout(()=>{l.pointerEvents.fire({interaction:e,eventTarget:n,type:"hold",pointer:t,event:t},l)},r))}})};export default o; | ||
import e from"./PointerEvent.min.js";import t from"./base.min.js";function n({interaction:e}){e.holdIntervalHandle&&(clearInterval(e.holdIntervalHandle),e.holdIntervalHandle=null)}const o={id:"pointer-events/holdRepeat",install(e){e.usePlugin(t);const{pointerEvents:n}=e;n.defaults.holdRepeatInterval=0,n.types.holdrepeat=e.actions.phaselessTypes.holdrepeat=!0},listeners:["move","up","cancel","endall"].reduce((e,t)=>(e["pointerEvents:"+t]=n,e),{"pointerEvents:new"({pointerEvent:e}){"hold"===e.type&&(e.count=(e.count||0)+1)},"pointerEvents:fired"({interaction:e,pointerEvent:t,eventTarget:n,targets:o},l){if("hold"!==t.type||!o.length)return;const r=o[0].eventable.options.holdRepeatInterval;r<=0||(e.holdIntervalHandle=setTimeout(()=>{l.pointerEvents.fire({interaction:e,eventTarget:n,type:"hold",pointer:t,event:t},l)},r))}})};export default o; | ||
//# sourceMappingURL=holdRepeat.min.js.map |
{ | ||
"name": "@interactjs/pointer-events", | ||
"version": "1.9.18", | ||
"version": "1.9.19", | ||
"license": "MIT", | ||
"peerDependencies": { | ||
"@interactjs/core": "1.9.18", | ||
"@interactjs/utils": "1.9.18" | ||
"@interactjs/core": "1.9.19", | ||
"@interactjs/utils": "1.9.19" | ||
}, | ||
"optionalDependencies": { | ||
"@interactjs/interact": "1.9.18" | ||
"@interactjs/interact": "1.9.19" | ||
}, | ||
@@ -12,0 +12,0 @@ "publishConfig": { |
@@ -1,4 +0,4 @@ | ||
import * as pointerEvents from './base'; | ||
import holdRepeat from './holdRepeat'; | ||
import interactableTargets from './interactableTargets'; | ||
import * as pointerEvents from "./base.js"; | ||
import holdRepeat from "./holdRepeat.js"; | ||
import interactableTargets from "./interactableTargets.js"; | ||
const plugin = { | ||
@@ -5,0 +5,0 @@ id: 'pointer-events', |
@@ -1,2 +0,2 @@ | ||
import*as e from"./base";import t from"./holdRepeat";import o from"./interactableTargets";const r={id:"pointer-events",install(r){r.usePlugin(e),r.usePlugin(t),r.usePlugin(o)}};export default r;export{e as pointerEvents,t as holdRepeat,o as interactableTargets}; | ||
import*as e from"./base.min.js";import t from"./holdRepeat.min.js";import i from"./interactableTargets.min.js";const s={id:"pointer-events",install(s){s.usePlugin(e),s.usePlugin(t),s.usePlugin(i)}};export default s;export{e as pointerEvents,t as holdRepeat,i as interactableTargets}; | ||
//# sourceMappingURL=plugin.min.js.map |
import * as pointerUtils from "../utils/pointerUtils.js"; | ||
import BaseEvent from '../core/BaseEvent'; | ||
import BaseEvent from "../core/BaseEvent.js"; | ||
export default class PointerEvent extends BaseEvent { | ||
@@ -4,0 +4,0 @@ /** */ |
@@ -1,2 +0,2 @@ | ||
import*as t from"../utils/pointerUtils.min.js";import i from"../core/BaseEvent";export default class e extends i{constructor(i,e,s,n,p,r){if(super(p),this.type=void 0,this.originalEvent=void 0,this.pointerId=void 0,this.pointerType=void 0,this.double=void 0,this.pageX=void 0,this.pageY=void 0,this.clientX=void 0,this.clientY=void 0,this.dt=void 0,this.eventable=void 0,t.pointerExtend(this,s),s!==e&&t.pointerExtend(this,e),this.timeStamp=r,this.originalEvent=s,this.type=i,this.pointerId=t.getPointerId(e),this.pointerType=t.getPointerType(e),this.target=n,this.currentTarget=null,"tap"===i){const t=p.getPointerIndex(e);this.dt=this.timeStamp-p.pointers[t].downTime;const i=this.timeStamp-p.tapTime;this.double=!!(p.prevTap&&"doubletap"!==p.prevTap.type&&p.prevTap.target===this.target&&i<500)}else"doubletap"===i&&(this.dt=e.timeStamp-p.tapTime)}_subtractOrigin({x:t,y:i}){return this.pageX-=t,this.pageY-=i,this.clientX-=t,this.clientY-=i,this}_addOrigin({x:t,y:i}){return this.pageX+=t,this.pageY+=i,this.clientX+=t,this.clientY+=i,this}preventDefault(){this.originalEvent.preventDefault()}}export{e as PointerEvent}; | ||
import*as t from"../utils/pointerUtils.min.js";import i from"../core/BaseEvent.min.js";export default class e extends i{constructor(i,e,s,n,p,r){if(super(p),this.type=void 0,this.originalEvent=void 0,this.pointerId=void 0,this.pointerType=void 0,this.double=void 0,this.pageX=void 0,this.pageY=void 0,this.clientX=void 0,this.clientY=void 0,this.dt=void 0,this.eventable=void 0,t.pointerExtend(this,s),s!==e&&t.pointerExtend(this,e),this.timeStamp=r,this.originalEvent=s,this.type=i,this.pointerId=t.getPointerId(e),this.pointerType=t.getPointerType(e),this.target=n,this.currentTarget=null,"tap"===i){const t=p.getPointerIndex(e);this.dt=this.timeStamp-p.pointers[t].downTime;const i=this.timeStamp-p.tapTime;this.double=!!(p.prevTap&&"doubletap"!==p.prevTap.type&&p.prevTap.target===this.target&&i<500)}else"doubletap"===i&&(this.dt=e.timeStamp-p.tapTime)}_subtractOrigin({x:t,y:i}){return this.pageX-=t,this.pageY-=i,this.clientX-=t,this.clientY-=i,this}_addOrigin({x:t,y:i}){return this.pageX+=t,this.pageY+=i,this.clientX+=t,this.clientY+=i,this}preventDefault(){this.originalEvent.preventDefault()}}export{e as PointerEvent}; | ||
//# sourceMappingURL=PointerEvent.min.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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
82785
491