diff --git a/packages/core/Interaction.js b/packages/core/Interaction.js index 0035627da..5963f83fb 100644 --- a/packages/core/Interaction.js +++ b/packages/core/Interaction.js @@ -331,20 +331,20 @@ class Interaction { this.pointerWasMoved = false; } - - this._signals.fire('update-pointer-down', { - pointer, - event, - eventTarget, - down, - pointerInfo, - pointerIndex, - interaction: this, - }); } this._updateLatestPointer(pointer, event, eventTarget); + this._signals.fire('update-pointer', { + pointer, + event, + eventTarget, + down, + pointerInfo, + pointerIndex, + interaction: this, + }); + return pointerIndex; } diff --git a/packages/pointerEvents/base.js b/packages/pointerEvents/base.js index 35f2ed12e..08dfc5a90 100644 --- a/packages/pointerEvents/base.js +++ b/packages/pointerEvents/base.js @@ -141,7 +141,11 @@ function init (scope) { interaction.holdTimers = []; // [{ duration, timeout }] }); - interactions.signals.on('update-pointer-down', function ({ interaction, pointerIndex }) { + interactions.signals.on('update-pointer', function ({ interaction, down, pointerIndex }) { + if (!down) { + return; + } + interaction.holdTimers[pointerIndex] = { duration: Infinity, timeout: null }; }); diff --git a/packages/pointerEvents/tests/base.js b/packages/pointerEvents/tests/base.js index bb74bd04c..5dbc5a14b 100644 --- a/packages/pointerEvents/tests/base.js +++ b/packages/pointerEvents/tests/base.js @@ -117,7 +117,7 @@ test('pointerEvents.collectEventTargets', t => { t.end(); }); -test('pointerEvents Interaction update-pointer-down signal', t => { +test('pointerEvents Interaction update-pointer signal', t => { const scope = helpers.mockScope(); interactions.init(scope); @@ -127,6 +127,9 @@ test('pointerEvents Interaction update-pointer-down signal', t => { const initialTimer = { duration: Infinity, timeout: null }; const event = {}; + interaction.updatePointer(helpers.newPointer(0), event, null, false); + t.deepEqual(interaction.holdTimers, []); + interaction.updatePointer(helpers.newPointer(0), event, null, true); t.deepEqual(interaction.holdTimers, [initialTimer]);