Skip to content

Commit

Permalink
pointerEvents: add ignoreFrom & allowFrom options
Browse files Browse the repository at this point in the history
Close #397
  • Loading branch information
taye committed Aug 27, 2016
1 parent c26a58a commit 6cbaad6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/pointerEvents/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ Interaction.signals.on('new', function (interaction) {

defaults.pointerEvents = {
holdDuration: 600,
ignoreFrom : null,
allowFrom : null,
};

module.exports = scope.pointerEvents = {
Expand Down
10 changes: 7 additions & 3 deletions src/pointerEvents/interactableTargets.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,20 @@ const scope = require('../scope');
const extend = require('../utils/extend');
const { merge } = require('../utils/arr');

pointerEvents.signals.on('collect-targets', function ({ targets, element, eventType }) {
pointerEvents.signals.on('collect-targets', function ({ targets, element, eventType, eventTarget }) {
function collectSelectors (interactable, selector, context) {
const els = browser.useMatchesSelectorPolyfill
? context.querySelectorAll(selector)
: undefined;

const eventable = interactable.events;
const options = eventable.options;

if (eventable[eventType]
&& isType.isElement(element)
&& interactable.inContext(element)
&& domUtils.matchesSelector(element, selector, els)) {
&& domUtils.matchesSelector(element, selector, els)
&& interactable.testIgnoreAllow(options, element, eventTarget)) {

targets.push({
element,
Expand All @@ -32,8 +34,10 @@ pointerEvents.signals.on('collect-targets', function ({ targets, element, eventT

if (interactable) {
const eventable = interactable.events;
const options = eventable.options;

if (eventable[eventType]) {
if (eventable[eventType]
&& interactable.testIgnoreAllow(options, element, eventTarget)) {
targets.push({
element,
eventable,
Expand Down

0 comments on commit 6cbaad6

Please sign in to comment.