@interactjs/pointer-events
Advanced tools
Comparing version 1.9.20 to 1.9.21
25
base.js
@@ -182,19 +182,22 @@ import { Interaction } from "../core/Interaction.js"; | ||
}) { | ||
if (interaction.pointers[pointerIndex].hold) { | ||
clearTimeout(interaction.pointers[pointerIndex].hold.timeout); | ||
const hold = interaction.pointers[pointerIndex].hold; | ||
if (hold && hold.timeout) { | ||
clearTimeout(hold.timeout); | ||
hold.timeout = null; | ||
} | ||
} | ||
function moveAndClearHold({ | ||
interaction, | ||
pointer, | ||
event, | ||
eventTarget, | ||
duplicate | ||
}, scope) { | ||
const pointerIndex = interaction.getPointerIndex(pointer); | ||
function moveAndClearHold(arg, scope) { | ||
const { | ||
interaction, | ||
pointer, | ||
event, | ||
eventTarget, | ||
duplicate | ||
} = arg; | ||
if (!duplicate && (!interaction.pointerIsDown || interaction.pointerWasMoved)) { | ||
if (interaction.pointerIsDown) { | ||
clearTimeout(interaction.pointers[pointerIndex].hold.timeout); | ||
clearHold(arg); | ||
} | ||
@@ -201,0 +204,0 @@ |
@@ -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 i from"../utils/getOriginXY.min.js";import{PointerEvent as r}from"./PointerEvent.min.js";const a={id:"pointer-events/base",before:["inertia","modifiers","auto-start","actions"],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; | ||
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",before:["inertia","modifiers","auto-start","actions"],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"(t,e){const{interaction:n,pointer:o,event:i,eventTarget:r,duplicate:a}=t;a||n.pointerIsDown&&!n.pointerWasMoved||(n.pointerIsDown&&l(t),p({interaction:n,pointer:o,event:i,eventTarget:r,type:"move"},e))},"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}){const n=t.pointers[e].hold;n&&n.timeout&&(clearTimeout(n.timeout),n.timeout=null)}export default a; | ||
//# sourceMappingURL=base.min.js.map |
{ | ||
"name": "@interactjs/pointer-events", | ||
"version": "1.9.20", | ||
"version": "1.9.21", | ||
"license": "MIT", | ||
"peerDependencies": { | ||
"@interactjs/core": "1.9.20", | ||
"@interactjs/utils": "1.9.20" | ||
"@interactjs/core": "1.9.21", | ||
"@interactjs/utils": "1.9.21" | ||
}, | ||
"optionalDependencies": { | ||
"@interactjs/interact": "1.9.20" | ||
"@interactjs/interact": "1.9.21" | ||
}, | ||
@@ -12,0 +12,0 @@ "publishConfig": { |
@@ -15,3 +15,2 @@ import * as pointerEvents from "./base.js"; | ||
export default plugin; | ||
export { pointerEvents, holdRepeat, interactableTargets }; | ||
//# sourceMappingURL=plugin.js.map |
@@ -1,2 +0,2 @@ | ||
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}; | ||
import*as e from"./base.min.js";import i from"./holdRepeat.min.js";import t from"./interactableTargets.min.js";const s={id:"pointer-events",install(s){s.usePlugin(e),s.usePlugin(i),s.usePlugin(t)}};export default s; | ||
//# sourceMappingURL=plugin.min.js.map |
import * as pointerUtils from "../utils/pointerUtils.js"; | ||
import BaseEvent from "../core/BaseEvent.js"; | ||
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.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}; | ||
import*as t from"../utils/pointerUtils.min.js";import{BaseEvent as 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
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
82427