corrade-nucleus-nucleons
/base/000_base/node_modules/interactjs/CHANGELOG.md |
---|
@@ -0,0 +1,319 @@ |
## 1.2.9 |
Fix a bug involving 'mouseover' targeting the document. See [issue #525](https://github.com/taye/interact.js/issues/525) |
## 1.2.8 |
Avoid native PointerEvents on Chrome |
## 1.2.7 |
The bower and npm package names have been changed to `interactjs`. See [issue #399](https://github.com/taye/interact.js/issues/399) |
## 1.2.6 |
### resize.preserveAspectRatio |
```javascript |
interact(target).resizable({ preserveAspectRatio: true }); |
``` |
See [PR #260](https://github.com/taye/interact.js/pull/260). |
### Deprecated |
- `interact.margin(number)` - Use `interact(target).resizable({ margin: number });` instead |
### Fixed |
- incorrect coordinates of the first movement of every action ([5e5a040](https://github.com/taye/interact.js/commit/5e5a040)) |
- warning about deprecated "webkitForce" event property ([0943290](https://github.com/taye/interact.js/commit/0943290)) |
- bugs with multiple concurrent interactions ([ed53aee](http://github.com/taye/interact.js/commit/ed53aee)) |
- iPad 1, iOS 5.1.1 error "undefined is not a function" when autoScroll is set |
to true ([PR #194](https://github.com/taye/interact.js/pull/194)) |
Full list of [changes on Github](https://github.com/taye/interact.js/compare/v1.2.5...master) |
## 1.2.5 |
### Changed parameters to actionChecker and drop.checker |
- Added `event` as the first argument to actionCheckers. See commit [88dc583](https://github.com/taye/interact.js/commit/88dc583) |
- Added `dragEvent` as the first parameter to drop.checker functions. See |
commits [16d74d4](https://github.com/taye/interact.js/commit/16d74d4) and [d0c4b69](https://github.com/taye/interact.js/commit/d0c4b69) |
### Deprecated methods |
interactable.accept - instead, use: |
```javascript |
interact(target).dropzone({ accept: stringOrElement }) |
``` |
interactable.dropChecker - instead, use: |
```javascript |
interact(target).dropzone({ checker: function () {} }) |
``` |
### Added resize.margin |
See https://github.com/taye/interact.js/issues/166#issuecomment-91234390 |
### Fixes |
- touch coords on Presto Opera Mobile - see commits [886e54c](https://github.com/taye/interact.js/commit/886e54c) and [5a3a850](https://github.com/taye/interact.js/commit/5a3a850) |
- bug with multiple pointers - see commit [64882d3](https://github.com/taye/interact.js/commit/64882d3) |
- accessing certain recently deprecated event properties in Blink - see |
commits [e91fbc6](https://github.com/taye/interact.js/commit/e91fbc6) and [195cfe9](https://github.com/taye/interact.js/commit/195cfe9) |
- dropzones with `accept: 'pointer'` in scrolled pages on iOS6 and lower - see |
commit [0b94aac](https://github.com/taye/interact.js/commit/0b94aac) |
- setting styleCursor through Interactable options object - see [PR |
#270](https://github.com/taye/interact.js/pull/270) |
- one missed interaction element on stop triggered - see [PR |
#258](https://github.com/taye/interact.js/pull/258) |
- pointer dt on touchscreen devices - see [PR |
#215](https://github.com/taye/interact.js/pull/215) |
- autoScroll with containers with fixed position - see commit [3635840](https://github.com/taye/interact.js/commit/3635840) |
- autoScroll for mobile - see #180 |
- preventDefault - see commits [1984c80](https://github.com/taye/interact.js/commit/1984c80) and [6913959](https://github.com/taye/interact.js/commit/6913959) |
- occasional error - see [issue |
#183](https://github.com/taye/interact.js/issue/183) |
- Interactable#unset - see [PR |
#178](https://github.com/taye/interact.js/pull/178) |
- coords of start event after manual start - see commit [fec73b2](https://github.com/taye/interact.js/commit/fec73b2) |
- bug with touch and selector interactables - see commit [d8df3de](https://github.com/taye/interact.js/commit/d8df3de) |
- touch doubletap bug - see [273f461](https://github.com/taye/interact.js/commit/273f461) |
- event x0/y0 with origin - see [PR |
#167](https://github.com/taye/interact.js/pull/167) |
## 1.2.4 |
### Resizing from all edges |
With the new [resize edges API](https://github.com/taye/interact.js/pull/145), |
you can resize from the top and left edges of an element in addition to the |
bottom and right. It also allows you to specify CSS selectors, regions or |
elements as the resize handles. |
### Better `dropChecker` arguments |
The arguments to `dropChecker` functions have been expanded to include the |
value of the default drop check and some other useful objects. See [PR |
161](https://github.com/taye/interact.js/pull/161) |
### Improved `preventDefault('auto')` |
If manuanStart is `true`, default prevention will happen only while |
interacting. Related to [Issue |
138](https://github.com/taye/interact.js/issues/138). |
### Fixed inaccurate snapping |
This removes a small inaccuracy when snapping with one or more |
`relativeOffsets`. |
### Fixed bugs with multiple pointers |
## 1.2.3 |
### ShadowDOM |
Basic support for ShadowDOM was implemented in [PR |
143](https://github.com/taye/interact.js/pull/143) |
### Fixed some issues with events |
Fixed Interactable#on({ type: listener }). b8a5e89 |
Added a `double` property to tap events. `tap.double === true` if the tap will |
be followed by a `doubletap` event. See [issue |
155](https://github.com/taye/interact.js/issues/155#issuecomment-71202352). |
Fixed [issue 150](https://github.com/taye/interact.js/issues/150). |
## 1.2.2 |
### Fixed DOM event removal |
See [issue 149](https://github.com/taye/interact.js/issues/149). |
## 1.2.1 |
### Fixed Gestures |
Gestures were completely [broken in |
v1.2.0](https://github.com/taye/interact.js/issues/146). They're fixed now. |
### Restriction |
Fixed restriction to an element when the element doesn't have a rect (`display: |
none`, not in DOM, etc.). [Issue |
144](https://github.com/taye/interact.js/issues/144). |
## 1.2.0 |
### Multiple interactions |
Multiple interactions have been enabled by default. For example: |
```javascript |
interact('.drag-element').draggable({ |
enabled: true, |
// max : Infinity, // default |
// maxPerElement: 1, // default |
}); |
``` |
will allow multiple `.drag-element` to be dragged simultaneously without having |
to explicitly set <code>max: integerGreaterThan1</code>. The default |
`maxPerElement` value is still 1 so only one drag would be able to happen on |
each `.drag-element` unless the `maxPerElement` is changed. |
If you don't want multiple interactions, call `interact.maxInteractions(1)`. |
### Snapping |
#### Unified snap modes |
Snap modes have been |
[unified](https://github.com/taye/interact.js/pull/127). A `targets` array |
now holds all the snap objects and functions for snapping. |
`interact.createSnapGrid(gridObject)` returns a function that snaps to the |
dimensions of the given grid. |
#### `relativePoints` and `origin` |
```javascript |
interact(target).draggable({ |
snap: { |
targets: [ {x: 300, y: 300} ], |
relativePoints: [ |
{ x: 0, y: 0 }, // snap relative to the top left of the element |
{ x: 1, y: 1 }, // and also to the bottom right |
], |
// offset the snap target coordinates |
// can be an object with x/y or 'startCoords' |
offset: { x: 50, y: 50 } |
} |
}); |
``` |
#### snap function interaction arg |
The current `Interaction` is now passed as the third parameter to snap functions. |
```javascript |
interact(target).draggable({ |
snap: { |
targets: [ function (x, y, interaction) { |
if (!interaction.dropTarget) { |
return { x: 0, y: 0 }; |
} |
} ] |
}); |
``` |
#### snap.relativePoints and offset |
The `snap.relativePoints` array succeeds the snap.elementOriign object. But |
backwards compatibility with `elementOrigin` and the old snapping interface is |
maintained. |
`snap.offset` lets you offset all snap target coords. |
See [this PR](https://github.com/taye/interact.js/pull/133) for more info. |
#### slight change to snap range calculation |
Snapping now occurs if the distance to the snap target is [less than or |
equal](https://github.com/taye/interact.js/commit/430c28c) to the target's |
range. |
### Inertia |
`inertia.zeroResumeDelta` is now `true` by default. |
### Per-action settings |
Snap, restrict, inertia, autoScroll can be different for drag, restrict and |
gesture. See [PR 115](https://github.com/taye/interact.js/pull/115). |
Methods for these settings on the `interact` object (`interact.snap()`, |
`interact.autoScroll()`, etc.) have been removed. |
### Space-separated string and array event list and eventType:listener object |
```javascript |
function logEventType (event) { |
console.log(event.type, event.target); |
} |
interact(target).on('down tap dragstart gestureend', logEventType); |
interact(target).on(['move', 'resizestart'], logEventType); |
interact(target).on({ |
dragmove: logEvent, |
keydown : logEvent |
}); |
``` |
### Interactable actionChecker |
The expected return value from an action checker has changed from a string to |
an object. The object should have a `name` and can also have an `axis` |
property. For example, to resize horizontally: |
```javascript |
interact(target).resizeable(true) |
.actionChecker(function (pointer, defaultAction, interactable, element) { |
return { |
name: 'resize', |
axis: 'x', |
}; |
}); |
``` |
### Plain drop event objects |
All drop-related events are [now plain |
objects](https://github.com/taye/interact.js/issues/122). The related drag |
events are referenced in their `dragEvent` property. |
### Interactable.preventDefault('always' || 'never' || 'auto') |
The method takes one of the above string values. It will still accept |
`true`/`false` parameters which are changed to `'always'`/`'never'`. |
## 1.1.3 |
### Better Events |
Adding a function as a listener for an InteractEvent or pointerEvent type |
multiple times will cause that function to be fired multiple times for the |
event. Previously, adding the event type + function combination again had no |
effect. |
Added new event types [down, move, up, cancel, |
hold](https://github.com/taye/interact.js/pull/101). |
Tap and doubletap with multiple pointers was improved. |
Added a workaround for IE8's unusual [dblclick event |
sequence](http://www.quirksmode.org/dom/events/click.html) so that doubletap |
events are fired. |
Fixed a [tapping issue](https://github.com/taye/interact.js/issues/104) on |
Windows Phone/RT. |
Fixed a bug that caused the origins of all elements with tap listeners to be |
subtracted successively as a tap event propagated. |
[Fixed delegated events](https://github.com/taye/interact.js/commit/e972154) |
when different contexts have been used. |
### iFrames |
[Added basic support](https://github.com/taye/interact.js/pull/98) for sharing |
one instance of interact.js between multiplie windows/frames. There are still |
some issues. |
/base/000_base/node_modules/interactjs/LICENSE |
---|
@@ -0,0 +1,23 @@ |
Copyright (c) 2012-2015 Taye Adeyemi <dev@taye.me> |
Permission is hereby granted, free of charge, to any person |
obtaining a copy of this software and associated |
documentation files (the "Software"), to deal in the Software |
without restriction, including without limitation the rights |
to use, copy, modify, merge, publish, distribute, sublicense, |
and/or sell copies of the Software, and to permit persons to |
whom the Software is furnished to do so, subject to the |
following conditions: |
The above copyright notice and this permission notice shall |
be included in all copies or substantial portions of the |
Software. |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY |
KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE |
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR |
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR |
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
/base/000_base/node_modules/interactjs/README.md |
---|
@@ -0,0 +1,92 @@ |
<a href="http://interactjs.io"><img alt="interact.js" src="https://c4d6f7d727e094887e93-4ea74b676357550bd514a6a5b344c625.ssl.cf2.rackcdn.com/ijs-anim.svg" height="131px" width="100%"></a> |
JavaScript drag and drop, resizing and multi-touch gestures with inertia and |
snapping for modern browsers (and also IE8+). |
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/taye/interact.js) |
Features include: |
- **inertia** and **snapping** |
- **multiple interactions** |
- cross browser and device, supporting the **desktop and mobile** versions of |
Chrome, Firefox and Opera as well as **Internet Explorer 8+** |
- interaction with [**SVG**](http://interactjs.io/repo/demo/star.svg) elements |
- being **lightweight and standalone** (not _yet another_ jQuery plugin) |
- **not modifying the DOM** except to support IE8 and to change the cursor |
(but you can disable that) |
Installation |
------------ |
* [Bower](http://bower.io/): `bower install interactjs` |
* [npm](https://www.npmjs.org/): `npm install interactjs` |
* Direct download the latest version: http://interactjs.io/#download |
* [jsDelivr CDN](http://www.jsdelivr.com/#!interact.js): `<script src="//cdn.jsdelivr.net/interact.js/1.2.6/interact.min.js"></script>` |
* [cdnjs CDN](https://cdnjs.com/libraries/interact.js): `<script src="//cdnjs.cloudflare.com/ajax/libs/interact.js/1.2.6/interact.min.js"></script>` |
(replace `VERSION` with the SemVer you want to use) |
Documentation |
------------- |
Visit http://interactjs.io/docs for the API documentation. |
Example |
------- |
```javascript |
var pixelSize = 16; |
interact('.rainbow-pixel-canvas') |
.origin('self') |
.draggable({ |
snap: { |
targets: [ interact.createSnapGrid({ |
x: pixelSize, y: pixelSize |
}) ] |
}, |
// allow multiple drags on the same element |
maxPerElement: Infinity |
}) |
// draw colored squares on move |
.on('dragmove', function (event) { |
var context = event.target.getContext('2d'), |
// calculate the angle of the drag direction |
dragAngle = 180 * Math.atan2(event.dx, event.dy) / Math.PI; |
// set color based on drag angle and speed |
context.fillStyle = 'hsl(' + dragAngle + ', 86%, ' |
+ (30 + Math.min(event.speed / 1000, 1) * 50) + '%)'; |
// draw squares |
context.fillRect(event.pageX - pixelSize / 2, event.pageY - pixelSize / 2, |
pixelSize, pixelSize); |
}) |
// clear the canvas on doubletap |
.on('doubletap', function (event) { |
var context = event.target.getContext('2d'); |
context.clearRect(0, 0, context.canvas.width, context.canvas.height); |
}); |
function resizeCanvases () { |
[].forEach.call(document.querySelectorAll('.rainbow-pixel-canvas'), function (canvas) { |
canvas.width = document.body.clientWidth; |
canvas.height = window.innerHeight * 0.7; |
}); |
} |
// interact.js can also add DOM event listeners |
interact(document).on('DOMContentLoaded', resizeCanvases); |
interact(window).on('resize', resizeCanvases); |
``` |
See the above code in action at http://codepen.io/taye/pen/YPyLxE |
License |
------- |
interact.js is released under the [MIT License](http://taye.mit-license.org). |
[ijs-twitter]: https://twitter.com/interactjs |
[upcoming-changes]: https://github.com/taye/interact.js/blob/master/CHANGELOG.md#upcoming-changes |
/base/000_base/node_modules/interactjs/dist/interact.js |
---|
@@ -0,0 +1,5978 @@ |
/** |
* interact.js v1.2.9 |
* |
* Copyright (c) 2012-2015 Taye Adeyemi <dev@taye.me> |
* Open source under the MIT License. |
* https://raw.github.com/taye/interact.js/master/LICENSE |
*/ |
(function (realWindow) { |
'use strict'; |
// return early if there's no window to work with (eg. Node.js) |
if (!realWindow) { return; } |
var // get wrapped window if using Shadow DOM polyfill |
window = (function () { |
// create a TextNode |
var el = realWindow.document.createTextNode(''); |
// check if it's wrapped by a polyfill |
if (el.ownerDocument !== realWindow.document |
&& typeof realWindow.wrap === 'function' |
&& realWindow.wrap(el) === el) { |
// return wrapped window |
return realWindow.wrap(realWindow); |
} |
// no Shadow DOM polyfil or native implementation |
return realWindow; |
}()), |
document = window.document, |
DocumentFragment = window.DocumentFragment || blank, |
SVGElement = window.SVGElement || blank, |
SVGSVGElement = window.SVGSVGElement || blank, |
SVGElementInstance = window.SVGElementInstance || blank, |
HTMLElement = window.HTMLElement || window.Element, |
PointerEvent = (window.PointerEvent || window.MSPointerEvent), |
pEventTypes, |
hypot = Math.hypot || function (x, y) { return Math.sqrt(x * x + y * y); }, |
tmpXY = {}, // reduce object creation in getXY() |
documents = [], // all documents being listened to |
interactables = [], // all set interactables |
interactions = [], // all interactions |
dynamicDrop = false, |
// { |
// type: { |
// selectors: ['selector', ...], |
// contexts : [document, ...], |
// listeners: [[listener, useCapture], ...] |
// } |
// } |
delegatedEvents = {}, |
defaultOptions = { |
base: { |
accept : null, |
actionChecker : null, |
styleCursor : true, |
preventDefault: 'auto', |
origin : { x: 0, y: 0 }, |
deltaSource : 'page', |
allowFrom : null, |
ignoreFrom : null, |
_context : document, |
dropChecker : null |
}, |
drag: { |
enabled: false, |
manualStart: true, |
max: Infinity, |
maxPerElement: 1, |
snap: null, |
restrict: null, |
inertia: null, |
autoScroll: null, |
axis: 'xy' |
}, |
drop: { |
enabled: false, |
accept: null, |
overlap: 'pointer' |
}, |
resize: { |
enabled: false, |
manualStart: false, |
max: Infinity, |
maxPerElement: 1, |
snap: null, |
restrict: null, |
inertia: null, |
autoScroll: null, |
square: false, |
preserveAspectRatio: false, |
axis: 'xy', |
// use default margin |
margin: NaN, |
// object with props left, right, top, bottom which are |
// true/false values to resize when the pointer is over that edge, |
// CSS selectors to match the handles for each direction |
// or the Elements for each handle |
edges: null, |
// a value of 'none' will limit the resize rect to a minimum of 0x0 |
// 'negate' will alow the rect to have negative width/height |
// 'reposition' will keep the width/height positive by swapping |
// the top and bottom edges and/or swapping the left and right edges |
invert: 'none' |
}, |
gesture: { |
manualStart: false, |
enabled: false, |
max: Infinity, |
maxPerElement: 1, |
restrict: null |
}, |
perAction: { |
manualStart: false, |
max: Infinity, |
maxPerElement: 1, |
snap: { |
enabled : false, |
endOnly : false, |
range : Infinity, |
targets : null, |
offsets : null, |
relativePoints: null |
}, |
restrict: { |
enabled: false, |
endOnly: false |
}, |
autoScroll: { |
enabled : false, |
container : null, // the item that is scrolled (Window or HTMLElement) |
margin : 60, |
speed : 300 // the scroll speed in pixels per second |
}, |
inertia: { |
enabled : false, |
resistance : 10, // the lambda in exponential decay |
minSpeed : 100, // target speed must be above this for inertia to start |
endSpeed : 10, // the speed at which inertia is slow enough to stop |
allowResume : true, // allow resuming an action in inertia phase |
zeroResumeDelta : true, // if an action is resumed after launch, set dx/dy to 0 |
smoothEndDuration: 300 // animate to snap/restrict endOnly if there's no inertia |
} |
}, |
_holdDuration: 600 |
}, |
// Things related to autoScroll |
autoScroll = { |
interaction: null, |
i: null, // the handle returned by window.setInterval |
x: 0, y: 0, // Direction each pulse is to scroll in |
// scroll the window by the values in scroll.x/y |
scroll: function () { |
var options = autoScroll.interaction.target.options[autoScroll.interaction.prepared.name].autoScroll, |
container = options.container || getWindow(autoScroll.interaction.element), |
now = new Date().getTime(), |
// change in time in seconds |
dtx = (now - autoScroll.prevTimeX) / 1000, |
dty = (now - autoScroll.prevTimeY) / 1000, |
vx, vy, sx, sy; |
// displacement |
if (options.velocity) { |
vx = options.velocity.x; |
vy = options.velocity.y; |
} |
else { |
vx = vy = options.speed |
} |
sx = vx * dtx; |
sy = vy * dty; |
if (sx >= 1 || sy >= 1) { |
if (isWindow(container)) { |
container.scrollBy(autoScroll.x * sx, autoScroll.y * sy); |
} |
else if (container) { |
container.scrollLeft += autoScroll.x * sx; |
container.scrollTop += autoScroll.y * sy; |
} |
if (sx >=1) autoScroll.prevTimeX = now; |
if (sy >= 1) autoScroll.prevTimeY = now; |
} |
if (autoScroll.isScrolling) { |
cancelFrame(autoScroll.i); |
autoScroll.i = reqFrame(autoScroll.scroll); |
} |
}, |
isScrolling: false, |
prevTimeX: 0, |
prevTimeY: 0, |
start: function (interaction) { |
autoScroll.isScrolling = true; |
cancelFrame(autoScroll.i); |
autoScroll.interaction = interaction; |
autoScroll.prevTimeX = new Date().getTime(); |
autoScroll.prevTimeY = new Date().getTime(); |
autoScroll.i = reqFrame(autoScroll.scroll); |
}, |
stop: function () { |
autoScroll.isScrolling = false; |
cancelFrame(autoScroll.i); |
} |
}, |
// Does the browser support touch input? |
supportsTouch = (('ontouchstart' in window) || window.DocumentTouch && document instanceof window.DocumentTouch), |
// Does the browser support PointerEvents |
// Avoid PointerEvent bugs introduced in Chrome 55 |
supportsPointerEvent = PointerEvent && !/Chrome/.test(navigator.userAgent), |
// Less Precision with touch input |
margin = supportsTouch || supportsPointerEvent? 20: 10, |
pointerMoveTolerance = 1, |
// for ignoring browser's simulated mouse events |
prevTouchTime = 0, |
// Allow this many interactions to happen simultaneously |
maxInteractions = Infinity, |
// Check if is IE9 or older |
actionCursors = (document.all && !window.atob) ? { |
drag : 'move', |
resizex : 'e-resize', |
resizey : 's-resize', |
resizexy: 'se-resize', |
resizetop : 'n-resize', |
resizeleft : 'w-resize', |
resizebottom : 's-resize', |
resizeright : 'e-resize', |
resizetopleft : 'se-resize', |
resizebottomright: 'se-resize', |
resizetopright : 'ne-resize', |
resizebottomleft : 'ne-resize', |
gesture : '' |
} : { |
drag : 'move', |
resizex : 'ew-resize', |
resizey : 'ns-resize', |
resizexy: 'nwse-resize', |
resizetop : 'ns-resize', |
resizeleft : 'ew-resize', |
resizebottom : 'ns-resize', |
resizeright : 'ew-resize', |
resizetopleft : 'nwse-resize', |
resizebottomright: 'nwse-resize', |
resizetopright : 'nesw-resize', |
resizebottomleft : 'nesw-resize', |
gesture : '' |
}, |
actionIsEnabled = { |
drag : true, |
resize : true, |
gesture: true |
}, |
// because Webkit and Opera still use 'mousewheel' event type |
wheelEvent = 'onmousewheel' in document? 'mousewheel': 'wheel', |
eventTypes = [ |
'dragstart', |
'dragmove', |
'draginertiastart', |
'dragend', |
'dragenter', |
'dragleave', |
'dropactivate', |
'dropdeactivate', |
'dropmove', |
'drop', |
'resizestart', |
'resizemove', |
'resizeinertiastart', |
'resizeend', |
'gesturestart', |
'gesturemove', |
'gestureinertiastart', |
'gestureend', |
'down', |
'move', |
'up', |
'cancel', |
'tap', |
'doubletap', |
'hold' |
], |
globalEvents = {}, |
// Opera Mobile must be handled differently |
isOperaMobile = navigator.appName == 'Opera' && |
supportsTouch && |
navigator.userAgent.match('Presto'), |
// scrolling doesn't change the result of getClientRects on iOS 7 |
isIOS7 = (/iP(hone|od|ad)/.test(navigator.platform) |
&& /OS 7[^\d]/.test(navigator.appVersion)), |
// prefix matchesSelector |
prefixedMatchesSelector = 'matches' in Element.prototype? |
'matches': 'webkitMatchesSelector' in Element.prototype? |
'webkitMatchesSelector': 'mozMatchesSelector' in Element.prototype? |
'mozMatchesSelector': 'oMatchesSelector' in Element.prototype? |
'oMatchesSelector': 'msMatchesSelector', |
// will be polyfill function if browser is IE8 |
ie8MatchesSelector, |
// native requestAnimationFrame or polyfill |
reqFrame = realWindow.requestAnimationFrame, |
cancelFrame = realWindow.cancelAnimationFrame, |
// Events wrapper |
events = (function () { |
var useAttachEvent = ('attachEvent' in window) && !('addEventListener' in window), |
addEvent = useAttachEvent? 'attachEvent': 'addEventListener', |
removeEvent = useAttachEvent? 'detachEvent': 'removeEventListener', |
on = useAttachEvent? 'on': '', |
elements = [], |
targets = [], |
attachedListeners = []; |
function add (element, type, listener, useCapture) { |
var elementIndex = indexOf(elements, element), |
target = targets[elementIndex]; |
if (!target) { |
target = { |
events: {}, |
typeCount: 0 |
}; |
elementIndex = elements.push(element) - 1; |
targets.push(target); |
attachedListeners.push((useAttachEvent ? { |
supplied: [], |
wrapped : [], |
useCount: [] |
} : null)); |
} |
if (!target.events[type]) { |
target.events[type] = []; |
target.typeCount++; |
} |
if (!contains(target.events[type], listener)) { |
var ret; |
if (useAttachEvent) { |
var listeners = attachedListeners[elementIndex], |
listenerIndex = indexOf(listeners.supplied, listener); |
var wrapped = listeners.wrapped[listenerIndex] || function (event) { |
if (!event.immediatePropagationStopped) { |
event.target = event.srcElement; |
event.currentTarget = element; |
event.preventDefault = event.preventDefault || preventDef; |
event.stopPropagation = event.stopPropagation || stopProp; |
event.stopImmediatePropagation = event.stopImmediatePropagation || stopImmProp; |
if (/mouse|click/.test(event.type)) { |
event.pageX = event.clientX + getWindow(element).document.documentElement.scrollLeft; |
event.pageY = event.clientY + getWindow(element).document.documentElement.scrollTop; |
} |
listener(event); |
} |
}; |
ret = element[addEvent](on + type, wrapped, Boolean(useCapture)); |
if (listenerIndex === -1) { |
listeners.supplied.push(listener); |
listeners.wrapped.push(wrapped); |
listeners.useCount.push(1); |
} |
else { |
listeners.useCount[listenerIndex]++; |
} |
} |
else { |
ret = element[addEvent](type, listener, useCapture || false); |
} |
target.events[type].push(listener); |
return ret; |
} |
} |
function remove (element, type, listener, useCapture) { |
var i, |
elementIndex = indexOf(elements, element), |
target = targets[elementIndex], |
listeners, |
listenerIndex, |
wrapped = listener; |
if (!target || !target.events) { |
return; |
} |
if (useAttachEvent) { |
listeners = attachedListeners[elementIndex]; |
listenerIndex = indexOf(listeners.supplied, listener); |
wrapped = listeners.wrapped[listenerIndex]; |
} |
if (type === 'all') { |
for (type in target.events) { |
if (target.events.hasOwnProperty(type)) { |
remove(element, type, 'all'); |
} |
} |
return; |
} |
if (target.events[type]) { |
var len = target.events[type].length; |
if (listener === 'all') { |
for (i = 0; i < len; i++) { |
remove(element, type, target.events[type][i], Boolean(useCapture)); |
} |
return; |
} else { |
for (i = 0; i < len; i++) { |
if (target.events[type][i] === listener) { |
element[removeEvent](on + type, wrapped, useCapture || false); |
target.events[type].splice(i, 1); |
if (useAttachEvent && listeners) { |
listeners.useCount[listenerIndex]--; |
if (listeners.useCount[listenerIndex] === 0) { |
listeners.supplied.splice(listenerIndex, 1); |
listeners.wrapped.splice(listenerIndex, 1); |
listeners.useCount.splice(listenerIndex, 1); |
} |
} |
break; |
} |
} |
} |
if (target.events[type] && target.events[type].length === 0) { |
target.events[type] = null; |
target.typeCount--; |
} |
} |
if (!target.typeCount) { |
targets.splice(elementIndex, 1); |
elements.splice(elementIndex, 1); |
attachedListeners.splice(elementIndex, 1); |
} |
} |
function preventDef () { |
this.returnValue = false; |
} |
function stopProp () { |
this.cancelBubble = true; |
} |
function stopImmProp () { |
this.cancelBubble = true; |
this.immediatePropagationStopped = true; |
} |
return { |
add: add, |
remove: remove, |
useAttachEvent: useAttachEvent, |
_elements: elements, |
_targets: targets, |
_attachedListeners: attachedListeners |
}; |
}()); |
function blank () {} |
function isElement (o) { |
if (!o || (typeof o !== 'object')) { return false; } |
var _window = getWindow(o) || window; |
return (/object|function/.test(typeof _window.Element) |
? o instanceof _window.Element //DOM2 |
: o.nodeType === 1 && typeof o.nodeName === "string"); |
} |
function isWindow (thing) { return thing === window || !!(thing && thing.Window) && (thing instanceof thing.Window); } |
function isDocFrag (thing) { return !!thing && thing instanceof DocumentFragment; } |
function isArray (thing) { |
return isObject(thing) |
&& (typeof thing.length !== undefined) |
&& isFunction(thing.splice); |
} |
function isObject (thing) { return !!thing && (typeof thing === 'object'); } |
function isFunction (thing) { return typeof thing === 'function'; } |
function isNumber (thing) { return typeof thing === 'number' ; } |
function isBool (thing) { return typeof thing === 'boolean' ; } |
function isString (thing) { return typeof thing === 'string' ; } |
function trySelector (value) { |
if (!isString(value)) { return false; } |
// an exception will be raised if it is invalid |
document.querySelector(value); |
return true; |
} |
function extend (dest, source) { |
for (var prop in source) { |
dest[prop] = source[prop]; |
} |
return dest; |
} |
var prefixedPropREs = { |
webkit: /(Movement[XY]|Radius[XY]|RotationAngle|Force)$/ |
}; |
function pointerExtend (dest, source) { |
for (var prop in source) { |
var deprecated = false; |
// skip deprecated prefixed properties |
for (var vendor in prefixedPropREs) { |
if (prop.indexOf(vendor) === 0 && prefixedPropREs[vendor].test(prop)) { |
deprecated = true; |
break; |
} |
} |
if (!deprecated) { |
dest[prop] = source[prop]; |
} |
} |
return dest; |
} |
function copyCoords (dest, src) { |
dest.page = dest.page || {}; |
dest.page.x = src.page.x; |
dest.page.y = src.page.y; |
dest.client = dest.client || {}; |
dest.client.x = src.client.x; |
dest.client.y = src.client.y; |
dest.timeStamp = src.timeStamp; |
} |
function setEventXY (targetObj, pointers, interaction) { |
var pointer = (pointers.length > 1 |
? pointerAverage(pointers) |
: pointers[0]); |
getPageXY(pointer, tmpXY, interaction); |
targetObj.page.x = tmpXY.x; |
targetObj.page.y = tmpXY.y; |
getClientXY(pointer, tmpXY, interaction); |
targetObj.client.x = tmpXY.x; |
targetObj.client.y = tmpXY.y; |
targetObj.timeStamp = new Date().getTime(); |
} |
function setEventDeltas (targetObj, prev, cur) { |
targetObj.page.x = cur.page.x - prev.page.x; |
targetObj.page.y = cur.page.y - prev.page.y; |
targetObj.client.x = cur.client.x - prev.client.x; |
targetObj.client.y = cur.client.y - prev.client.y; |
targetObj.timeStamp = new Date().getTime() - prev.timeStamp; |
// set pointer velocity |
var dt = Math.max(targetObj.timeStamp / 1000, 0.001); |
targetObj.page.speed = hypot(targetObj.page.x, targetObj.page.y) / dt; |
targetObj.page.vx = targetObj.page.x / dt; |
targetObj.page.vy = targetObj.page.y / dt; |
targetObj.client.speed = hypot(targetObj.client.x, targetObj.page.y) / dt; |
targetObj.client.vx = targetObj.client.x / dt; |
targetObj.client.vy = targetObj.client.y / dt; |
} |
function isNativePointer (pointer) { |
return (pointer instanceof window.Event |
|| (supportsTouch && window.Touch && pointer instanceof window.Touch)); |
} |
// Get specified X/Y coords for mouse or event.touches[0] |
function getXY (type, pointer, xy) { |
xy = xy || {}; |
type = type || 'page'; |
xy.x = pointer[type + 'X']; |
xy.y = pointer[type + 'Y']; |
return xy; |
} |
function getPageXY (pointer, page) { |
page = page || {}; |
// Opera Mobile handles the viewport and scrolling oddly |
if (isOperaMobile && isNativePointer(pointer)) { |
getXY('screen', pointer, page); |
page.x += window.scrollX; |
page.y += window.scrollY; |
} |
else { |
getXY('page', pointer, page); |
} |
return page; |
} |
function getClientXY (pointer, client) { |
client = client || {}; |
if (isOperaMobile && isNativePointer(pointer)) { |
// Opera Mobile handles the viewport and scrolling oddly |
getXY('screen', pointer, client); |
} |
else { |
getXY('client', pointer, client); |
} |
return client; |
} |
function getScrollXY (win) { |
win = win || window; |
return { |
x: win.scrollX || win.document.documentElement.scrollLeft, |
y: win.scrollY || win.document.documentElement.scrollTop |
}; |
} |
function getPointerId (pointer) { |
return isNumber(pointer.pointerId)? pointer.pointerId : pointer.identifier; |
} |
function getActualElement (element) { |
return (element instanceof SVGElementInstance |
? element.correspondingUseElement |
: element); |
} |
function getWindow (node) { |
if (isWindow(node)) { |
return node; |
} |
var rootNode = (node.ownerDocument || node); |
return rootNode.defaultView || rootNode.parentWindow || window; |
} |
function getElementClientRect (element) { |
var clientRect = (element instanceof SVGElement |
? element.getBoundingClientRect() |
: element.getClientRects()[0]); |
return clientRect && { |
left : clientRect.left, |
right : clientRect.right, |
top : clientRect.top, |
bottom: clientRect.bottom, |
width : clientRect.width || clientRect.right - clientRect.left, |
height: clientRect.height || clientRect.bottom - clientRect.top |
}; |
} |
function getElementRect (element) { |
var clientRect = getElementClientRect(element); |
if (!isIOS7 && clientRect) { |
var scroll = getScrollXY(getWindow(element)); |
clientRect.left += scroll.x; |
clientRect.right += scroll.x; |
clientRect.top += scroll.y; |
clientRect.bottom += scroll.y; |
} |
return clientRect; |
} |
function getTouchPair (event) { |
var touches = []; |
// array of touches is supplied |
if (isArray(event)) { |
touches[0] = event[0]; |
touches[1] = event[1]; |
} |
// an event |
else { |
if (event.type === 'touchend') { |
if (event.touches.length === 1) { |
touches[0] = event.touches[0]; |
touches[1] = event.changedTouches[0]; |
} |
else if (event.touches.length === 0) { |
touches[0] = event.changedTouches[0]; |
touches[1] = event.changedTouches[1]; |
} |
} |
else { |
touches[0] = event.touches[0]; |
touches[1] = event.touches[1]; |
} |
} |
return touches; |
} |
function pointerAverage (pointers) { |
var average = { |
pageX : 0, |
pageY : 0, |
clientX: 0, |
clientY: 0, |
screenX: 0, |
screenY: 0 |
}; |
var prop; |
for (var i = 0; i < pointers.length; i++) { |
for (prop in average) { |
average[prop] += pointers[i][prop]; |
} |
} |
for (prop in average) { |
average[prop] /= pointers.length; |
} |
return average; |
} |
function touchBBox (event) { |
if (!event.length && !(event.touches && event.touches.length > 1)) { |
return; |
} |
var touches = getTouchPair(event), |
minX = Math.min(touches[0].pageX, touches[1].pageX), |
minY = Math.min(touches[0].pageY, touches[1].pageY), |
maxX = Math.max(touches[0].pageX, touches[1].pageX), |
maxY = Math.max(touches[0].pageY, touches[1].pageY); |
return { |
x: minX, |
y: minY, |
left: minX, |
top: minY, |
width: maxX - minX, |
height: maxY - minY |
}; |
} |
function touchDistance (event, deltaSource) { |
deltaSource = deltaSource || defaultOptions.deltaSource; |
var sourceX = deltaSource + 'X', |
sourceY = deltaSource + 'Y', |
touches = getTouchPair(event); |
var dx = touches[0][sourceX] - touches[1][sourceX], |
dy = touches[0][sourceY] - touches[1][sourceY]; |
return hypot(dx, dy); |
} |
function touchAngle (event, prevAngle, deltaSource) { |
deltaSource = deltaSource || defaultOptions.deltaSource; |
var sourceX = deltaSource + 'X', |
sourceY = deltaSource + 'Y', |
touches = getTouchPair(event), |
dx = touches[0][sourceX] - touches[1][sourceX], |
dy = touches[0][sourceY] - touches[1][sourceY], |
angle = 180 * Math.atan(dy / dx) / Math.PI; |
if (isNumber(prevAngle)) { |
var dr = angle - prevAngle, |
drClamped = dr % 360; |
if (drClamped > 315) { |
angle -= 360 + (angle / 360)|0 * 360; |
} |
else if (drClamped > 135) { |
angle -= 180 + (angle / 360)|0 * 360; |
} |
else if (drClamped < -315) { |
angle += 360 + (angle / 360)|0 * 360; |
} |
else if (drClamped < -135) { |
angle += 180 + (angle / 360)|0 * 360; |
} |
} |
return angle; |
} |
function getOriginXY (interactable, element) { |
var origin = interactable |
? interactable.options.origin |
: defaultOptions.origin; |
if (origin === 'parent') { |
origin = parentElement(element); |
} |
else if (origin === 'self') { |
origin = interactable.getRect(element); |
} |
else if (trySelector(origin)) { |
origin = closest(element, origin) || { x: 0, y: 0 }; |
} |
if (isFunction(origin)) { |
origin = origin(interactable && element); |
} |
if (isElement(origin)) { |
origin = getElementRect(origin); |
} |
origin.x = ('x' in origin)? origin.x : origin.left; |
origin.y = ('y' in origin)? origin.y : origin.top; |
return origin; |
} |
// http://stackoverflow.com/a/5634528/2280888 |
function _getQBezierValue(t, p1, p2, p3) { |
var iT = 1 - t; |
return iT * iT * p1 + 2 * iT * t * p2 + t * t * p3; |
} |
function getQuadraticCurvePoint(startX, startY, cpX, cpY, endX, endY, position) { |
return { |
x: _getQBezierValue(position, startX, cpX, endX), |
y: _getQBezierValue(position, startY, cpY, endY) |
}; |
} |
// http://gizma.com/easing/ |
function easeOutQuad (t, b, c, d) { |
t /= d; |
return -c * t*(t-2) + b; |
} |
function nodeContains (parent, child) { |
while (child) { |
if (child === parent) { |
return true; |
} |
child = child.parentNode; |
} |
return false; |
} |
function closest (child, selector) { |
var parent = parentElement(child); |
while (isElement(parent)) { |
if (matchesSelector(parent, selector)) { return parent; } |
parent = parentElement(parent); |
} |
return null; |
} |
function parentElement (node) { |
var parent = node.parentNode; |
if (isDocFrag(parent)) { |
// skip past #shado-root fragments |
while ((parent = parent.host) && isDocFrag(parent)) {} |
return parent; |
} |
return parent; |
} |
function inContext (interactable, element) { |
return interactable._context === element.ownerDocument |
|| nodeContains(interactable._context, element); |
} |
function testIgnore (interactable, interactableElement, element) { |
var ignoreFrom = interactable.options.ignoreFrom; |
if (!ignoreFrom || !isElement(element)) { return false; } |
if (isString(ignoreFrom)) { |
return matchesUpTo(element, ignoreFrom, interactableElement); |
} |
else if (isElement(ignoreFrom)) { |
return nodeContains(ignoreFrom, element); |
} |
return false; |
} |
function testAllow (interactable, interactableElement, element) { |
var allowFrom = interactable.options.allowFrom; |
if (!allowFrom) { return true; } |
if (!isElement(element)) { return false; } |
if (isString(allowFrom)) { |
return matchesUpTo(element, allowFrom, interactableElement); |
} |
else if (isElement(allowFrom)) { |
return nodeContains(allowFrom, element); |
} |
return false; |
} |
function checkAxis (axis, interactable) { |
if (!interactable) { return false; } |
var thisAxis = interactable.options.drag.axis; |
return (axis === 'xy' || thisAxis === 'xy' || thisAxis === axis); |
} |
function checkSnap (interactable, action) { |
var options = interactable.options; |
if (/^resize/.test(action)) { |
action = 'resize'; |
} |
return options[action].snap && options[action].snap.enabled; |
} |
function checkRestrict (interactable, action) { |
var options = interactable.options; |
if (/^resize/.test(action)) { |
action = 'resize'; |
} |
return options[action].restrict && options[action].restrict.enabled; |
} |
function checkAutoScroll (interactable, action) { |
var options = interactable.options; |
if (/^resize/.test(action)) { |
action = 'resize'; |
} |
return options[action].autoScroll && options[action].autoScroll.enabled; |
} |
function withinInteractionLimit (interactable, element, action) { |
var options = interactable.options, |
maxActions = options[action.name].max, |
maxPerElement = options[action.name].maxPerElement, |
activeInteractions = 0, |
targetCount = 0, |
targetElementCount = 0; |
for (var i = 0, len = interactions.length; i < len; i++) { |
var interaction = interactions[i], |
otherAction = interaction.prepared.name, |
active = interaction.interacting(); |
if (!active) { continue; } |
activeInteractions++; |
if (activeInteractions >= maxInteractions) { |
return false; |
} |
if (interaction.target !== interactable) { continue; } |
targetCount += (otherAction === action.name)|0; |
if (targetCount >= maxActions) { |
return false; |
} |
if (interaction.element === element) { |
targetElementCount++; |
if (otherAction !== action.name || targetElementCount >= maxPerElement) { |
return false; |
} |
} |
} |
return maxInteractions > 0; |
} |
// Test for the element that's "above" all other qualifiers |
function indexOfDeepestElement (elements) { |
var dropzone, |
deepestZone = elements[0], |
index = deepestZone? 0: -1, |
parent, |
deepestZoneParents = [], |
dropzoneParents = [], |
child, |
i, |
n; |
for (i = 1; i < elements.length; i++) { |
dropzone = elements[i]; |
// an element might belong to multiple selector dropzones |
if (!dropzone || dropzone === deepestZone) { |
continue; |
} |
if (!deepestZone) { |
deepestZone = dropzone; |
index = i; |
continue; |
} |
// check if the deepest or current are document.documentElement or document.rootElement |
// - if the current dropzone is, do nothing and continue |
if (dropzone.parentNode === dropzone.ownerDocument) { |
continue; |
} |
// - if deepest is, update with the current dropzone and continue to next |
else if (deepestZone.parentNode === dropzone.ownerDocument) { |
deepestZone = dropzone; |
index = i; |
continue; |
} |
if (!deepestZoneParents.length) { |
parent = deepestZone; |
while (parent.parentNode && parent.parentNode !== parent.ownerDocument) { |
deepestZoneParents.unshift(parent); |
parent = parent.parentNode; |
} |
} |
// if this element is an svg element and the current deepest is |
// an HTMLElement |
if (deepestZone instanceof HTMLElement |
&& dropzone instanceof SVGElement |
&& !(dropzone instanceof SVGSVGElement)) { |
if (dropzone === deepestZone.parentNode) { |
continue; |
} |
parent = dropzone.ownerSVGElement; |
} |
else { |
parent = dropzone; |
} |
dropzoneParents = []; |
while (parent.parentNode !== parent.ownerDocument) { |
dropzoneParents.unshift(parent); |
parent = parent.parentNode; |
} |
n = 0; |
// get (position of last common ancestor) + 1 |
while (dropzoneParents[n] && dropzoneParents[n] === deepestZoneParents[n]) { |
n++; |
} |
var parents = [ |
dropzoneParents[n - 1], |
dropzoneParents[n], |
deepestZoneParents[n] |
]; |
child = parents[0].lastChild; |
while (child) { |
if (child === parents[1]) { |
deepestZone = dropzone; |
index = i; |
deepestZoneParents = []; |
break; |
} |
else if (child === parents[2]) { |
break; |
} |
child = child.previousSibling; |
} |
} |
return index; |
} |
function Interaction () { |
this.target = null; // current interactable being interacted with |
this.element = null; // the target element of the interactable |
this.dropTarget = null; // the dropzone a drag target might be dropped into |
this.dropElement = null; // the element at the time of checking |
this.prevDropTarget = null; // the dropzone that was recently dragged away from |
this.prevDropElement = null; // the element at the time of checking |
this.prepared = { // action that's ready to be fired on next move event |
name : null, |
axis : null, |
edges: null |
}; |
this.matches = []; // all selectors that are matched by target element |
this.matchElements = []; // corresponding elements |
this.inertiaStatus = { |
active : false, |
smoothEnd : false, |
ending : false, |
startEvent: null, |
upCoords: {}, |
xe: 0, ye: 0, |
sx: 0, sy: 0, |
t0: 0, |
vx0: 0, vys: 0, |
duration: 0, |
resumeDx: 0, |
resumeDy: 0, |
lambda_v0: 0, |
one_ve_v0: 0, |
i : null |
}; |
if (isFunction(Function.prototype.bind)) { |
this.boundInertiaFrame = this.inertiaFrame.bind(this); |
this.boundSmoothEndFrame = this.smoothEndFrame.bind(this); |
} |
else { |
var that = this; |
this.boundInertiaFrame = function () { return that.inertiaFrame(); }; |
this.boundSmoothEndFrame = function () { return that.smoothEndFrame(); }; |
} |
this.activeDrops = { |
dropzones: [], // the dropzones that are mentioned below |
elements : [], // elements of dropzones that accept the target draggable |
rects : [] // the rects of the elements mentioned above |
}; |
// keep track of added pointers |
this.pointers = []; |
this.pointerIds = []; |
this.downTargets = []; |
this.downTimes = []; |
this.holdTimers = []; |
// Previous native pointer move event coordinates |
this.prevCoords = { |
page : { x: 0, y: 0 }, |
client : { x: 0, y: 0 }, |
timeStamp: 0 |
}; |
// current native pointer move event coordinates |
this.curCoords = { |
page : { x: 0, y: 0 }, |
client : { x: 0, y: 0 }, |
timeStamp: 0 |
}; |
// Starting InteractEvent pointer coordinates |
this.startCoords = { |
page : { x: 0, y: 0 }, |
client : { x: 0, y: 0 }, |
timeStamp: 0 |
}; |
// Change in coordinates and time of the pointer |
this.pointerDelta = { |
page : { x: 0, y: 0, vx: 0, vy: 0, speed: 0 }, |
client : { x: 0, y: 0, vx: 0, vy: 0, speed: 0 }, |
timeStamp: 0 |
}; |
this.downEvent = null; // pointerdown/mousedown/touchstart event |
this.downPointer = {}; |
this._eventTarget = null; |
this._curEventTarget = null; |
this.prevEvent = null; // previous action event |
this.tapTime = 0; // time of the most recent tap event |
this.prevTap = null; |
this.startOffset = { left: 0, right: 0, top: 0, bottom: 0 }; |
this.restrictOffset = { left: 0, right: 0, top: 0, bottom: 0 }; |
this.snapOffsets = []; |
this.gesture = { |
start: { x: 0, y: 0 }, |
startDistance: 0, // distance between two touches of touchStart |
prevDistance : 0, |
distance : 0, |
scale: 1, // gesture.distance / gesture.startDistance |
startAngle: 0, // angle of line joining two touches |
prevAngle : 0 // angle of the previous gesture event |
}; |
this.snapStatus = { |
x : 0, y : 0, |
dx : 0, dy : 0, |
realX : 0, realY : 0, |
snappedX: 0, snappedY: 0, |
targets : [], |
locked : false, |
changed : false |
}; |
this.restrictStatus = { |
dx : 0, dy : 0, |
restrictedX: 0, restrictedY: 0, |
snap : null, |
restricted : false, |
changed : false |
}; |
this.restrictStatus.snap = this.snapStatus; |
this.pointerIsDown = false; |
this.pointerWasMoved = false; |
this.gesturing = false; |
this.dragging = false; |
this.resizing = false; |
this.resizeAxes = 'xy'; |
this.mouse = false; |
interactions.push(this); |
} |
Interaction.prototype = { |
getPageXY : function (pointer, xy) { return getPageXY(pointer, xy, this); }, |
getClientXY: function (pointer, xy) { return getClientXY(pointer, xy, this); }, |
setEventXY : function (target, ptr) { return setEventXY(target, ptr, this); }, |
pointerOver: function (pointer, event, eventTarget) { |
if (this.prepared.name || !this.mouse) { return; } |
var curMatches = [], |
curMatchElements = [], |
prevTargetElement = this.element; |
this.addPointer(pointer); |
if (this.target |
&& (testIgnore(this.target, this.element, eventTarget) |
|| !testAllow(this.target, this.element, eventTarget))) { |
// if the eventTarget should be ignored or shouldn't be allowed |
// clear the previous target |
this.target = null; |
this.element = null; |
this.matches = []; |
this.matchElements = []; |
} |
var elementInteractable = interactables.get(eventTarget), |
elementAction = (elementInteractable |
&& !testIgnore(elementInteractable, eventTarget, eventTarget) |
&& testAllow(elementInteractable, eventTarget, eventTarget) |
&& validateAction( |
elementInteractable.getAction(pointer, event, this, eventTarget), |
elementInteractable)); |
if (elementAction && !withinInteractionLimit(elementInteractable, eventTarget, elementAction)) { |
elementAction = null; |
} |
function pushCurMatches (interactable, selector) { |
if (interactable |
&& isElement(eventTarget) |
&& inContext(interactable, eventTarget) |
&& !testIgnore(interactable, eventTarget, eventTarget) |
&& testAllow(interactable, eventTarget, eventTarget) |
&& matchesSelector(eventTarget, selector)) { |
curMatches.push(interactable); |
curMatchElements.push(eventTarget); |
} |
} |
if (elementAction) { |
this.target = elementInteractable; |
this.element = eventTarget; |
this.matches = []; |
this.matchElements = []; |
} |
else { |
interactables.forEachSelector(pushCurMatches); |
if (this.validateSelector(pointer, event, curMatches, curMatchElements)) { |
this.matches = curMatches; |
this.matchElements = curMatchElements; |
this.pointerHover(pointer, event, this.matches, this.matchElements); |
events.add(eventTarget, |
supportsPointerEvent? pEventTypes.move : 'mousemove', |
listeners.pointerHover); |
} |
else if (this.target) { |
if (nodeContains(prevTargetElement, eventTarget)) { |
this.pointerHover(pointer, event, this.matches, this.matchElements); |
events.add(this.element, |
supportsPointerEvent? pEventTypes.move : 'mousemove', |
listeners.pointerHover); |
} |
else { |
this.target = null; |
this.element = null; |
this.matches = []; |
this.matchElements = []; |
} |
} |
} |
}, |
// Check what action would be performed on pointerMove target if a mouse |
// button were pressed and change the cursor accordingly |
pointerHover: function (pointer, event, eventTarget, curEventTarget, matches, matchElements) { |
var target = this.target; |
if (!this.prepared.name && this.mouse) { |
var action; |
// update pointer coords for defaultActionChecker to use |
this.setEventXY(this.curCoords, [pointer]); |
if (matches) { |
action = this.validateSelector(pointer, event, matches, matchElements); |
} |
else if (target) { |
action = validateAction(target.getAction(this.pointers[0], event, this, this.element), this.target); |
} |
if (target && target.options.styleCursor) { |
if (action) { |
target._doc.documentElement.style.cursor = getActionCursor(action); |
} |
else { |
target._doc.documentElement.style.cursor = ''; |
} |
} |
} |
else if (this.prepared.name) { |
this.checkAndPreventDefault(event, target, this.element); |
} |
}, |
pointerOut: function (pointer, event, eventTarget) { |
if (this.prepared.name) { return; } |
// Remove temporary event listeners for selector Interactables |
if (!interactables.get(eventTarget)) { |
events.remove(eventTarget, |
supportsPointerEvent? pEventTypes.move : 'mousemove', |
listeners.pointerHover); |
} |
if (this.target && this.target.options.styleCursor && !this.interacting()) { |
this.target._doc.documentElement.style.cursor = ''; |
} |
}, |
selectorDown: function (pointer, event, eventTarget, curEventTarget) { |
var that = this, |
// copy event to be used in timeout for IE8 |
eventCopy = events.useAttachEvent? extend({}, event) : event, |
element = eventTarget, |
pointerIndex = this.addPointer(pointer), |
action; |
this.holdTimers[pointerIndex] = setTimeout(function () { |
that.pointerHold(events.useAttachEvent? eventCopy : pointer, eventCopy, eventTarget, curEventTarget); |
}, defaultOptions._holdDuration); |
this.pointerIsDown = true; |
// Check if the down event hits the current inertia target |
if (this.inertiaStatus.active && this.target.selector) { |
// climb up the DOM tree from the event target |
while (isElement(element)) { |
// if this element is the current inertia target element |
if (element === this.element |
// and the prospective action is the same as the ongoing one |
&& validateAction(this.target.getAction(pointer, event, this, this.element), this.target).name === this.prepared.name) { |
// stop inertia so that the next move will be a normal one |
cancelFrame(this.inertiaStatus.i); |
this.inertiaStatus.active = false; |
this.collectEventTargets(pointer, event, eventTarget, 'down'); |
return; |
} |
element = parentElement(element); |
} |
} |
// do nothing if interacting |
if (this.interacting()) { |
this.collectEventTargets(pointer, event, eventTarget, 'down'); |
return; |
} |
function pushMatches (interactable, selector, context) { |
var elements = ie8MatchesSelector |
? context.querySelectorAll(selector) |
: undefined; |
if (inContext(interactable, element) |
&& !testIgnore(interactable, element, eventTarget) |
&& testAllow(interactable, element, eventTarget) |
&& matchesSelector(element, selector, elements)) { |
that.matches.push(interactable); |
that.matchElements.push(element); |
} |
} |
// update pointer coords for defaultActionChecker to use |
this.setEventXY(this.curCoords, [pointer]); |
this.downEvent = event; |
while (isElement(element) && !action) { |
this.matches = []; |
this.matchElements = []; |
interactables.forEachSelector(pushMatches); |
action = this.validateSelector(pointer, event, this.matches, this.matchElements); |
element = parentElement(element); |
} |
if (action) { |
this.prepared.name = action.name; |
this.prepared.axis = action.axis; |
this.prepared.edges = action.edges; |
this.collectEventTargets(pointer, event, eventTarget, 'down'); |
return this.pointerDown(pointer, event, eventTarget, curEventTarget, action); |
} |
else { |
// do these now since pointerDown isn't being called from here |
this.downTimes[pointerIndex] = new Date().getTime(); |
this.downTargets[pointerIndex] = eventTarget; |
pointerExtend(this.downPointer, pointer); |
copyCoords(this.prevCoords, this.curCoords); |
this.pointerWasMoved = false; |
} |
this.collectEventTargets(pointer, event, eventTarget, 'down'); |
}, |
// Determine action to be performed on next pointerMove and add appropriate |
// style and event Listeners |
pointerDown: function (pointer, event, eventTarget, curEventTarget, forceAction) { |
if (!forceAction && !this.inertiaStatus.active && this.pointerWasMoved && this.prepared.name) { |
this.checkAndPreventDefault(event, this.target, this.element); |
return; |
} |
this.pointerIsDown = true; |
this.downEvent = event; |
var pointerIndex = this.addPointer(pointer), |
action; |
// If it is the second touch of a multi-touch gesture, keep the |
// target the same and get a new action if a target was set by the |
// first touch |
if (this.pointerIds.length > 1 && this.target._element === this.element) { |
var newAction = validateAction(forceAction || this.target.getAction(pointer, event, this, this.element), this.target); |
if (withinInteractionLimit(this.target, this.element, newAction)) { |
action = newAction; |
} |
this.prepared.name = null; |
} |
// Otherwise, set the target if there is no action prepared |
else if (!this.prepared.name) { |
var interactable = interactables.get(curEventTarget); |
if (interactable |
&& !testIgnore(interactable, curEventTarget, eventTarget) |
&& testAllow(interactable, curEventTarget, eventTarget) |
&& (action = validateAction(forceAction || interactable.getAction(pointer, event, this, curEventTarget), interactable, eventTarget)) |
&& withinInteractionLimit(interactable, curEventTarget, action)) { |
this.target = interactable; |
this.element = curEventTarget; |
} |
} |
var target = this.target, |
options = target && target.options; |
if (target && (forceAction || !this.prepared.name)) { |
action = action || validateAction(forceAction || target.getAction(pointer, event, this, curEventTarget), target, this.element); |
this.setEventXY(this.startCoords, this.pointers); |
if (!action) { return; } |
if (options.styleCursor) { |
target._doc.documentElement.style.cursor = getActionCursor(action); |
} |
this.resizeAxes = action.name === 'resize'? action.axis : null; |
if (action === 'gesture' && this.pointerIds.length < 2) { |
action = null; |
} |
this.prepared.name = action.name; |
this.prepared.axis = action.axis; |
this.prepared.edges = action.edges; |
this.snapStatus.snappedX = this.snapStatus.snappedY = |
this.restrictStatus.restrictedX = this.restrictStatus.restrictedY = NaN; |
this.downTimes[pointerIndex] = new Date().getTime(); |
this.downTargets[pointerIndex] = eventTarget; |
pointerExtend(this.downPointer, pointer); |
copyCoords(this.prevCoords, this.startCoords); |
this.pointerWasMoved = false; |
this.checkAndPreventDefault(event, target, this.element); |
} |
// if inertia is active try to resume action |
else if (this.inertiaStatus.active |
&& curEventTarget === this.element |
&& validateAction(target.getAction(pointer, event, this, this.element), target).name === this.prepared.name) { |
cancelFrame(this.inertiaStatus.i); |
this.inertiaStatus.active = false; |
this.checkAndPreventDefault(event, target, this.element); |
} |
}, |
setModifications: function (coords, preEnd) { |
var target = this.target, |
shouldMove = true, |
shouldSnap = checkSnap(target, this.prepared.name) && (!target.options[this.prepared.name].snap.endOnly || preEnd), |
shouldRestrict = checkRestrict(target, this.prepared.name) && (!target.options[this.prepared.name].restrict.endOnly || preEnd); |
if (shouldSnap ) { this.setSnapping (coords); } else { this.snapStatus .locked = false; } |
if (shouldRestrict) { this.setRestriction(coords); } else { this.restrictStatus.restricted = false; } |
if (shouldSnap && this.snapStatus.locked && !this.snapStatus.changed) { |
shouldMove = shouldRestrict && this.restrictStatus.restricted && this.restrictStatus.changed; |
} |
else if (shouldRestrict && this.restrictStatus.restricted && !this.restrictStatus.changed) { |
shouldMove = false; |
} |
return shouldMove; |
}, |
setStartOffsets: function (action, interactable, element) { |
var rect = interactable.getRect(element), |
origin = getOriginXY(interactable, element), |
snap = interactable.options[this.prepared.name].snap, |
restrict = interactable.options[this.prepared.name].restrict, |
width, height; |
if (rect) { |
this.startOffset.left = this.startCoords.page.x - rect.left; |
this.startOffset.top = this.startCoords.page.y - rect.top; |
this.startOffset.right = rect.right - this.startCoords.page.x; |
this.startOffset.bottom = rect.bottom - this.startCoords.page.y; |
if ('width' in rect) { width = rect.width; } |
else { width = rect.right - rect.left; } |
if ('height' in rect) { height = rect.height; } |
else { height = rect.bottom - rect.top; } |
} |
else { |
this.startOffset.left = this.startOffset.top = this.startOffset.right = this.startOffset.bottom = 0; |
} |
this.snapOffsets.splice(0); |
var snapOffset = snap && snap.offset === 'startCoords' |
? { |
x: this.startCoords.page.x - origin.x, |
y: this.startCoords.page.y - origin.y |
} |
: snap && snap.offset || { x: 0, y: 0 }; |
if (rect && snap && snap.relativePoints && snap.relativePoints.length) { |
for (var i = 0; i < snap.relativePoints.length; i++) { |
this.snapOffsets.push({ |
x: this.startOffset.left - (width * snap.relativePoints[i].x) + snapOffset.x, |
y: this.startOffset.top - (height * snap.relativePoints[i].y) + snapOffset.y |
}); |
} |
} |
else { |
this.snapOffsets.push(snapOffset); |
} |
if (rect && restrict.elementRect) { |
this.restrictOffset.left = this.startOffset.left - (width * restrict.elementRect.left); |
this.restrictOffset.top = this.startOffset.top - (height * restrict.elementRect.top); |
this.restrictOffset.right = this.startOffset.right - (width * (1 - restrict.elementRect.right)); |
this.restrictOffset.bottom = this.startOffset.bottom - (height * (1 - restrict.elementRect.bottom)); |
} |
else { |
this.restrictOffset.left = this.restrictOffset.top = this.restrictOffset.right = this.restrictOffset.bottom = 0; |
} |
}, |
/*\ |
* Interaction.start |
[ method ] |
* |
* Start an action with the given Interactable and Element as tartgets. The |
* action must be enabled for the target Interactable and an appropriate number |
* of pointers must be held down – 1 for drag/resize, 2 for gesture. |
* |
* Use it with `interactable.<action>able({ manualStart: false })` to always |
* [start actions manually](https://github.com/taye/interact.js/issues/114) |
* |
- action (object) The action to be performed - drag, resize, etc. |
- interactable (Interactable) The Interactable to target |
- element (Element) The DOM Element to target |
= (object) interact |
** |
| interact(target) |
| .draggable({ |
| // disable the default drag start by down->move |
| manualStart: true |
| }) |
| // start dragging after the user holds the pointer down |
| .on('hold', function (event) { |
| var interaction = event.interaction; |
| |
| if (!interaction.interacting()) { |
| interaction.start({ name: 'drag' }, |
| event.interactable, |
| event.currentTarget); |
| } |
| }); |
\*/ |
start: function (action, interactable, element) { |
if (this.interacting() |
|| !this.pointerIsDown |
|| this.pointerIds.length < (action.name === 'gesture'? 2 : 1)) { |
return; |
} |
// if this interaction had been removed after stopping |
// add it back |
if (indexOf(interactions, this) === -1) { |
interactions.push(this); |
} |
// set the startCoords if there was no prepared action |
if (!this.prepared.name) { |
this.setEventXY(this.startCoords, this.pointers); |
} |
this.prepared.name = action.name; |
this.prepared.axis = action.axis; |
this.prepared.edges = action.edges; |
this.target = interactable; |
this.element = element; |
this.setStartOffsets(action.name, interactable, element); |
this.setModifications(this.startCoords.page); |
this.prevEvent = this[this.prepared.name + 'Start'](this.downEvent); |
}, |
pointerMove: function (pointer, event, eventTarget, curEventTarget, preEnd) { |
if (this.inertiaStatus.active) { |
var pageUp = this.inertiaStatus.upCoords.page; |
var clientUp = this.inertiaStatus.upCoords.client; |
var inertiaPosition = { |
pageX : pageUp.x + this.inertiaStatus.sx, |
pageY : pageUp.y + this.inertiaStatus.sy, |
clientX: clientUp.x + this.inertiaStatus.sx, |
clientY: clientUp.y + this.inertiaStatus.sy |
}; |
this.setEventXY(this.curCoords, [inertiaPosition]); |
} |
else { |
this.recordPointer(pointer); |
this.setEventXY(this.curCoords, this.pointers); |
} |
var duplicateMove = (this.curCoords.page.x === this.prevCoords.page.x |
&& this.curCoords.page.y === this.prevCoords.page.y |
&& this.curCoords.client.x === this.prevCoords.client.x |
&& this.curCoords.client.y === this.prevCoords.client.y); |
var dx, dy, |
pointerIndex = this.mouse? 0 : indexOf(this.pointerIds, getPointerId(pointer)); |
// register movement greater than pointerMoveTolerance |
if (this.pointerIsDown && !this.pointerWasMoved) { |
dx = this.curCoords.client.x - this.startCoords.client.x; |
dy = this.curCoords.client.y - this.startCoords.client.y; |
this.pointerWasMoved = hypot(dx, dy) > pointerMoveTolerance; |
} |
if (!duplicateMove && (!this.pointerIsDown || this.pointerWasMoved)) { |
if (this.pointerIsDown) { |
clearTimeout(this.holdTimers[pointerIndex]); |
} |
this.collectEventTargets(pointer, event, eventTarget, 'move'); |
} |
if (!this.pointerIsDown) { return; } |
if (duplicateMove && this.pointerWasMoved && !preEnd) { |
this.checkAndPreventDefault(event, this.target, this.element); |
return; |
} |
// set pointer coordinate, time changes and speeds |
setEventDeltas(this.pointerDelta, this.prevCoords, this.curCoords); |
if (!this.prepared.name) { return; } |
if (this.pointerWasMoved |
// ignore movement while inertia is active |
&& (!this.inertiaStatus.active || (pointer instanceof InteractEvent && /inertiastart/.test(pointer.type)))) { |
// if just starting an action, calculate the pointer speed now |
if (!this.interacting()) { |
setEventDeltas(this.pointerDelta, this.prevCoords, this.curCoords); |
// check if a drag is in the correct axis |
if (this.prepared.name === 'drag') { |
var absX = Math.abs(dx), |
absY = Math.abs(dy), |
targetAxis = this.target.options.drag.axis, |
axis = (absX > absY ? 'x' : absX < absY ? 'y' : 'xy'); |
// if the movement isn't in the axis of the interactable |
if (axis !== 'xy' && targetAxis !== 'xy' && targetAxis !== axis) { |
// cancel the prepared action |
this.prepared.name = null; |
// then try to get a drag from another ineractable |
var element = eventTarget; |
// check element interactables |
while (isElement(element)) { |
var elementInteractable = interactables.get(element); |
if (elementInteractable |
&& elementInteractable !== this.target |
&& !elementInteractable.options.drag.manualStart |
&& elementInteractable.getAction(this.downPointer, this.downEvent, this, element).name === 'drag' |
&& checkAxis(axis, elementInteractable)) { |
this.prepared.name = 'drag'; |
this.target = elementInteractable; |
this.element = element; |
break; |
} |
element = parentElement(element); |
} |
// if there's no drag from element interactables, |
// check the selector interactables |
if (!this.prepared.name) { |
var thisInteraction = this; |
var getDraggable = function (interactable, selector, context) { |
var elements = ie8MatchesSelector |
? context.querySelectorAll(selector) |
: undefined; |
if (interactable === thisInteraction.target) { return; } |
if (inContext(interactable, eventTarget) |
&& !interactable.options.drag.manualStart |
&& !testIgnore(interactable, element, eventTarget) |
&& testAllow(interactable, element, eventTarget) |
&& matchesSelector(element, selector, elements) |
&& interactable.getAction(thisInteraction.downPointer, thisInteraction.downEvent, thisInteraction, element).name === 'drag' |
&& checkAxis(axis, interactable) |
&& withinInteractionLimit(interactable, element, 'drag')) { |
return interactable; |
} |
}; |
element = eventTarget; |
while (isElement(element)) { |
var selectorInteractable = interactables.forEachSelector(getDraggable); |
if (selectorInteractable) { |
this.prepared.name = 'drag'; |
this.target = selectorInteractable; |
this.element = element; |
break; |
} |
element = parentElement(element); |
} |
} |
} |
} |
} |
var starting = !!this.prepared.name && !this.interacting(); |
if (starting |
&& (this.target.options[this.prepared.name].manualStart |
|| !withinInteractionLimit(this.target, this.element, this.prepared))) { |
this.stop(event); |
return; |
} |
if (this.prepared.name && this.target) { |
if (starting) { |
this.start(this.prepared, this.target, this.element); |
} |
var shouldMove = this.setModifications(this.curCoords.page, preEnd); |
// move if snapping or restriction doesn't prevent it |
if (shouldMove || starting) { |
this.prevEvent = this[this.prepared.name + 'Move'](event); |
} |
this.checkAndPreventDefault(event, this.target, this.element); |
} |
} |
copyCoords(this.prevCoords, this.curCoords); |
if (this.dragging || this.resizing) { |
this.autoScrollMove(pointer); |
} |
}, |
dragStart: function (event) { |
var dragEvent = new InteractEvent(this, event, 'drag', 'start', this.element); |
this.dragging = true; |
this.target.fire(dragEvent); |
// reset active dropzones |
this.activeDrops.dropzones = []; |
this.activeDrops.elements = []; |
this.activeDrops.rects = []; |
if (!this.dynamicDrop) { |
this.setActiveDrops(this.element); |
} |
var dropEvents = this.getDropEvents(event, dragEvent); |
if (dropEvents.activate) { |
this.fireActiveDrops(dropEvents.activate); |
} |
return dragEvent; |
}, |
dragMove: function (event) { |
var target = this.target, |
dragEvent = new InteractEvent(this, event, 'drag', 'move', this.element), |
draggableElement = this.element, |
drop = this.getDrop(dragEvent, event, draggableElement); |
this.dropTarget = drop.dropzone; |
this.dropElement = drop.element; |
var dropEvents = this.getDropEvents(event, dragEvent); |
target.fire(dragEvent); |
if (dropEvents.leave) { this.prevDropTarget.fire(dropEvents.leave); } |
if (dropEvents.enter) { this.dropTarget.fire(dropEvents.enter); } |
if (dropEvents.move ) { this.dropTarget.fire(dropEvents.move ); } |
this.prevDropTarget = this.dropTarget; |
this.prevDropElement = this.dropElement; |
return dragEvent; |
}, |
resizeStart: function (event) { |
var resizeEvent = new InteractEvent(this, event, 'resize', 'start', this.element); |
if (this.prepared.edges) { |
var startRect = this.target.getRect(this.element); |
/* |
* When using the `resizable.square` or `resizable.preserveAspectRatio` options, resizing from one edge |
* will affect another. E.g. with `resizable.square`, resizing to make the right edge larger will make |
* the bottom edge larger by the same amount. We call these 'linked' edges. Any linked edges will depend |
* on the active edges and the edge being interacted with. |
*/ |
if (this.target.options.resize.square || this.target.options.resize.preserveAspectRatio) { |
var linkedEdges = extend({}, this.prepared.edges); |
linkedEdges.top = linkedEdges.top || (linkedEdges.left && !linkedEdges.bottom); |
linkedEdges.left = linkedEdges.left || (linkedEdges.top && !linkedEdges.right ); |
linkedEdges.bottom = linkedEdges.bottom || (linkedEdges.right && !linkedEdges.top ); |
linkedEdges.right = linkedEdges.right || (linkedEdges.bottom && !linkedEdges.left ); |
this.prepared._linkedEdges = linkedEdges; |
} |
else { |
this.prepared._linkedEdges = null; |
} |
// if using `resizable.preserveAspectRatio` option, record aspect ratio at the start of the resize |
if (this.target.options.resize.preserveAspectRatio) { |
this.resizeStartAspectRatio = startRect.width / startRect.height; |
} |
this.resizeRects = { |
start : startRect, |
current : extend({}, startRect), |
restricted: extend({}, startRect), |
previous : extend({}, startRect), |
delta : { |
left: 0, right : 0, width : 0, |
top : 0, bottom: 0, height: 0 |
} |
}; |
resizeEvent.rect = this.resizeRects.restricted; |
resizeEvent.deltaRect = this.resizeRects.delta; |
} |
this.target.fire(resizeEvent); |
this.resizing = true; |
return resizeEvent; |
}, |
resizeMove: function (event) { |
var resizeEvent = new InteractEvent(this, event, 'resize', 'move', this.element); |
var edges = this.prepared.edges, |
invert = this.target.options.resize.invert, |
invertible = invert === 'reposition' || invert === 'negate'; |
if (edges) { |
var dx = resizeEvent.dx, |
dy = resizeEvent.dy, |
start = this.resizeRects.start, |
current = this.resizeRects.current, |
restricted = this.resizeRects.restricted, |
delta = this.resizeRects.delta, |
previous = extend(this.resizeRects.previous, restricted), |
originalEdges = edges; |
// `resize.preserveAspectRatio` takes precedence over `resize.square` |
if (this.target.options.resize.preserveAspectRatio) { |
var resizeStartAspectRatio = this.resizeStartAspectRatio; |
edges = this.prepared._linkedEdges; |
if ((originalEdges.left && originalEdges.bottom) |
|| (originalEdges.right && originalEdges.top)) { |
dy = -dx / resizeStartAspectRatio; |
} |
else if (originalEdges.left || originalEdges.right) { dy = dx / resizeStartAspectRatio; } |
else if (originalEdges.top || originalEdges.bottom) { dx = dy * resizeStartAspectRatio; } |
} |
else if (this.target.options.resize.square) { |
edges = this.prepared._linkedEdges; |
if ((originalEdges.left && originalEdges.bottom) |
|| (originalEdges.right && originalEdges.top)) { |
dy = -dx; |
} |
else if (originalEdges.left || originalEdges.right) { dy = dx; } |
else if (originalEdges.top || originalEdges.bottom) { dx = dy; } |
} |
// update the 'current' rect without modifications |
if (edges.top ) { current.top += dy; } |
if (edges.bottom) { current.bottom += dy; } |
if (edges.left ) { current.left += dx; } |
if (edges.right ) { current.right += dx; } |
if (invertible) { |
// if invertible, copy the current rect |
extend(restricted, current); |
if (invert === 'reposition') { |
// swap edge values if necessary to keep width/height positive |
var swap; |
if (restricted.top > restricted.bottom) { |
swap = restricted.top; |
restricted.top = restricted.bottom; |
restricted.bottom = swap; |
} |
if (restricted.left > restricted.right) { |
swap = restricted.left; |
restricted.left = restricted.right; |
restricted.right = swap; |
} |
} |
} |
else { |
// if not invertible, restrict to minimum of 0x0 rect |
restricted.top = Math.min(current.top, start.bottom); |
restricted.bottom = Math.max(current.bottom, start.top); |
restricted.left = Math.min(current.left, start.right); |
restricted.right = Math.max(current.right, start.left); |
} |
restricted.width = restricted.right - restricted.left; |
restricted.height = restricted.bottom - restricted.top ; |
for (var edge in restricted) { |
delta[edge] = restricted[edge] - previous[edge]; |
} |
resizeEvent.edges = this.prepared.edges; |
resizeEvent.rect = restricted; |
resizeEvent.deltaRect = delta; |
} |
this.target.fire(resizeEvent); |
return resizeEvent; |
}, |
gestureStart: function (event) { |
var gestureEvent = new InteractEvent(this, event, 'gesture', 'start', this.element); |
gestureEvent.ds = 0; |
this.gesture.startDistance = this.gesture.prevDistance = gestureEvent.distance; |
this.gesture.startAngle = this.gesture.prevAngle = gestureEvent.angle; |
this.gesture.scale = 1; |
this.gesturing = true; |
this.target.fire(gestureEvent); |
return gestureEvent; |
}, |
gestureMove: function (event) { |
if (!this.pointerIds.length) { |
return this.prevEvent; |
} |
var gestureEvent; |
gestureEvent = new InteractEvent(this, event, 'gesture', 'move', this.element); |
gestureEvent.ds = gestureEvent.scale - this.gesture.scale; |
this.target.fire(gestureEvent); |
this.gesture.prevAngle = gestureEvent.angle; |
this.gesture.prevDistance = gestureEvent.distance; |
if (gestureEvent.scale !== Infinity && |
gestureEvent.scale !== null && |
gestureEvent.scale !== undefined && |
!isNaN(gestureEvent.scale)) { |
this.gesture.scale = gestureEvent.scale; |
} |
return gestureEvent; |
}, |
pointerHold: function (pointer, event, eventTarget) { |
this.collectEventTargets(pointer, event, eventTarget, 'hold'); |
}, |
pointerUp: function (pointer, event, eventTarget, curEventTarget) { |
var pointerIndex = this.mouse? 0 : indexOf(this.pointerIds, getPointerId(pointer)); |
clearTimeout(this.holdTimers[pointerIndex]); |
this.collectEventTargets(pointer, event, eventTarget, 'up' ); |
this.collectEventTargets(pointer, event, eventTarget, 'tap'); |
this.pointerEnd(pointer, event, eventTarget, curEventTarget); |
this.removePointer(pointer); |
}, |
pointerCancel: function (pointer, event, eventTarget, curEventTarget) { |
var pointerIndex = this.mouse? 0 : indexOf(this.pointerIds, getPointerId(pointer)); |
clearTimeout(this.holdTimers[pointerIndex]); |
this.collectEventTargets(pointer, event, eventTarget, 'cancel'); |
this.pointerEnd(pointer, event, eventTarget, curEventTarget); |
this.removePointer(pointer); |
}, |
// http://www.quirksmode.org/dom/events/click.html |
// >Events leading to dblclick |
// |
// IE8 doesn't fire down event before dblclick. |
// This workaround tries to fire a tap and doubletap after dblclick |
ie8Dblclick: function (pointer, event, eventTarget) { |
if (this.prevTap |
&& event.clientX === this.prevTap.clientX |
&& event.clientY === this.prevTap.clientY |
&& eventTarget === this.prevTap.target) { |
this.downTargets[0] = eventTarget; |
this.downTimes[0] = new Date().getTime(); |
this.collectEventTargets(pointer, event, eventTarget, 'tap'); |
} |
}, |
// End interact move events and stop auto-scroll unless inertia is enabled |
pointerEnd: function (pointer, event, eventTarget, curEventTarget) { |
var endEvent, |
target = this.target, |
options = target && target.options, |
inertiaOptions = options && this.prepared.name && options[this.prepared.name].inertia, |
inertiaStatus = this.inertiaStatus; |
if (this.interacting()) { |
if (inertiaStatus.active && !inertiaStatus.ending) { return; } |
var pointerSpeed, |
now = new Date().getTime(), |
inertiaPossible = false, |
inertia = false, |
smoothEnd = false, |
endSnap = checkSnap(target, this.prepared.name) && options[this.prepared.name].snap.endOnly, |
endRestrict = checkRestrict(target, this.prepared.name) && options[this.prepared.name].restrict.endOnly, |
dx = 0, |
dy = 0, |
startEvent; |
if (this.dragging) { |
if (options.drag.axis === 'x' ) { pointerSpeed = Math.abs(this.pointerDelta.client.vx); } |
else if (options.drag.axis === 'y' ) { pointerSpeed = Math.abs(this.pointerDelta.client.vy); } |
else /*options.drag.axis === 'xy'*/{ pointerSpeed = this.pointerDelta.client.speed; } |
} |
else { |
pointerSpeed = this.pointerDelta.client.speed; |
} |
// check if inertia should be started |
inertiaPossible = (inertiaOptions && inertiaOptions.enabled |
&& this.prepared.name !== 'gesture' |
&& event !== inertiaStatus.startEvent); |
inertia = (inertiaPossible |
&& (now - this.curCoords.timeStamp) < 50 |
&& pointerSpeed > inertiaOptions.minSpeed |
&& pointerSpeed > inertiaOptions.endSpeed); |
if (inertiaPossible && !inertia && (endSnap || endRestrict)) { |
var snapRestrict = {}; |
snapRestrict.snap = snapRestrict.restrict = snapRestrict; |
if (endSnap) { |
this.setSnapping(this.curCoords.page, snapRestrict); |
if (snapRestrict.locked) { |
dx += snapRestrict.dx; |
dy += snapRestrict.dy; |
} |
} |
if (endRestrict) { |
this.setRestriction(this.curCoords.page, snapRestrict); |
if (snapRestrict.restricted) { |
dx += snapRestrict.dx; |
dy += snapRestrict.dy; |
} |
} |
if (dx || dy) { |
smoothEnd = true; |
} |
} |
if (inertia || smoothEnd) { |
copyCoords(inertiaStatus.upCoords, this.curCoords); |
this.pointers[0] = inertiaStatus.startEvent = startEvent = |
new InteractEvent(this, event, this.prepared.name, 'inertiastart', this.element); |
inertiaStatus.t0 = now; |
target.fire(inertiaStatus.startEvent); |
if (inertia) { |
inertiaStatus.vx0 = this.pointerDelta.client.vx; |
inertiaStatus.vy0 = this.pointerDelta.client.vy; |
inertiaStatus.v0 = pointerSpeed; |
this.calcInertia(inertiaStatus); |
var page = extend({}, this.curCoords.page), |
origin = getOriginXY(target, this.element), |
statusObject; |
page.x = page.x + inertiaStatus.xe - origin.x; |
page.y = page.y + inertiaStatus.ye - origin.y; |
statusObject = { |
useStatusXY: true, |
x: page.x, |
y: page.y, |
dx: 0, |
dy: 0, |
snap: null |
}; |
statusObject.snap = statusObject; |
dx = dy = 0; |
if (endSnap) { |
var snap = this.setSnapping(this.curCoords.page, statusObject); |
if (snap.locked) { |
dx += snap.dx; |
dy += snap.dy; |
} |
} |
if (endRestrict) { |
var restrict = this.setRestriction(this.curCoords.page, statusObject); |
if (restrict.restricted) { |
dx += restrict.dx; |
dy += restrict.dy; |
} |
} |
inertiaStatus.modifiedXe += dx; |
inertiaStatus.modifiedYe += dy; |
inertiaStatus.i = reqFrame(this.boundInertiaFrame); |
} |
else { |
inertiaStatus.smoothEnd = true; |
inertiaStatus.xe = dx; |
inertiaStatus.ye = dy; |
inertiaStatus.sx = inertiaStatus.sy = 0; |
inertiaStatus.i = reqFrame(this.boundSmoothEndFrame); |
} |
inertiaStatus.active = true; |
return; |
} |
if (endSnap || endRestrict) { |
// fire a move event at the snapped coordinates |
this.pointerMove(pointer, event, eventTarget, curEventTarget, true); |
} |
} |
if (this.dragging) { |
endEvent = new InteractEvent(this, event, 'drag', 'end', this.element); |
var draggableElement = this.element, |
drop = this.getDrop(endEvent, event, draggableElement); |
this.dropTarget = drop.dropzone; |
this.dropElement = drop.element; |
var dropEvents = this.getDropEvents(event, endEvent); |
if (dropEvents.leave) { this.prevDropTarget.fire(dropEvents.leave); } |
if (dropEvents.enter) { this.dropTarget.fire(dropEvents.enter); } |
if (dropEvents.drop ) { this.dropTarget.fire(dropEvents.drop ); } |
if (dropEvents.deactivate) { |
this.fireActiveDrops(dropEvents.deactivate); |
} |
target.fire(endEvent); |
} |
else if (this.resizing) { |
endEvent = new InteractEvent(this, event, 'resize', 'end', this.element); |
target.fire(endEvent); |
} |
else if (this.gesturing) { |
endEvent = new InteractEvent(this, event, 'gesture', 'end', this.element); |
target.fire(endEvent); |
} |
this.stop(event); |
}, |
collectDrops: function (element) { |
var drops = [], |
elements = [], |
i; |
element = element || this.element; |
// collect all dropzones and their elements which qualify for a drop |
for (i = 0; i < interactables.length; i++) { |
if (!interactables[i].options.drop.enabled) { continue; } |
var current = interactables[i], |
accept = current.options.drop.accept; |
// test the draggable element against the dropzone's accept setting |
if ((isElement(accept) && accept !== element) |
|| (isString(accept) |
&& !matchesSelector(element, accept))) { |
continue; |
} |
// query for new elements if necessary |
var dropElements = current.selector? current._context.querySelectorAll(current.selector) : [current._element]; |
for (var j = 0, len = dropElements.length; j < len; j++) { |
var currentElement = dropElements[j]; |
if (currentElement === element) { |
continue; |
} |
drops.push(current); |
elements.push(currentElement); |
} |
} |
return { |
dropzones: drops, |
elements: elements |
}; |
}, |
fireActiveDrops: function (event) { |
var i, |
current, |
currentElement, |
prevElement; |
// loop through all active dropzones and trigger event |
for (i = 0; i < this.activeDrops.dropzones.length; i++) { |
current = this.activeDrops.dropzones[i]; |
currentElement = this.activeDrops.elements [i]; |
// prevent trigger of duplicate events on same element |
if (currentElement !== prevElement) { |
// set current element as event target |
event.target = currentElement; |
current.fire(event); |
} |
prevElement = currentElement; |
} |
}, |
// Collect a new set of possible drops and save them in activeDrops. |
// setActiveDrops should always be called when a drag has just started or a |
// drag event happens while dynamicDrop is true |
setActiveDrops: function (dragElement) { |
// get dropzones and their elements that could receive the draggable |
var possibleDrops = this.collectDrops(dragElement, true); |
this.activeDrops.dropzones = possibleDrops.dropzones; |
this.activeDrops.elements = possibleDrops.elements; |
this.activeDrops.rects = []; |
for (var i = 0; i < this.activeDrops.dropzones.length; i++) { |
this.activeDrops.rects[i] = this.activeDrops.dropzones[i].getRect(this.activeDrops.elements[i]); |
} |
}, |
getDrop: function (dragEvent, event, dragElement) { |
var validDrops = []; |
if (dynamicDrop) { |
this.setActiveDrops(dragElement); |
} |
// collect all dropzones and their elements which qualify for a drop |
for (var j = 0; j < this.activeDrops.dropzones.length; j++) { |
var current = this.activeDrops.dropzones[j], |
currentElement = this.activeDrops.elements [j], |
rect = this.activeDrops.rects [j]; |
validDrops.push(current.dropCheck(dragEvent, event, this.target, dragElement, currentElement, rect) |
? currentElement |
: null); |
} |
// get the most appropriate dropzone based on DOM depth and order |
var dropIndex = indexOfDeepestElement(validDrops), |
dropzone = this.activeDrops.dropzones[dropIndex] || null, |
element = this.activeDrops.elements [dropIndex] || null; |
return { |
dropzone: dropzone, |
element: element |
}; |
}, |
getDropEvents: function (pointerEvent, dragEvent) { |
var dropEvents = { |
enter : null, |
leave : null, |
activate : null, |
deactivate: null, |
move : null, |
drop : null |
}; |
if (this.dropElement !== this.prevDropElement) { |
// if there was a prevDropTarget, create a dragleave event |
if (this.prevDropTarget) { |
dropEvents.leave = { |
target : this.prevDropElement, |
dropzone : this.prevDropTarget, |
relatedTarget: dragEvent.target, |
draggable : dragEvent.interactable, |
dragEvent : dragEvent, |
interaction : this, |
timeStamp : dragEvent.timeStamp, |
type : 'dragleave' |
}; |
dragEvent.dragLeave = this.prevDropElement; |
dragEvent.prevDropzone = this.prevDropTarget; |
} |
// if the dropTarget is not null, create a dragenter event |
if (this.dropTarget) { |
dropEvents.enter = { |
target : this.dropElement, |
dropzone : this.dropTarget, |
relatedTarget: dragEvent.target, |
draggable : dragEvent.interactable, |
dragEvent : dragEvent, |
interaction : this, |
timeStamp : dragEvent.timeStamp, |
type : 'dragenter' |
}; |
dragEvent.dragEnter = this.dropElement; |
dragEvent.dropzone = this.dropTarget; |
} |
} |
if (dragEvent.type === 'dragend' && this.dropTarget) { |
dropEvents.drop = { |
target : this.dropElement, |
dropzone : this.dropTarget, |
relatedTarget: dragEvent.target, |
draggable : dragEvent.interactable, |
dragEvent : dragEvent, |
interaction : this, |
timeStamp : dragEvent.timeStamp, |
type : 'drop' |
}; |
dragEvent.dropzone = this.dropTarget; |
} |
if (dragEvent.type === 'dragstart') { |
dropEvents.activate = { |
target : null, |
dropzone : null, |
relatedTarget: dragEvent.target, |
draggable : dragEvent.interactable, |
dragEvent : dragEvent, |
interaction : this, |
timeStamp : dragEvent.timeStamp, |
type : 'dropactivate' |
}; |
} |
if (dragEvent.type === 'dragend') { |
dropEvents.deactivate = { |
target : null, |
dropzone : null, |
relatedTarget: dragEvent.target, |
draggable : dragEvent.interactable, |
dragEvent : dragEvent, |
interaction : this, |
timeStamp : dragEvent.timeStamp, |
type : 'dropdeactivate' |
}; |
} |
if (dragEvent.type === 'dragmove' && this.dropTarget) { |
dropEvents.move = { |
target : this.dropElement, |
dropzone : this.dropTarget, |
relatedTarget: dragEvent.target, |
draggable : dragEvent.interactable, |
dragEvent : dragEvent, |
interaction : this, |
dragmove : dragEvent, |
timeStamp : dragEvent.timeStamp, |
type : 'dropmove' |
}; |
dragEvent.dropzone = this.dropTarget; |
} |
return dropEvents; |
}, |
currentAction: function () { |
return (this.dragging && 'drag') || (this.resizing && 'resize') || (this.gesturing && 'gesture') || null; |
}, |
interacting: function () { |
return this.dragging || this.resizing || this.gesturing; |
}, |
clearTargets: function () { |
this.target = this.element = null; |
this.dropTarget = this.dropElement = this.prevDropTarget = this.prevDropElement = null; |
}, |
stop: function (event) { |
if (this.interacting()) { |
autoScroll.stop(); |
this.matches = []; |
this.matchElements = []; |
var target = this.target; |
if (target.options.styleCursor) { |
target._doc.documentElement.style.cursor = ''; |
} |
// prevent Default only if were previously interacting |
if (event && isFunction(event.preventDefault)) { |
this.checkAndPreventDefault(event, target, this.element); |
} |
if (this.dragging) { |
this.activeDrops.dropzones = this.activeDrops.elements = this.activeDrops.rects = null; |
} |
} |
this.clearTargets(); |
this.pointerIsDown = this.snapStatus.locked = this.dragging = this.resizing = this.gesturing = false; |
this.prepared.name = this.prevEvent = null; |
this.inertiaStatus.resumeDx = this.inertiaStatus.resumeDy = 0; |
// remove pointers if their ID isn't in this.pointerIds |
for (var i = 0; i < this.pointers.length; i++) { |
if (indexOf(this.pointerIds, getPointerId(this.pointers[i])) === -1) { |
this.pointers.splice(i, 1); |
} |
} |
}, |
inertiaFrame: function () { |
var inertiaStatus = this.inertiaStatus, |
options = this.target.options[this.prepared.name].inertia, |
lambda = options.resistance, |
t = new Date().getTime() / 1000 - inertiaStatus.t0; |
if (t < inertiaStatus.te) { |
var progress = 1 - (Math.exp(-lambda * t) - inertiaStatus.lambda_v0) / inertiaStatus.one_ve_v0; |
if (inertiaStatus.modifiedXe === inertiaStatus.xe && inertiaStatus.modifiedYe === inertiaStatus.ye) { |
inertiaStatus.sx = inertiaStatus.xe * progress; |
inertiaStatus.sy = inertiaStatus.ye * progress; |
} |
else { |
var quadPoint = getQuadraticCurvePoint( |
0, 0, |
inertiaStatus.xe, inertiaStatus.ye, |
inertiaStatus.modifiedXe, inertiaStatus.modifiedYe, |
progress); |
inertiaStatus.sx = quadPoint.x; |
inertiaStatus.sy = quadPoint.y; |
} |
this.pointerMove(inertiaStatus.startEvent, inertiaStatus.startEvent); |
inertiaStatus.i = reqFrame(this.boundInertiaFrame); |
} |
else { |
inertiaStatus.ending = true; |
inertiaStatus.sx = inertiaStatus.modifiedXe; |
inertiaStatus.sy = inertiaStatus.modifiedYe; |
this.pointerMove(inertiaStatus.startEvent, inertiaStatus.startEvent); |
this.pointerEnd(inertiaStatus.startEvent, inertiaStatus.startEvent); |
inertiaStatus.active = inertiaStatus.ending = false; |
} |
}, |
smoothEndFrame: function () { |
var inertiaStatus = this.inertiaStatus, |
t = new Date().getTime() - inertiaStatus.t0, |
duration = this.target.options[this.prepared.name].inertia.smoothEndDuration; |
if (t < duration) { |
inertiaStatus.sx = easeOutQuad(t, 0, inertiaStatus.xe, duration); |
inertiaStatus.sy = easeOutQuad(t, 0, inertiaStatus.ye, duration); |
this.pointerMove(inertiaStatus.startEvent, inertiaStatus.startEvent); |
inertiaStatus.i = reqFrame(this.boundSmoothEndFrame); |
} |
else { |
inertiaStatus.ending = true; |
inertiaStatus.sx = inertiaStatus.xe; |
inertiaStatus.sy = inertiaStatus.ye; |
this.pointerMove(inertiaStatus.startEvent, inertiaStatus.startEvent); |
this.pointerEnd(inertiaStatus.startEvent, inertiaStatus.startEvent); |
inertiaStatus.smoothEnd = |
inertiaStatus.active = inertiaStatus.ending = false; |
} |
}, |
addPointer: function (pointer) { |
var id = getPointerId(pointer), |
index = this.mouse? 0 : indexOf(this.pointerIds, id); |
if (index === -1) { |
index = this.pointerIds.length; |
} |
this.pointerIds[index] = id; |
this.pointers[index] = pointer; |
return index; |
}, |
removePointer: function (pointer) { |
var id = getPointerId(pointer), |
index = this.mouse? 0 : indexOf(this.pointerIds, id); |
if (index === -1) { return; } |
this.pointers .splice(index, 1); |
this.pointerIds .splice(index, 1); |
this.downTargets.splice(index, 1); |
this.downTimes .splice(index, 1); |
this.holdTimers .splice(index, 1); |
}, |
recordPointer: function (pointer) { |
var index = this.mouse? 0: indexOf(this.pointerIds, getPointerId(pointer)); |
if (index === -1) { return; } |
this.pointers[index] = pointer; |
}, |
collectEventTargets: function (pointer, event, eventTarget, eventType) { |
var pointerIndex = this.mouse? 0 : indexOf(this.pointerIds, getPointerId(pointer)); |
// do not fire a tap event if the pointer was moved before being lifted |
if (eventType === 'tap' && (this.pointerWasMoved |
// or if the pointerup target is different to the pointerdown target |
|| !(this.downTargets[pointerIndex] && this.downTargets[pointerIndex] === eventTarget))) { |
return; |
} |
var targets = [], |
elements = [], |
element = eventTarget; |
function collectSelectors (interactable, selector, context) { |
var els = ie8MatchesSelector |
? context.querySelectorAll(selector) |
: undefined; |
if (interactable._iEvents[eventType] |
&& isElement(element) |
&& inContext(interactable, element) |
&& !testIgnore(interactable, element, eventTarget) |
&& testAllow(interactable, element, eventTarget) |
&& matchesSelector(element, selector, els)) { |
targets.push(interactable); |
elements.push(element); |
} |
} |
while (element) { |
if (interact.isSet(element) && interact(element)._iEvents[eventType]) { |
targets.push(interact(element)); |
elements.push(element); |
} |
interactables.forEachSelector(collectSelectors); |
element = parentElement(element); |
} |
// create the tap event even if there are no listeners so that |
// doubletap can still be created and fired |
if (targets.length || eventType === 'tap') { |
this.firePointers(pointer, event, eventTarget, targets, elements, eventType); |
} |
}, |
firePointers: function (pointer, event, eventTarget, targets, elements, eventType) { |
var pointerIndex = this.mouse? 0 : indexOf(this.pointerIds, getPointerId(pointer)), |
pointerEvent = {}, |
i, |
// for tap events |
interval, createNewDoubleTap; |
// if it's a doubletap then the event properties would have been |
// copied from the tap event and provided as the pointer argument |
if (eventType === 'doubletap') { |
pointerEvent = pointer; |
} |
else { |
pointerExtend(pointerEvent, event); |
if (event !== pointer) { |
pointerExtend(pointerEvent, pointer); |
} |
pointerEvent.preventDefault = preventOriginalDefault; |
pointerEvent.stopPropagation = InteractEvent.prototype.stopPropagation; |
pointerEvent.stopImmediatePropagation = InteractEvent.prototype.stopImmediatePropagation; |
pointerEvent.interaction = this; |
pointerEvent.timeStamp = new Date().getTime(); |
pointerEvent.originalEvent = event; |
pointerEvent.originalPointer = pointer; |
pointerEvent.type = eventType; |
pointerEvent.pointerId = getPointerId(pointer); |
pointerEvent.pointerType = this.mouse? 'mouse' : !supportsPointerEvent? 'touch' |
: isString(pointer.pointerType) |
? pointer.pointerType |
: [,,'touch', 'pen', 'mouse'][pointer.pointerType]; |
} |
if (eventType === 'tap') { |
pointerEvent.dt = pointerEvent.timeStamp - this.downTimes[pointerIndex]; |
interval = pointerEvent.timeStamp - this.tapTime; |
createNewDoubleTap = !!(this.prevTap && this.prevTap.type !== 'doubletap' |
&& this.prevTap.target === pointerEvent.target |
&& interval < 500); |
pointerEvent.double = createNewDoubleTap; |
this.tapTime = pointerEvent.timeStamp; |
} |
for (i = 0; i < targets.length; i++) { |
pointerEvent.currentTarget = elements[i]; |
pointerEvent.interactable = targets[i]; |
targets[i].fire(pointerEvent); |
if (pointerEvent.immediatePropagationStopped |
||(pointerEvent.propagationStopped && elements[i + 1] !== pointerEvent.currentTarget)) { |
break; |
} |
} |
if (createNewDoubleTap) { |
var doubleTap = {}; |
extend(doubleTap, pointerEvent); |
doubleTap.dt = interval; |
doubleTap.type = 'doubletap'; |
this.collectEventTargets(doubleTap, event, eventTarget, 'doubletap'); |
this.prevTap = doubleTap; |
} |
else if (eventType === 'tap') { |
this.prevTap = pointerEvent; |
} |
}, |
validateSelector: function (pointer, event, matches, matchElements) { |
for (var i = 0, len = matches.length; i < len; i++) { |
var match = matches[i], |
matchElement = matchElements[i], |
action = validateAction(match.getAction(pointer, event, this, matchElement), match); |
if (action && withinInteractionLimit(match, matchElement, action)) { |
this.target = match; |
this.element = matchElement; |
return action; |
} |
} |
}, |
setSnapping: function (pageCoords, status) { |
var snap = this.target.options[this.prepared.name].snap, |
targets = [], |
target, |
page, |
i; |
status = status || this.snapStatus; |
if (status.useStatusXY) { |
page = { x: status.x, y: status.y }; |
} |
else { |
var origin = getOriginXY(this.target, this.element); |
page = extend({}, pageCoords); |
page.x -= origin.x; |
page.y -= origin.y; |
} |
status.realX = page.x; |
status.realY = page.y; |
page.x = page.x - this.inertiaStatus.resumeDx; |
page.y = page.y - this.inertiaStatus.resumeDy; |
var len = snap.targets? snap.targets.length : 0; |
for (var relIndex = 0; relIndex < this.snapOffsets.length; relIndex++) { |
var relative = { |
x: page.x - this.snapOffsets[relIndex].x, |
y: page.y - this.snapOffsets[relIndex].y |
}; |
for (i = 0; i < len; i++) { |
if (isFunction(snap.targets[i])) { |
target = snap.targets[i](relative.x, relative.y, this); |
} |
else { |
target = snap.targets[i]; |
} |
if (!target) { continue; } |
targets.push({ |
x: isNumber(target.x) ? (target.x + this.snapOffsets[relIndex].x) : relative.x, |
y: isNumber(target.y) ? (target.y + this.snapOffsets[relIndex].y) : relative.y, |
range: isNumber(target.range)? target.range: snap.range |
}); |
} |
} |
var closest = { |
target: null, |
inRange: false, |
distance: 0, |
range: 0, |
dx: 0, |
dy: 0 |
}; |
for (i = 0, len = targets.length; i < len; i++) { |
target = targets[i]; |
var range = target.range, |
dx = target.x - page.x, |
dy = target.y - page.y, |
distance = hypot(dx, dy), |
inRange = distance <= range; |
// Infinite targets count as being out of range |
// compared to non infinite ones that are in range |
if (range === Infinity && closest.inRange && closest.range !== Infinity) { |
inRange = false; |
} |
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 |
: (!closest.inRange && distance < closest.distance))) { |
if (range === Infinity) { |
inRange = true; |
} |
closest.target = target; |
closest.distance = distance; |
closest.range = range; |
closest.inRange = inRange; |
closest.dx = dx; |
closest.dy = dy; |
status.range = range; |
} |
} |
var snapChanged; |
if (closest.target) { |
snapChanged = (status.snappedX !== closest.target.x || status.snappedY !== closest.target.y); |
status.snappedX = closest.target.x; |
status.snappedY = closest.target.y; |
} |
else { |
snapChanged = true; |
status.snappedX = NaN; |
status.snappedY = NaN; |
} |
status.dx = closest.dx; |
status.dy = closest.dy; |
status.changed = (snapChanged || (closest.inRange && !status.locked)); |
status.locked = closest.inRange; |
return status; |
}, |
setRestriction: function (pageCoords, status) { |
var target = this.target, |
restrict = target && target.options[this.prepared.name].restrict, |
restriction = restrict && restrict.restriction, |
page; |
if (!restriction) { |
return status; |
} |
status = status || this.restrictStatus; |
page = status.useStatusXY |
? page = { x: status.x, y: status.y } |
: page = extend({}, pageCoords); |
if (status.snap && status.snap.locked) { |
page.x += status.snap.dx || 0; |
page.y += status.snap.dy || 0; |
} |
page.x -= this.inertiaStatus.resumeDx; |
page.y -= this.inertiaStatus.resumeDy; |
status.dx = 0; |
status.dy = 0; |
status.restricted = false; |
var rect, restrictedX, restrictedY; |
if (isString(restriction)) { |
if (restriction === 'parent') { |
restriction = parentElement(this.element); |
} |
else if (restriction === 'self') { |
restriction = target.getRect(this.element); |
} |
else { |
restriction = closest(this.element, restriction); |
} |
if (!restriction) { return status; } |
} |
if (isFunction(restriction)) { |
restriction = restriction(page.x, page.y, this.element); |
} |
if (isElement(restriction)) { |
restriction = getElementRect(restriction); |
} |
rect = restriction; |
if (!restriction) { |
restrictedX = page.x; |
restrictedY = page.y; |
} |
// object is assumed to have |
// x, y, width, height or |
// left, top, right, bottom |
else if ('x' in restriction && 'y' in restriction) { |
restrictedX = Math.max(Math.min(rect.x + rect.width - this.restrictOffset.right , page.x), rect.x + this.restrictOffset.left); |
restrictedY = Math.max(Math.min(rect.y + rect.height - this.restrictOffset.bottom, page.y), rect.y + this.restrictOffset.top ); |
} |
else { |
restrictedX = Math.max(Math.min(rect.right - this.restrictOffset.right , page.x), rect.left + this.restrictOffset.left); |
restrictedY = Math.max(Math.min(rect.bottom - this.restrictOffset.bottom, page.y), rect.top + this.restrictOffset.top ); |
} |
status.dx = restrictedX - page.x; |
status.dy = restrictedY - page.y; |
status.changed = status.restrictedX !== restrictedX || status.restrictedY !== restrictedY; |
status.restricted = !!(status.dx || status.dy); |
status.restrictedX = restrictedX; |
status.restrictedY = restrictedY; |
return status; |
}, |
checkAndPreventDefault: function (event, interactable, element) { |
if (!(interactable = interactable || this.target)) { return; } |
var options = interactable.options, |
prevent = options.preventDefault; |
if (prevent === 'auto' && element && !/^(input|select|textarea)$/i.test(event.target.nodeName)) { |
// do not preventDefault on pointerdown if the prepared action is a drag |
// and dragging can only start from a certain direction - this allows |
// a touch to pan the viewport if a drag isn't in the right direction |
if (/down|start/i.test(event.type) |
&& this.prepared.name === 'drag' && options.drag.axis !== 'xy') { |
return; |
} |
// with manualStart, only preventDefault while interacting |
if (options[this.prepared.name] && options[this.prepared.name].manualStart |
&& !this.interacting()) { |
return; |
} |
event.preventDefault(); |
return; |
} |
if (prevent === 'always') { |
event.preventDefault(); |
return; |
} |
}, |
calcInertia: function (status) { |
var inertiaOptions = this.target.options[this.prepared.name].inertia, |
lambda = inertiaOptions.resistance, |
inertiaDur = -Math.log(inertiaOptions.endSpeed / status.v0) / lambda; |
status.x0 = this.prevEvent.pageX; |
status.y0 = this.prevEvent.pageY; |
status.t0 = status.startEvent.timeStamp / 1000; |
status.sx = status.sy = 0; |
status.modifiedXe = status.xe = (status.vx0 - inertiaDur) / lambda; |
status.modifiedYe = status.ye = (status.vy0 - inertiaDur) / lambda; |
status.te = inertiaDur; |
status.lambda_v0 = lambda / status.v0; |
status.one_ve_v0 = 1 - inertiaOptions.endSpeed / status.v0; |
}, |
autoScrollMove: function (pointer) { |
if (!(this.interacting() |
&& checkAutoScroll(this.target, this.prepared.name))) { |
return; |
} |
if (this.inertiaStatus.active) { |
autoScroll.x = autoScroll.y = 0; |
return; |
} |
var top, |
right, |
bottom, |
left, |
options = this.target.options[this.prepared.name].autoScroll, |
container = options.container || getWindow(this.element); |
if (isWindow(container)) { |
left = pointer.clientX < autoScroll.margin; |
top = pointer.clientY < autoScroll.margin; |
right = pointer.clientX > container.innerWidth - autoScroll.margin; |
bottom = pointer.clientY > container.innerHeight - autoScroll.margin; |
} |
else { |
var rect = getElementClientRect(container); |
left = pointer.clientX < rect.left + autoScroll.margin; |
top = pointer.clientY < rect.top + autoScroll.margin; |
right = pointer.clientX > rect.right - autoScroll.margin; |
bottom = pointer.clientY > rect.bottom - autoScroll.margin; |
} |
autoScroll.x = (right ? 1: left? -1: 0); |
autoScroll.y = (bottom? 1: top? -1: 0); |
if (!autoScroll.isScrolling) { |
// set the autoScroll properties to those of the target |
autoScroll.margin = options.margin; |
autoScroll.speed = options.speed; |
autoScroll.start(this); |
} |
}, |
_updateEventTargets: function (target, currentTarget) { |
this._eventTarget = target; |
this._curEventTarget = currentTarget; |
} |
}; |
function getInteractionFromPointer (pointer, eventType, eventTarget) { |
var i = 0, len = interactions.length, |
mouseEvent = (/mouse/i.test(pointer.pointerType || eventType) |
// MSPointerEvent.MSPOINTER_TYPE_MOUSE |
|| pointer.pointerType === 4), |
interaction; |
var id = getPointerId(pointer); |
// try to resume inertia with a new pointer |
if (/down|start/i.test(eventType)) { |
for (i = 0; i < len; i++) { |
interaction = interactions[i]; |
var element = eventTarget; |
if (interaction.inertiaStatus.active && interaction.target.options[interaction.prepared.name].inertia.allowResume |
&& (interaction.mouse === mouseEvent)) { |
while (element) { |
// if the element is the interaction element |
if (element === interaction.element) { |
return interaction; |
} |
element = parentElement(element); |
} |
} |
} |
} |
// if it's a mouse interaction |
if (mouseEvent || !(supportsTouch || supportsPointerEvent)) { |
// find a mouse interaction that's not in inertia phase |
for (i = 0; i < len; i++) { |
if (interactions[i].mouse && !interactions[i].inertiaStatus.active) { |
return interactions[i]; |
} |
} |
// find any interaction specifically for mouse. |
// if the eventType is a mousedown, and inertia is active |
// ignore the interaction |
for (i = 0; i < len; i++) { |
if (interactions[i].mouse && !(/down/.test(eventType) && interactions[i].inertiaStatus.active)) { |
return interaction; |
} |
} |
// create a new interaction for mouse |
interaction = new Interaction(); |
interaction.mouse = true; |
return interaction; |
} |
// get interaction that has this pointer |
for (i = 0; i < len; i++) { |
if (contains(interactions[i].pointerIds, id)) { |
return interactions[i]; |
} |
} |
// at this stage, a pointerUp should not return an interaction |
if (/up|end|out/i.test(eventType)) { |
return null; |
} |
// get first idle interaction |
for (i = 0; i < len; i++) { |
interaction = interactions[i]; |
if ((!interaction.prepared.name || (interaction.target.options.gesture.enabled)) |
&& !interaction.interacting() |
&& !(!mouseEvent && interaction.mouse)) { |
return interaction; |
} |
} |
return new Interaction(); |
} |
function doOnInteractions (method) { |
return (function (event) { |
var interaction, |
eventTarget = getActualElement(event.path |
? event.path[0] |
: event.target), |
curEventTarget = getActualElement(event.currentTarget), |
i; |
if (supportsTouch && /touch/.test(event.type)) { |
prevTouchTime = new Date().getTime(); |
for (i = 0; i < event.changedTouches.length; i++) { |
var pointer = event.changedTouches[i]; |
interaction = getInteractionFromPointer(pointer, event.type, eventTarget); |
if (!interaction) { continue; } |
interaction._updateEventTargets(eventTarget, curEventTarget); |
interaction[method](pointer, event, eventTarget, curEventTarget); |
} |
} |
else { |
if (!supportsPointerEvent && /mouse/.test(event.type)) { |
// ignore mouse events while touch interactions are active |
for (i = 0; i < interactions.length; i++) { |
if (!interactions[i].mouse && interactions[i].pointerIsDown) { |
return; |
} |
} |
// try to ignore mouse events that are simulated by the browser |
// after a touch event |
if (new Date().getTime() - prevTouchTime < 500) { |
return; |
} |
} |
interaction = getInteractionFromPointer(event, event.type, eventTarget); |
if (!interaction) { return; } |
interaction._updateEventTargets(eventTarget, curEventTarget); |
interaction[method](event, event, eventTarget, curEventTarget); |
} |
}); |
} |
function InteractEvent (interaction, event, action, phase, element, related) { |
var client, |
page, |
target = interaction.target, |
snapStatus = interaction.snapStatus, |
restrictStatus = interaction.restrictStatus, |
pointers = interaction.pointers, |
deltaSource = (target && target.options || defaultOptions).deltaSource, |
sourceX = deltaSource + 'X', |
sourceY = deltaSource + 'Y', |
options = target? target.options: defaultOptions, |
origin = getOriginXY(target, element), |
starting = phase === 'start', |
ending = phase === 'end', |
coords = starting? interaction.startCoords : interaction.curCoords; |
element = element || interaction.element; |
page = extend({}, coords.page); |
client = extend({}, coords.client); |
page.x -= origin.x; |
page.y -= origin.y; |
client.x -= origin.x; |
client.y -= origin.y; |
var relativePoints = options[action].snap && options[action].snap.relativePoints ; |
if (checkSnap(target, action) && !(starting && relativePoints && relativePoints.length)) { |
this.snap = { |
range : snapStatus.range, |
locked : snapStatus.locked, |
x : snapStatus.snappedX, |
y : snapStatus.snappedY, |
realX : snapStatus.realX, |
realY : snapStatus.realY, |
dx : snapStatus.dx, |
dy : snapStatus.dy |
}; |
if (snapStatus.locked) { |
page.x += snapStatus.dx; |
page.y += snapStatus.dy; |
client.x += snapStatus.dx; |
client.y += snapStatus.dy; |
} |
} |
if (checkRestrict(target, action) && !(starting && options[action].restrict.elementRect) && restrictStatus.restricted) { |
page.x += restrictStatus.dx; |
page.y += restrictStatus.dy; |
client.x += restrictStatus.dx; |
client.y += restrictStatus.dy; |
this.restrict = { |
dx: restrictStatus.dx, |
dy: restrictStatus.dy |
}; |
} |
this.pageX = page.x; |
this.pageY = page.y; |
this.clientX = client.x; |
this.clientY = client.y; |
this.x0 = interaction.startCoords.page.x - origin.x; |
this.y0 = interaction.startCoords.page.y - origin.y; |
this.clientX0 = interaction.startCoords.client.x - origin.x; |
this.clientY0 = interaction.startCoords.client.y - origin.y; |
this.ctrlKey = event.ctrlKey; |
this.altKey = event.altKey; |
this.shiftKey = event.shiftKey; |
this.metaKey = event.metaKey; |
this.button = event.button; |
this.buttons = event.buttons; |
this.target = element; |
this.t0 = interaction.downTimes[0]; |
this.type = action + (phase || ''); |
this.interaction = interaction; |
this.interactable = target; |
var inertiaStatus = interaction.inertiaStatus; |
if (inertiaStatus.active) { |
this.detail = 'inertia'; |
} |
if (related) { |
this.relatedTarget = related; |
} |
// end event dx, dy is difference between start and end points |
if (ending) { |
if (deltaSource === 'client') { |
this.dx = client.x - interaction.startCoords.client.x; |
this.dy = client.y - interaction.startCoords.client.y; |
} |
else { |
this.dx = page.x - interaction.startCoords.page.x; |
this.dy = page.y - interaction.startCoords.page.y; |
} |
} |
else if (starting) { |
this.dx = 0; |
this.dy = 0; |
} |
// copy properties from previousmove if starting inertia |
else if (phase === 'inertiastart') { |
this.dx = interaction.prevEvent.dx; |
this.dy = interaction.prevEvent.dy; |
} |
else { |
if (deltaSource === 'client') { |
this.dx = client.x - interaction.prevEvent.clientX; |
this.dy = client.y - interaction.prevEvent.clientY; |
} |
else { |
this.dx = page.x - interaction.prevEvent.pageX; |
this.dy = page.y - interaction.prevEvent.pageY; |
} |
} |
if (interaction.prevEvent && interaction.prevEvent.detail === 'inertia' |
&& !inertiaStatus.active |
&& options[action].inertia && options[action].inertia.zeroResumeDelta) { |
inertiaStatus.resumeDx += this.dx; |
inertiaStatus.resumeDy += this.dy; |
this.dx = this.dy = 0; |
} |
if (action === 'resize' && interaction.resizeAxes) { |
if (options.resize.square) { |
if (interaction.resizeAxes === 'y') { |
this.dx = this.dy; |
} |
else { |
this.dy = this.dx; |
} |
this.axes = 'xy'; |
} |
else { |
this.axes = interaction.resizeAxes; |
if (interaction.resizeAxes === 'x') { |
this.dy = 0; |
} |
else if (interaction.resizeAxes === 'y') { |
this.dx = 0; |
} |
} |
} |
else if (action === 'gesture') { |
this.touches = [pointers[0], pointers[1]]; |
if (starting) { |
this.distance = touchDistance(pointers, deltaSource); |
this.box = touchBBox(pointers); |
this.scale = 1; |
this.ds = 0; |
this.angle = touchAngle(pointers, undefined, deltaSource); |
this.da = 0; |
} |
else if (ending || event instanceof InteractEvent) { |
this.distance = interaction.prevEvent.distance; |
this.box = interaction.prevEvent.box; |
this.scale = interaction.prevEvent.scale; |
this.ds = this.scale - 1; |
this.angle = interaction.prevEvent.angle; |
this.da = this.angle - interaction.gesture.startAngle; |
} |
else { |
this.distance = touchDistance(pointers, deltaSource); |
this.box = touchBBox(pointers); |
this.scale = this.distance / interaction.gesture.startDistance; |
this.angle = touchAngle(pointers, interaction.gesture.prevAngle, deltaSource); |
this.ds = this.scale - interaction.gesture.prevScale; |
this.da = this.angle - interaction.gesture.prevAngle; |
} |
} |
if (starting) { |
this.timeStamp = interaction.downTimes[0]; |
this.dt = 0; |
this.duration = 0; |
this.speed = 0; |
this.velocityX = 0; |
this.velocityY = 0; |
} |
else if (phase === 'inertiastart') { |
this.timeStamp = interaction.prevEvent.timeStamp; |
this.dt = interaction.prevEvent.dt; |
this.duration = interaction.prevEvent.duration; |
this.speed = interaction.prevEvent.speed; |
this.velocityX = interaction.prevEvent.velocityX; |
this.velocityY = interaction.prevEvent.velocityY; |
} |
else { |
this.timeStamp = new Date().getTime(); |
this.dt = this.timeStamp - interaction.prevEvent.timeStamp; |
this.duration = this.timeStamp - interaction.downTimes[0]; |
if (event instanceof InteractEvent) { |
var dx = this[sourceX] - interaction.prevEvent[sourceX], |
dy = this[sourceY] - interaction.prevEvent[sourceY], |
dt = this.dt / 1000; |
this.speed = hypot(dx, dy) / dt; |
this.velocityX = dx / dt; |
this.velocityY = dy / dt; |
} |
// if normal move or end event, use previous user event coords |
else { |
// speed and velocity in pixels per second |
this.speed = interaction.pointerDelta[deltaSource].speed; |
this.velocityX = interaction.pointerDelta[deltaSource].vx; |
this.velocityY = interaction.pointerDelta[deltaSource].vy; |
} |
} |
if ((ending || phase === 'inertiastart') |
&& interaction.prevEvent.speed > 600 && this.timeStamp - interaction.prevEvent.timeStamp < 150) { |
var angle = 180 * Math.atan2(interaction.prevEvent.velocityY, interaction.prevEvent.velocityX) / Math.PI, |
overlap = 22.5; |
if (angle < 0) { |
angle += 360; |
} |
var left = 135 - overlap <= angle && angle < 225 + overlap, |
up = 225 - overlap <= angle && angle < 315 + overlap, |
right = !left && (315 - overlap <= angle || angle < 45 + overlap), |
down = !up && 45 - overlap <= angle && angle < 135 + overlap; |
this.swipe = { |
up : up, |
down : down, |
left : left, |
right: right, |
angle: angle, |
speed: interaction.prevEvent.speed, |
velocity: { |
x: interaction.prevEvent.velocityX, |
y: interaction.prevEvent.velocityY |
} |
}; |
} |
} |
InteractEvent.prototype = { |
preventDefault: blank, |
stopImmediatePropagation: function () { |
this.immediatePropagationStopped = this.propagationStopped = true; |
}, |
stopPropagation: function () { |
this.propagationStopped = true; |
} |
}; |
function preventOriginalDefault () { |
this.originalEvent.preventDefault(); |
} |
function getActionCursor (action) { |
var cursor = ''; |
if (action.name === 'drag') { |
cursor = actionCursors.drag; |
} |
if (action.name === 'resize') { |
if (action.axis) { |
cursor = actionCursors[action.name + action.axis]; |
} |
else if (action.edges) { |
var cursorKey = 'resize', |
edgeNames = ['top', 'bottom', 'left', 'right']; |
for (var i = 0; i < 4; i++) { |
if (action.edges[edgeNames[i]]) { |
cursorKey += edgeNames[i]; |
} |
} |
cursor = actionCursors[cursorKey]; |
} |
} |
return cursor; |
} |
function checkResizeEdge (name, value, page, element, interactableElement, rect, margin) { |
// false, '', undefined, null |
if (!value) { return false; } |
// true value, use pointer coords and element rect |
if (value === true) { |
// if dimensions are negative, "switch" edges |
var width = isNumber(rect.width)? rect.width : rect.right - rect.left, |
height = isNumber(rect.height)? rect.height : rect.bottom - rect.top; |
if (width < 0) { |
if (name === 'left' ) { name = 'right'; } |
else if (name === 'right') { name = 'left' ; } |
} |
if (height < 0) { |
if (name === 'top' ) { name = 'bottom'; } |
else if (name === 'bottom') { name = 'top' ; } |
} |
if (name === 'left' ) { return page.x < ((width >= 0? rect.left: rect.right ) + margin); } |
if (name === 'top' ) { return page.y < ((height >= 0? rect.top : rect.bottom) + margin); } |
if (name === 'right' ) { return page.x > ((width >= 0? rect.right : rect.left) - margin); } |
if (name === 'bottom') { return page.y > ((height >= 0? rect.bottom: rect.top ) - margin); } |
} |
// the remaining checks require an element |
if (!isElement(element)) { return false; } |
return isElement(value) |
// the value is an element to use as a resize handle |
? value === element |
// otherwise check if element matches value as selector |
: matchesUpTo(element, value, interactableElement); |
} |
function defaultActionChecker (pointer, interaction, element) { |
var rect = this.getRect(element), |
shouldResize = false, |
action = null, |
resizeAxes = null, |
resizeEdges, |
page = extend({}, interaction.curCoords.page), |
options = this.options; |
if (!rect) { return null; } |
if (actionIsEnabled.resize && options.resize.enabled) { |
var resizeOptions = options.resize; |
resizeEdges = { |
left: false, right: false, top: false, bottom: false |
}; |
// if using resize.edges |
if (isObject(resizeOptions.edges)) { |
for (var edge in resizeEdges) { |
resizeEdges[edge] = checkResizeEdge(edge, |
resizeOptions.edges[edge], |
page, |
interaction._eventTarget, |
element, |
rect, |
resizeOptions.margin || margin); |
} |
resizeEdges.left = resizeEdges.left && !resizeEdges.right; |
resizeEdges.top = resizeEdges.top && !resizeEdges.bottom; |
shouldResize = resizeEdges.left || resizeEdges.right || resizeEdges.top || resizeEdges.bottom; |
} |
else { |
var right = options.resize.axis !== 'y' && page.x > (rect.right - margin), |
bottom = options.resize.axis !== 'x' && page.y > (rect.bottom - margin); |
shouldResize = right || bottom; |
resizeAxes = (right? 'x' : '') + (bottom? 'y' : ''); |
} |
} |
action = shouldResize |
? 'resize' |
: actionIsEnabled.drag && options.drag.enabled |
? 'drag' |
: null; |
if (actionIsEnabled.gesture |
&& interaction.pointerIds.length >=2 |
&& !(interaction.dragging || interaction.resizing)) { |
action = 'gesture'; |
} |
if (action) { |
return { |
name: action, |
axis: resizeAxes, |
edges: resizeEdges |
}; |
} |
return null; |
} |
// Check if action is enabled globally and the current target supports it |
// If so, return the validated action. Otherwise, return null |
function validateAction (action, interactable) { |
if (!isObject(action)) { return null; } |
var actionName = action.name, |
options = interactable.options; |
if (( (actionName === 'resize' && options.resize.enabled ) |
|| (actionName === 'drag' && options.drag.enabled ) |
|| (actionName === 'gesture' && options.gesture.enabled)) |
&& actionIsEnabled[actionName]) { |
if (actionName === 'resize' || actionName === 'resizeyx') { |
actionName = 'resizexy'; |
} |
return action; |
} |
return null; |
} |
var listeners = {}, |
interactionListeners = [ |
'dragStart', 'dragMove', 'resizeStart', 'resizeMove', 'gestureStart', 'gestureMove', |
'pointerOver', 'pointerOut', 'pointerHover', 'selectorDown', |
'pointerDown', 'pointerMove', 'pointerUp', 'pointerCancel', 'pointerEnd', |
'addPointer', 'removePointer', 'recordPointer', 'autoScrollMove' |
]; |
for (var i = 0, len = interactionListeners.length; i < len; i++) { |
var name = interactionListeners[i]; |
listeners[name] = doOnInteractions(name); |
} |
// bound to the interactable context when a DOM event |
// listener is added to a selector interactable |
function delegateListener (event, useCapture) { |
var fakeEvent = {}, |
delegated = delegatedEvents[event.type], |
eventTarget = getActualElement(event.path |
? event.path[0] |
: event.target), |
element = eventTarget; |
useCapture = useCapture? true: false; |
// duplicate the event so that currentTarget can be changed |
for (var prop in event) { |
fakeEvent[prop] = event[prop]; |
} |
fakeEvent.originalEvent = event; |
fakeEvent.preventDefault = preventOriginalDefault; |
// climb up document tree looking for selector matches |
while (isElement(element)) { |
for (var i = 0; i < delegated.selectors.length; i++) { |
var selector = delegated.selectors[i], |
context = delegated.contexts[i]; |
if (matchesSelector(element, selector) |
&& nodeContains(context, eventTarget) |
&& nodeContains(context, element)) { |
var listeners = delegated.listeners[i]; |
fakeEvent.currentTarget = element; |
for (var j = 0; j < listeners.length; j++) { |
if (listeners[j][1] === useCapture) { |
listeners[j][0](fakeEvent); |
} |
} |
} |
} |
element = parentElement(element); |
} |
} |
function delegateUseCapture (event) { |
return delegateListener.call(this, event, true); |
} |
interactables.indexOfElement = function indexOfElement (element, context) { |
context = context || document; |
for (var i = 0; i < this.length; i++) { |
var interactable = this[i]; |
if ((interactable.selector === element |
&& (interactable._context === context)) |
|| (!interactable.selector && interactable._element === element)) { |
return i; |
} |
} |
return -1; |
}; |
interactables.get = function interactableGet (element, options) { |
return this[this.indexOfElement(element, options && options.context)]; |
}; |
interactables.forEachSelector = function (callback) { |
for (var i = 0; i < this.length; i++) { |
var interactable = this[i]; |
if (!interactable.selector) { |
continue; |
} |
var ret = callback(interactable, interactable.selector, interactable._context, i, this); |
if (ret !== undefined) { |
return ret; |
} |
} |
}; |
/*\ |
* interact |
[ method ] |
* |
* The methods of this variable can be used to set elements as |
* interactables and also to change various default settings. |
* |
* Calling it as a function and passing an element or a valid CSS selector |
* string returns an Interactable object which has various methods to |
* configure it. |
* |
- element (Element | string) The HTML or SVG Element to interact with or CSS selector |
= (object) An @Interactable |
* |
> Usage |
| interact(document.getElementById('draggable')).draggable(true); |
| |
| var rectables = interact('rect'); |
| rectables |
| .gesturable(true) |
| .on('gesturemove', function (event) { |
| // something cool... |
| }) |
| .autoScroll(true); |
\*/ |
function interact (element, options) { |
return interactables.get(element, options) || new Interactable(element, options); |
} |
/*\ |
* Interactable |
[ property ] |
** |
* Object type returned by @interact |
\*/ |
function Interactable (element, options) { |
this._element = element; |
this._iEvents = this._iEvents || {}; |
var _window; |
if (trySelector(element)) { |
this.selector = element; |
var context = options && options.context; |
_window = context? getWindow(context) : window; |
if (context && (_window.Node |
? context instanceof _window.Node |
: (isElement(context) || context === _window.document))) { |
this._context = context; |
} |
} |
else { |
_window = getWindow(element); |
if (isElement(element, _window)) { |
if (supportsPointerEvent) { |
events.add(this._element, pEventTypes.down, listeners.pointerDown ); |
events.add(this._element, pEventTypes.move, listeners.pointerHover); |
} |
else { |
events.add(this._element, 'mousedown' , listeners.pointerDown ); |
events.add(this._element, 'mousemove' , listeners.pointerHover); |
events.add(this._element, 'touchstart', listeners.pointerDown ); |
events.add(this._element, 'touchmove' , listeners.pointerHover); |
} |
} |
} |
this._doc = _window.document; |
if (!contains(documents, this._doc)) { |
listenToDocument(this._doc); |
} |
interactables.push(this); |
this.set(options); |
} |
Interactable.prototype = { |
setOnEvents: function (action, phases) { |
if (action === 'drop') { |
if (isFunction(phases.ondrop) ) { this.ondrop = phases.ondrop ; } |
if (isFunction(phases.ondropactivate) ) { this.ondropactivate = phases.ondropactivate ; } |
if (isFunction(phases.ondropdeactivate)) { this.ondropdeactivate = phases.ondropdeactivate; } |
if (isFunction(phases.ondragenter) ) { this.ondragenter = phases.ondragenter ; } |
if (isFunction(phases.ondragleave) ) { this.ondragleave = phases.ondragleave ; } |
if (isFunction(phases.ondropmove) ) { this.ondropmove = phases.ondropmove ; } |
} |
else { |
action = 'on' + action; |
if (isFunction(phases.onstart) ) { this[action + 'start' ] = phases.onstart ; } |
if (isFunction(phases.onmove) ) { this[action + 'move' ] = phases.onmove ; } |
if (isFunction(phases.onend) ) { this[action + 'end' ] = phases.onend ; } |
if (isFunction(phases.oninertiastart)) { this[action + 'inertiastart' ] = phases.oninertiastart ; } |
} |
return this; |
}, |
/*\ |
* Interactable.draggable |
[ method ] |
* |
* Gets or sets whether drag actions can be performed on the |
* Interactable |
* |
= (boolean) Indicates if this can be the target of drag events |
| var isDraggable = interact('ul li').draggable(); |
* or |
- options (boolean | object) #optional true/false or An object with event listeners to be fired on drag events (object makes the Interactable draggable) |
= (object) This Interactable |
| interact(element).draggable({ |
| onstart: function (event) {}, |
| onmove : function (event) {}, |
| onend : function (event) {}, |
| |
| // the axis in which the first movement must be |
| // for the drag sequence to start |
| // 'xy' by default - any direction |
| axis: 'x' || 'y' || 'xy', |
| |
| // max number of drags that can happen concurrently |
| // with elements of this Interactable. Infinity by default |
| max: Infinity, |
| |
| // max number of drags that can target the same element+Interactable |
| // 1 by default |
| maxPerElement: 2 |
| }); |
\*/ |
draggable: function (options) { |
if (isObject(options)) { |
this.options.drag.enabled = options.enabled === false? false: true; |
this.setPerAction('drag', options); |
this.setOnEvents('drag', options); |
if (/^x$|^y$|^xy$/.test(options.axis)) { |
this.options.drag.axis = options.axis; |
} |
else if (options.axis === null) { |
delete this.options.drag.axis; |
} |
return this; |
} |
if (isBool(options)) { |
this.options.drag.enabled = options; |
return this; |
} |
return this.options.drag; |
}, |
setPerAction: function (action, options) { |
// for all the default per-action options |
for (var option in options) { |
// if this option exists for this action |
if (option in defaultOptions[action]) { |
// if the option in the options arg is an object value |
if (isObject(options[option])) { |
// duplicate the object |
this.options[action][option] = extend(this.options[action][option] || {}, options[option]); |
if (isObject(defaultOptions.perAction[option]) && 'enabled' in defaultOptions.perAction[option]) { |
this.options[action][option].enabled = options[option].enabled === false? false : true; |
} |
} |
else if (isBool(options[option]) && isObject(defaultOptions.perAction[option])) { |
this.options[action][option].enabled = options[option]; |
} |
else if (options[option] !== undefined) { |
// or if it's not undefined, do a plain assignment |
this.options[action][option] = options[option]; |
} |
} |
} |
}, |
/*\ |
* Interactable.dropzone |
[ method ] |
* |
* Returns or sets whether elements can be dropped onto this |
* Interactable to trigger drop events |
* |
* Dropzones can receive the following events: |
* - `dropactivate` and `dropdeactivate` when an acceptable drag starts and ends |
* - `dragenter` and `dragleave` when a draggable enters and leaves the dropzone |
* - `dragmove` when a draggable that has entered the dropzone is moved |
* - `drop` when a draggable is dropped into this dropzone |
* |
* Use the `accept` option to allow only elements that match the given CSS selector or element. |
* |
* Use the `overlap` option to set how drops are checked for. The allowed values are: |
* - `'pointer'`, the pointer must be over the dropzone (default) |
* - `'center'`, the draggable element's center must be over the dropzone |
* - a number from 0-1 which is the `(intersection area) / (draggable area)`. |
* e.g. `0.5` for drop to happen when half of the area of the |
* draggable is over the dropzone |
* |
- options (boolean | object | null) #optional The new value to be set. |
| interact('.drop').dropzone({ |
| accept: '.can-drop' || document.getElementById('single-drop'), |
| overlap: 'pointer' || 'center' || zeroToOne |
| } |
= (boolean | object) The current setting or this Interactable |
\*/ |
dropzone: function (options) { |
if (isObject(options)) { |
this.options.drop.enabled = options.enabled === false? false: true; |
this.setOnEvents('drop', options); |
if (/^(pointer|center)$/.test(options.overlap)) { |
this.options.drop.overlap = options.overlap; |
} |
else if (isNumber(options.overlap)) { |
this.options.drop.overlap = Math.max(Math.min(1, options.overlap), 0); |
} |
if ('accept' in options) { |
this.options.drop.accept = options.accept; |
} |
if ('checker' in options) { |
this.options.drop.checker = options.checker; |
} |
return this; |
} |
if (isBool(options)) { |
this.options.drop.enabled = options; |
return this; |
} |
return this.options.drop; |
}, |
dropCheck: function (dragEvent, event, draggable, draggableElement, dropElement, rect) { |
var dropped = false; |
// if the dropzone has no rect (eg. display: none) |
// call the custom dropChecker or just return false |
if (!(rect = rect || this.getRect(dropElement))) { |
return (this.options.drop.checker |
? this.options.drop.checker(dragEvent, event, dropped, this, dropElement, draggable, draggableElement) |
: false); |
} |
var dropOverlap = this.options.drop.overlap; |
if (dropOverlap === 'pointer') { |
var page = getPageXY(dragEvent), |
origin = getOriginXY(draggable, draggableElement), |
horizontal, |
vertical; |
page.x += origin.x; |
page.y += origin.y; |
horizontal = (page.x > rect.left) && (page.x < rect.right); |
vertical = (page.y > rect.top ) && (page.y < rect.bottom); |
dropped = horizontal && vertical; |
} |
var dragRect = draggable.getRect(draggableElement); |
if (dropOverlap === 'center') { |
var cx = dragRect.left + dragRect.width / 2, |
cy = dragRect.top + dragRect.height / 2; |
dropped = cx >= rect.left && cx <= rect.right && cy >= rect.top && cy <= rect.bottom; |
} |
if (isNumber(dropOverlap)) { |
var overlapArea = (Math.max(0, Math.min(rect.right , dragRect.right ) - Math.max(rect.left, dragRect.left)) |
* Math.max(0, Math.min(rect.bottom, dragRect.bottom) - Math.max(rect.top , dragRect.top ))), |
overlapRatio = overlapArea / (dragRect.width * dragRect.height); |
dropped = overlapRatio >= dropOverlap; |
} |
if (this.options.drop.checker) { |
dropped = this.options.drop.checker(dragEvent, event, dropped, this, dropElement, draggable, draggableElement); |
} |
return dropped; |
}, |
/*\ |
* Interactable.dropChecker |
[ method ] |
* |
* DEPRECATED. Use interactable.dropzone({ checker: function... }) instead. |
* |
* Gets or sets the function used to check if a dragged element is |
* over this Interactable. |
* |
- checker (function) #optional The function that will be called when checking for a drop |
= (Function | Interactable) The checker function or this Interactable |
* |
* The checker function takes the following arguments: |
* |
- dragEvent (InteractEvent) The related dragmove or dragend event |
- event (TouchEvent | PointerEvent | MouseEvent) The user move/up/end Event related to the dragEvent |
- dropped (boolean) The value from the default drop checker |
- dropzone (Interactable) The dropzone interactable |
- dropElement (Element) The dropzone element |
- draggable (Interactable) The Interactable being dragged |
- draggableElement (Element) The actual element that's being dragged |
* |
> Usage: |
| interact(target) |
| .dropChecker(function(dragEvent, // related dragmove or dragend event |
| event, // TouchEvent/PointerEvent/MouseEvent |
| dropped, // bool result of the default checker |
| dropzone, // dropzone Interactable |
| dropElement, // dropzone elemnt |
| draggable, // draggable Interactable |
| draggableElement) {// draggable element |
| |
| return dropped && event.target.hasAttribute('allow-drop'); |
| } |
\*/ |
dropChecker: function (checker) { |
if (isFunction(checker)) { |
this.options.drop.checker = checker; |
return this; |
} |
if (checker === null) { |
delete this.options.getRect; |
return this; |
} |
return this.options.drop.checker; |
}, |
/*\ |
* Interactable.accept |
[ method ] |
* |
* Deprecated. add an `accept` property to the options object passed to |
* @Interactable.dropzone instead. |
* |
* Gets or sets the Element or CSS selector match that this |
* Interactable accepts if it is a dropzone. |
* |
- newValue (Element | string | null) #optional |
* If it is an Element, then only that element can be dropped into this dropzone. |
* If it is a string, the element being dragged must match it as a selector. |
* If it is null, the accept options is cleared - it accepts any element. |
* |
= (string | Element | null | Interactable) The current accept option if given `undefined` or this Interactable |
\*/ |
accept: function (newValue) { |
if (isElement(newValue)) { |
this.options.drop.accept = newValue; |
return this; |
} |
// test if it is a valid CSS selector |
if (trySelector(newValue)) { |
this.options.drop.accept = newValue; |
return this; |
} |
if (newValue === null) { |
delete this.options.drop.accept; |
return this; |
} |
return this.options.drop.accept; |
}, |
/*\ |
* Interactable.resizable |
[ method ] |
* |
* Gets or sets whether resize actions can be performed on the |
* Interactable |
* |
= (boolean) Indicates if this can be the target of resize elements |
| var isResizeable = interact('input[type=text]').resizable(); |
* or |
- options (boolean | object) #optional true/false or An object with event listeners to be fired on resize events (object makes the Interactable resizable) |
= (object) This Interactable |
| interact(element).resizable({ |
| onstart: function (event) {}, |
| onmove : function (event) {}, |
| onend : function (event) {}, |
| |
| edges: { |
| top : true, // Use pointer coords to check for resize. |
| left : false, // Disable resizing from left edge. |
| bottom: '.resize-s',// Resize if pointer target matches selector |
| right : handleEl // Resize if pointer target is the given Element |
| }, |
| |
| // Width and height can be adjusted independently. When `true`, width and |
| // height are adjusted at a 1:1 ratio. |
| square: false, |
| |
| // Width and height can be adjusted independently. When `true`, width and |
| // height maintain the aspect ratio they had when resizing started. |
| preserveAspectRatio: false, |
| |
| // a value of 'none' will limit the resize rect to a minimum of 0x0 |
| // 'negate' will allow the rect to have negative width/height |
| // 'reposition' will keep the width/height positive by swapping |
| // the top and bottom edges and/or swapping the left and right edges |
| invert: 'none' || 'negate' || 'reposition' |
| |
| // limit multiple resizes. |
| // See the explanation in the @Interactable.draggable example |
| max: Infinity, |
| maxPerElement: 1, |
| }); |
\*/ |
resizable: function (options) { |
if (isObject(options)) { |
this.options.resize.enabled = options.enabled === false? false: true; |
this.setPerAction('resize', options); |
this.setOnEvents('resize', options); |
if (/^x$|^y$|^xy$/.test(options.axis)) { |
this.options.resize.axis = options.axis; |
} |
else if (options.axis === null) { |
this.options.resize.axis = defaultOptions.resize.axis; |
} |
if (isBool(options.preserveAspectRatio)) { |
this.options.resize.preserveAspectRatio = options.preserveAspectRatio; |
} |
else if (isBool(options.square)) { |
this.options.resize.square = options.square; |
} |
return this; |
} |
if (isBool(options)) { |
this.options.resize.enabled = options; |
return this; |
} |
return this.options.resize; |
}, |
/*\ |
* Interactable.squareResize |
[ method ] |
* |
* Deprecated. Add a `square: true || false` property to @Interactable.resizable instead |
* |
* Gets or sets whether resizing is forced 1:1 aspect |
* |
= (boolean) Current setting |
* |
* or |
* |
- newValue (boolean) #optional |
= (object) this Interactable |
\*/ |
squareResize: function (newValue) { |
if (isBool(newValue)) { |
this.options.resize.square = newValue; |
return this; |
} |
if (newValue === null) { |
delete this.options.resize.square; |
return this; |
} |
return this.options.resize.square; |
}, |
/*\ |
* Interactable.gesturable |
[ method ] |
* |
* Gets or sets whether multitouch gestures can be performed on the |
* Interactable's element |
* |
= (boolean) Indicates if this can be the target of gesture events |
| var isGestureable = interact(element).gesturable(); |
* or |
- options (boolean | object) #optional true/false or An object with event listeners to be fired on gesture events (makes the Interactable gesturable) |
= (object) this Interactable |
| interact(element).gesturable({ |
| onstart: function (event) {}, |
| onmove : function (event) {}, |
| onend : function (event) {}, |
| |
| // limit multiple gestures. |
| // See the explanation in @Interactable.draggable example |
| max: Infinity, |
| maxPerElement: 1, |
| }); |
\*/ |
gesturable: function (options) { |
if (isObject(options)) { |
this.options.gesture.enabled = options.enabled === false? false: true; |
this.setPerAction('gesture', options); |
this.setOnEvents('gesture', options); |
return this; |
} |
if (isBool(options)) { |
this.options.gesture.enabled = options; |
return this; |
} |
return this.options.gesture; |
}, |
/*\ |
* Interactable.autoScroll |
[ method ] |
** |
* Deprecated. Add an `autoscroll` property to the options object |
* passed to @Interactable.draggable or @Interactable.resizable instead. |
* |
* Returns or sets whether dragging and resizing near the edges of the |
* window/container trigger autoScroll for this Interactable |
* |
= (object) Object with autoScroll properties |
* |
* or |
* |
- options (object | boolean) #optional |
* options can be: |
* - an object with margin, distance and interval properties, |
* - true or false to enable or disable autoScroll or |
= (Interactable) this Interactable |
\*/ |
autoScroll: function (options) { |
if (isObject(options)) { |
options = extend({ actions: ['drag', 'resize']}, options); |
} |
else if (isBool(options)) { |
options = { actions: ['drag', 'resize'], enabled: options }; |
} |
return this.setOptions('autoScroll', options); |
}, |
/*\ |
* Interactable.snap |
[ method ] |
** |
* Deprecated. Add a `snap` property to the options object passed |
* to @Interactable.draggable or @Interactable.resizable instead. |
* |
* Returns or sets if and how action coordinates are snapped. By |
* default, snapping is relative to the pointer coordinates. You can |
* change this by setting the |
* [`elementOrigin`](https://github.com/taye/interact.js/pull/72). |
** |
= (boolean | object) `false` if snap is disabled; object with snap properties if snap is enabled |
** |
* or |
** |
- options (object | boolean | null) #optional |
= (Interactable) this Interactable |
> Usage |
| interact(document.querySelector('#thing')).snap({ |
| targets: [ |
| // snap to this specific point |
| { |
| x: 100, |
| y: 100, |
| range: 25 |
| }, |
| // give this function the x and y page coords and snap to the object returned |
| function (x, y) { |
| return { |
| x: x, |
| y: (75 + 50 * Math.sin(x * 0.04)), |
| range: 40 |
| }; |
| }, |
| // create a function that snaps to a grid |
| interact.createSnapGrid({ |
| x: 50, |
| y: 50, |
| range: 10, // optional |
| offset: { x: 5, y: 10 } // optional |
| }) |
| ], |
| // do not snap during normal movement. |
| // Instead, trigger only one snapped move event |
| // immediately before the end event. |
| endOnly: true, |
| |
| relativePoints: [ |
| { x: 0, y: 0 }, // snap relative to the top left of the element |
| { x: 1, y: 1 }, // and also to the bottom right |
| ], |
| |
| // offset the snap target coordinates |
| // can be an object with x/y or 'startCoords' |
| offset: { x: 50, y: 50 } |
| } |
| }); |
\*/ |
snap: function (options) { |
var ret = this.setOptions('snap', options); |
if (ret === this) { return this; } |
return ret.drag; |
}, |
setOptions: function (option, options) { |
var actions = options && isArray(options.actions) |
? options.actions |
: ['drag']; |
var i; |
if (isObject(options) || isBool(options)) { |
for (i = 0; i < actions.length; i++) { |
var action = /resize/.test(actions[i])? 'resize' : actions[i]; |
if (!isObject(this.options[action])) { continue; } |
var thisOption = this.options[action][option]; |
if (isObject(options)) { |
extend(thisOption, options); |
thisOption.enabled = options.enabled === false? false: true; |
if (option === 'snap') { |
if (thisOption.mode === 'grid') { |
thisOption.targets = [ |
interact.createSnapGrid(extend({ |
offset: thisOption.gridOffset || { x: 0, y: 0 } |
}, thisOption.grid || {})) |
]; |
} |
else if (thisOption.mode === 'anchor') { |
thisOption.targets = thisOption.anchors; |
} |
else if (thisOption.mode === 'path') { |
thisOption.targets = thisOption.paths; |
} |
if ('elementOrigin' in options) { |
thisOption.relativePoints = [options.elementOrigin]; |
} |
} |
} |
else if (isBool(options)) { |
thisOption.enabled = options; |
} |
} |
return this; |
} |
var ret = {}, |
allActions = ['drag', 'resize', 'gesture']; |
for (i = 0; i < allActions.length; i++) { |
if (option in defaultOptions[allActions[i]]) { |
ret[allActions[i]] = this.options[allActions[i]][option]; |
} |
} |
return ret; |
}, |
/*\ |
* Interactable.inertia |
[ method ] |
** |
* Deprecated. Add an `inertia` property to the options object passed |
* to @Interactable.draggable or @Interactable.resizable instead. |
* |
* Returns or sets if and how events continue to run after the pointer is released |
** |
= (boolean | object) `false` if inertia is disabled; `object` with inertia properties if inertia is enabled |
** |
* or |
** |
- options (object | boolean | null) #optional |
= (Interactable) this Interactable |
> Usage |
| // enable and use default settings |
| interact(element).inertia(true); |
| |
| // enable and use custom settings |
| interact(element).inertia({ |
| // value greater than 0 |
| // high values slow the object down more quickly |
| resistance : 16, |
| |
| // the minimum launch speed (pixels per second) that results in inertia start |
| minSpeed : 200, |
| |
| // inertia will stop when the object slows down to this speed |
| endSpeed : 20, |
| |
| // boolean; should actions be resumed when the pointer goes down during inertia |
| allowResume : true, |
| |
| // boolean; should the jump when resuming from inertia be ignored in event.dx/dy |
| zeroResumeDelta: false, |
| |
| // if snap/restrict are set to be endOnly and inertia is enabled, releasing |
| // the pointer without triggering inertia will animate from the release |
| // point to the snaped/restricted point in the given amount of time (ms) |
| smoothEndDuration: 300, |
| |
| // an array of action types that can have inertia (no gesture) |
| actions : ['drag', 'resize'] |
| }); |
| |
| // reset custom settings and use all defaults |
| interact(element).inertia(null); |
\*/ |
inertia: function (options) { |
var ret = this.setOptions('inertia', options); |
if (ret === this) { return this; } |
return ret.drag; |
}, |
getAction: function (pointer, event, interaction, element) { |
var action = this.defaultActionChecker(pointer, interaction, element); |
if (this.options.actionChecker) { |
return this.options.actionChecker(pointer, event, action, this, element, interaction); |
} |
return action; |
}, |
defaultActionChecker: defaultActionChecker, |
/*\ |
* Interactable.actionChecker |
[ method ] |
* |
* Gets or sets the function used to check action to be performed on |
* pointerDown |
* |
- checker (function | null) #optional A function which takes a pointer event, defaultAction string, interactable, element and interaction as parameters and returns an object with name property 'drag' 'resize' or 'gesture' and optionally an `edges` object with boolean 'top', 'left', 'bottom' and right props. |
= (Function | Interactable) The checker function or this Interactable |
* |
| interact('.resize-drag') |
| .resizable(true) |
| .draggable(true) |
| .actionChecker(function (pointer, event, action, interactable, element, interaction) { |
| |
| if (interact.matchesSelector(event.target, '.drag-handle') { |
| // force drag with handle target |
| action.name = drag; |
| } |
| else { |
| // resize from the top and right edges |
| action.name = 'resize'; |
| action.edges = { top: true, right: true }; |
| } |
| |
| return action; |
| }); |
\*/ |
actionChecker: function (checker) { |
if (isFunction(checker)) { |
this.options.actionChecker = checker; |
return this; |
} |
if (checker === null) { |
delete this.options.actionChecker; |
return this; |
} |
return this.options.actionChecker; |
}, |
/*\ |
* Interactable.getRect |
[ method ] |
* |
* The default function to get an Interactables bounding rect. Can be |
* overridden using @Interactable.rectChecker. |
* |
- element (Element) #optional The element to measure. |
= (object) The object's bounding rectangle. |
o { |
o top : 0, |
o left : 0, |
o bottom: 0, |
o right : 0, |
o width : 0, |
o height: 0 |
o } |
\*/ |
getRect: function rectCheck (element) { |
element = element || this._element; |
if (this.selector && !(isElement(element))) { |
element = this._context.querySelector(this.selector); |
} |
return getElementRect(element); |
}, |
/*\ |
* Interactable.rectChecker |
[ method ] |
* |
* Returns or sets the function used to calculate the interactable's |
* element's rectangle |
* |
- checker (function) #optional A function which returns this Interactable's bounding rectangle. See @Interactable.getRect |
= (function | object) The checker function or this Interactable |
\*/ |
rectChecker: function (checker) { |
if (isFunction(checker)) { |
this.getRect = checker; |
return this; |
} |
if (checker === null) { |
delete this.options.getRect; |
return this; |
} |
return this.getRect; |
}, |
/*\ |
* Interactable.styleCursor |
[ method ] |
* |
* Returns or sets whether the action that would be performed when the |
* mouse on the element are checked on `mousemove` so that the cursor |
* may be styled appropriately |
* |
- newValue (boolean) #optional |
= (boolean | Interactable) The current setting or this Interactable |
\*/ |
styleCursor: function (newValue) { |
if (isBool(newValue)) { |
this.options.styleCursor = newValue; |
return this; |
} |
if (newValue === null) { |
delete this.options.styleCursor; |
return this; |
} |
return this.options.styleCursor; |
}, |
/*\ |
* Interactable.preventDefault |
[ method ] |
* |
* Returns or sets whether to prevent the browser's default behaviour |
* in response to pointer events. Can be set to: |
* - `'always'` to always prevent |
* - `'never'` to never prevent |
* - `'auto'` to let interact.js try to determine what would be best |
* |
- newValue (string) #optional `true`, `false` or `'auto'` |
= (string | Interactable) The current setting or this Interactable |
\*/ |
preventDefault: function (newValue) { |
if (/^(always|never|auto)$/.test(newValue)) { |
this.options.preventDefault = newValue; |
return this; |
} |
if (isBool(newValue)) { |
this.options.preventDefault = newValue? 'always' : 'never'; |
return this; |
} |
return this.options.preventDefault; |
}, |
/*\ |
* Interactable.origin |
[ method ] |
* |
* Gets or sets the origin of the Interactable's element. The x and y |
* of the origin will be subtracted from action event coordinates. |
* |
- origin (object | string) #optional An object eg. { x: 0, y: 0 } or string 'parent', 'self' or any CSS selector |
* OR |
- origin (Element) #optional An HTML or SVG Element whose rect will be used |
** |
= (object) The current origin or this Interactable |
\*/ |
origin: function (newValue) { |
if (trySelector(newValue)) { |
this.options.origin = newValue; |
return this; |
} |
else if (isObject(newValue)) { |
this.options.origin = newValue; |
return this; |
} |
return this.options.origin; |
}, |
/*\ |
* Interactable.deltaSource |
[ method ] |
* |
* Returns or sets the mouse coordinate types used to calculate the |
* movement of the pointer. |
* |
- newValue (string) #optional Use 'client' if you will be scrolling while interacting; Use 'page' if you want autoScroll to work |
= (string | object) The current deltaSource or this Interactable |
\*/ |
deltaSource: function (newValue) { |
if (newValue === 'page' || newValue === 'client') { |
this.options.deltaSource = newValue; |
return this; |
} |
return this.options.deltaSource; |
}, |
/*\ |
* Interactable.restrict |
[ method ] |
** |
* Deprecated. Add a `restrict` property to the options object passed to |
* @Interactable.draggable, @Interactable.resizable or @Interactable.gesturable instead. |
* |
* Returns or sets the rectangles within which actions on this |
* interactable (after snap calculations) are restricted. By default, |
* restricting is relative to the pointer coordinates. You can change |
* this by setting the |
* [`elementRect`](https://github.com/taye/interact.js/pull/72). |
** |
- options (object) #optional an object with keys drag, resize, and/or gesture whose values are rects, Elements, CSS selectors, or 'parent' or 'self' |
= (object) The current restrictions object or this Interactable |
** |
| interact(element).restrict({ |
| // the rect will be `interact.getElementRect(element.parentNode)` |
| drag: element.parentNode, |
| |
| // x and y are relative to the the interactable's origin |
| resize: { x: 100, y: 100, width: 200, height: 200 } |
| }) |
| |
| interact('.draggable').restrict({ |
| // the rect will be the selected element's parent |
| drag: 'parent', |
| |
| // do not restrict during normal movement. |
| // Instead, trigger only one restricted move event |
| // immediately before the end event. |
| endOnly: true, |
| |
| // https://github.com/taye/interact.js/pull/72#issue-41813493 |
| elementRect: { top: 0, left: 0, bottom: 1, right: 1 } |
| }); |
\*/ |
restrict: function (options) { |
if (!isObject(options)) { |
return this.setOptions('restrict', options); |
} |
var actions = ['drag', 'resize', 'gesture'], |
ret; |
for (var i = 0; i < actions.length; i++) { |
var action = actions[i]; |
if (action in options) { |
var perAction = extend({ |
actions: [action], |
restriction: options[action] |
}, options); |
ret = this.setOptions('restrict', perAction); |
} |
} |
return ret; |
}, |
/*\ |
* Interactable.context |
[ method ] |
* |
* Gets the selector context Node of the Interactable. The default is `window.document`. |
* |
= (Node) The context Node of this Interactable |
** |
\*/ |
context: function () { |
return this._context; |
}, |
_context: document, |
/*\ |
* Interactable.ignoreFrom |
[ method ] |
* |
* If the target of the `mousedown`, `pointerdown` or `touchstart` |
* event or any of it's parents match the given CSS selector or |
* Element, no drag/resize/gesture is started. |
* |
- newValue (string | Element | null) #optional a CSS selector string, an Element or `null` to not ignore any elements |
= (string | Element | object) The current ignoreFrom value or this Interactable |
** |
| interact(element, { ignoreFrom: document.getElementById('no-action') }); |
| // or |
| interact(element).ignoreFrom('input, textarea, a'); |
\*/ |
ignoreFrom: function (newValue) { |
if (trySelector(newValue)) { // CSS selector to match event.target |
this.options.ignoreFrom = newValue; |
return this; |
} |
if (isElement(newValue)) { // specific element |
this.options.ignoreFrom = newValue; |
return this; |
} |
return this.options.ignoreFrom; |
}, |
/*\ |
* Interactable.allowFrom |
[ method ] |
* |
* A drag/resize/gesture is started only If the target of the |
* `mousedown`, `pointerdown` or `touchstart` event or any of it's |
* parents match the given CSS selector or Element. |
* |
- newValue (string | Element | null) #optional a CSS selector string, an Element or `null` to allow from any element |
= (string | Element | object) The current allowFrom value or this Interactable |
** |
| interact(element, { allowFrom: document.getElementById('drag-handle') }); |
| // or |
| interact(element).allowFrom('.handle'); |
\*/ |
allowFrom: function (newValue) { |
if (trySelector(newValue)) { // CSS selector to match event.target |
this.options.allowFrom = newValue; |
return this; |
} |
if (isElement(newValue)) { // specific element |
this.options.allowFrom = newValue; |
return this; |
} |
return this.options.allowFrom; |
}, |
/*\ |
* Interactable.element |
[ method ] |
* |
* If this is not a selector Interactable, it returns the element this |
* interactable represents |
* |
= (Element) HTML / SVG Element |
\*/ |
element: function () { |
return this._element; |
}, |
/*\ |
* Interactable.fire |
[ method ] |
* |
* Calls listeners for the given InteractEvent type bound globally |
* and directly to this Interactable |
* |
- iEvent (InteractEvent) The InteractEvent object to be fired on this Interactable |
= (Interactable) this Interactable |
\*/ |
fire: function (iEvent) { |
if (!(iEvent && iEvent.type) || !contains(eventTypes, iEvent.type)) { |
return this; |
} |
var listeners, |
i, |
len, |
onEvent = 'on' + iEvent.type, |
funcName = ''; |
// Interactable#on() listeners |
if (iEvent.type in this._iEvents) { |
listeners = this._iEvents[iEvent.type]; |
for (i = 0, len = listeners.length; i < len && !iEvent.immediatePropagationStopped; i++) { |
funcName = listeners[i].name; |
listeners[i](iEvent); |
} |
} |
// interactable.onevent listener |
if (isFunction(this[onEvent])) { |
funcName = this[onEvent].name; |
this[onEvent](iEvent); |
} |
// interact.on() listeners |
if (iEvent.type in globalEvents && (listeners = globalEvents[iEvent.type])) { |
for (i = 0, len = listeners.length; i < len && !iEvent.immediatePropagationStopped; i++) { |
funcName = listeners[i].name; |
listeners[i](iEvent); |
} |
} |
return this; |
}, |
/*\ |
* Interactable.on |
[ method ] |
* |
* Binds a listener for an InteractEvent or DOM event. |
* |
- eventType (string | array | object) The types of events to listen for |
- listener (function) The function to be called on the given event(s) |
- useCapture (boolean) #optional useCapture flag for addEventListener |
= (object) This Interactable |
\*/ |
on: function (eventType, listener, useCapture) { |
var i; |
if (isString(eventType) && eventType.search(' ') !== -1) { |
eventType = eventType.trim().split(/ +/); |
} |
if (isArray(eventType)) { |
for (i = 0; i < eventType.length; i++) { |
this.on(eventType[i], listener, useCapture); |
} |
return this; |
} |
if (isObject(eventType)) { |
for (var prop in eventType) { |
this.on(prop, eventType[prop], listener); |
} |
return this; |
} |
if (eventType === 'wheel') { |
eventType = wheelEvent; |
} |
// convert to boolean |
useCapture = useCapture? true: false; |
if (contains(eventTypes, eventType)) { |
// if this type of event was never bound to this Interactable |
if (!(eventType in this._iEvents)) { |
this._iEvents[eventType] = [listener]; |
} |
else { |
this._iEvents[eventType].push(listener); |
} |
} |
// delegated event for selector |
else if (this.selector) { |
if (!delegatedEvents[eventType]) { |
delegatedEvents[eventType] = { |
selectors: [], |
contexts : [], |
listeners: [] |
}; |
// add delegate listener functions |
for (i = 0; i < documents.length; i++) { |
events.add(documents[i], eventType, delegateListener); |
events.add(documents[i], eventType, delegateUseCapture, true); |
} |
} |
var delegated = delegatedEvents[eventType], |
index; |
for (index = delegated.selectors.length - 1; index >= 0; index--) { |
if (delegated.selectors[index] === this.selector |
&& delegated.contexts[index] === this._context) { |
break; |
} |
} |
if (index === -1) { |
index = delegated.selectors.length; |
delegated.selectors.push(this.selector); |
delegated.contexts .push(this._context); |
delegated.listeners.push([]); |
} |
// keep listener and useCapture flag |
delegated.listeners[index].push([listener, useCapture]); |
} |
else { |
events.add(this._element, eventType, listener, useCapture); |
} |
return this; |
}, |
/*\ |
* Interactable.off |
[ method ] |
* |
* Removes an InteractEvent or DOM event listener |
* |
- eventType (string | array | object) The types of events that were listened for |
- listener (function) The listener function to be removed |
- useCapture (boolean) #optional useCapture flag for removeEventListener |
= (object) This Interactable |
\*/ |
off: function (eventType, listener, useCapture) { |
var i; |
if (isString(eventType) && eventType.search(' ') !== -1) { |
eventType = eventType.trim().split(/ +/); |
} |
if (isArray(eventType)) { |
for (i = 0; i < eventType.length; i++) { |
this.off(eventType[i], listener, useCapture); |
} |
return this; |
} |
if (isObject(eventType)) { |
for (var prop in eventType) { |
this.off(prop, eventType[prop], listener); |
} |
return this; |
} |
var eventList, |
index = -1; |
// convert to boolean |
useCapture = useCapture? true: false; |
if (eventType === 'wheel') { |
eventType = wheelEvent; |
} |
// if it is an action event type |
if (contains(eventTypes, eventType)) { |
eventList = this._iEvents[eventType]; |
if (eventList && (index = indexOf(eventList, listener)) !== -1) { |
this._iEvents[eventType].splice(index, 1); |
} |
} |
// delegated event |
else if (this.selector) { |
var delegated = delegatedEvents[eventType], |
matchFound = false; |
if (!delegated) { return this; } |
// count from last index of delegated to 0 |
for (index = delegated.selectors.length - 1; index >= 0; index--) { |
// look for matching selector and context Node |
if (delegated.selectors[index] === this.selector |
&& delegated.contexts[index] === this._context) { |
var listeners = delegated.listeners[index]; |
// each item of the listeners array is an array: [function, useCaptureFlag] |
for (i = listeners.length - 1; i >= 0; i--) { |
var fn = listeners[i][0], |
useCap = listeners[i][1]; |
// check if the listener functions and useCapture flags match |
if (fn === listener && useCap === useCapture) { |
// remove the listener from the array of listeners |
listeners.splice(i, 1); |
// if all listeners for this interactable have been removed |
// remove the interactable from the delegated arrays |
if (!listeners.length) { |
delegated.selectors.splice(index, 1); |
delegated.contexts .splice(index, 1); |
delegated.listeners.splice(index, 1); |
// remove delegate function from context |
events.remove(this._context, eventType, delegateListener); |
events.remove(this._context, eventType, delegateUseCapture, true); |
// remove the arrays if they are empty |
if (!delegated.selectors.length) { |
delegatedEvents[eventType] = null; |
} |
} |
// only remove one listener |
matchFound = true; |
break; |
} |
} |
if (matchFound) { break; } |
} |
} |
} |
// remove listener from this Interatable's element |
else { |
events.remove(this._element, eventType, listener, useCapture); |
} |
return this; |
}, |
/*\ |
* Interactable.set |
[ method ] |
* |
* Reset the options of this Interactable |
- options (object) The new settings to apply |
= (object) This Interactable |
\*/ |
set: function (options) { |
if (!isObject(options)) { |
options = {}; |
} |
this.options = extend({}, defaultOptions.base); |
var i, |
actions = ['drag', 'drop', 'resize', 'gesture'], |
methods = ['draggable', 'dropzone', 'resizable', 'gesturable'], |
perActions = extend(extend({}, defaultOptions.perAction), options[action] || {}); |
for (i = 0; i < actions.length; i++) { |
var action = actions[i]; |
this.options[action] = extend({}, defaultOptions[action]); |
this.setPerAction(action, perActions); |
this[methods[i]](options[action]); |
} |
var settings = [ |
'accept', 'actionChecker', 'allowFrom', 'deltaSource', |
'dropChecker', 'ignoreFrom', 'origin', 'preventDefault', |
'rectChecker', 'styleCursor' |
]; |
for (i = 0, len = settings.length; i < len; i++) { |
var setting = settings[i]; |
this.options[setting] = defaultOptions.base[setting]; |
if (setting in options) { |
this[setting](options[setting]); |
} |
} |
return this; |
}, |
/*\ |
* Interactable.unset |
[ method ] |
* |
* Remove this interactable from the list of interactables and remove |
* it's drag, drop, resize and gesture capabilities |
* |
= (object) @interact |
\*/ |
unset: function () { |
events.remove(this._element, 'all'); |
if (!isString(this.selector)) { |
events.remove(this, 'all'); |
if (this.options.styleCursor) { |
this._element.style.cursor = ''; |
} |
} |
else { |
// remove delegated events |
for (var type in delegatedEvents) { |
var delegated = delegatedEvents[type]; |
for (var i = 0; i < delegated.selectors.length; i++) { |
if (delegated.selectors[i] === this.selector |
&& delegated.contexts[i] === this._context) { |
delegated.selectors.splice(i, 1); |
delegated.contexts .splice(i, 1); |
delegated.listeners.splice(i, 1); |
// remove the arrays if they are empty |
if (!delegated.selectors.length) { |
delegatedEvents[type] = null; |
} |
} |
events.remove(this._context, type, delegateListener); |
events.remove(this._context, type, delegateUseCapture, true); |
break; |
} |
} |
} |
this.dropzone(false); |
interactables.splice(indexOf(interactables, this), 1); |
return interact; |
} |
}; |
function warnOnce (method, message) { |
var warned = false; |
return function () { |
if (!warned) { |
window.console.warn(message); |
warned = true; |
} |
return method.apply(this, arguments); |
}; |
} |
Interactable.prototype.snap = warnOnce(Interactable.prototype.snap, |
'Interactable#snap is deprecated. See the new documentation for snapping at http://interactjs.io/docs/snapping'); |
Interactable.prototype.restrict = warnOnce(Interactable.prototype.restrict, |
'Interactable#restrict is deprecated. See the new documentation for resticting at http://interactjs.io/docs/restriction'); |
Interactable.prototype.inertia = warnOnce(Interactable.prototype.inertia, |
'Interactable#inertia is deprecated. See the new documentation for inertia at http://interactjs.io/docs/inertia'); |
Interactable.prototype.autoScroll = warnOnce(Interactable.prototype.autoScroll, |
'Interactable#autoScroll is deprecated. See the new documentation for autoScroll at http://interactjs.io/docs/#autoscroll'); |
Interactable.prototype.squareResize = warnOnce(Interactable.prototype.squareResize, |
'Interactable#squareResize is deprecated. See http://interactjs.io/docs/#resize-square'); |
Interactable.prototype.accept = warnOnce(Interactable.prototype.accept, |
'Interactable#accept is deprecated. use Interactable#dropzone({ accept: target }) instead'); |
Interactable.prototype.dropChecker = warnOnce(Interactable.prototype.dropChecker, |
'Interactable#dropChecker is deprecated. use Interactable#dropzone({ dropChecker: checkerFunction }) instead'); |
Interactable.prototype.context = warnOnce(Interactable.prototype.context, |
'Interactable#context as a method is deprecated. It will soon be a DOM Node instead'); |
/*\ |
* interact.isSet |
[ method ] |
* |
* Check if an element has been set |
- element (Element) The Element being searched for |
= (boolean) Indicates if the element or CSS selector was previously passed to interact |
\*/ |
interact.isSet = function(element, options) { |
return interactables.indexOfElement(element, options && options.context) !== -1; |
}; |
/*\ |
* interact.on |
[ method ] |
* |
* Adds a global listener for an InteractEvent or adds a DOM event to |
* `document` |
* |
- type (string | array | object) The types of events to listen for |
- listener (function) The function to be called on the given event(s) |
- useCapture (boolean) #optional useCapture flag for addEventListener |
= (object) interact |
\*/ |
interact.on = function (type, listener, useCapture) { |
if (isString(type) && type.search(' ') !== -1) { |
type = type.trim().split(/ +/); |
} |
if (isArray(type)) { |
for (var i = 0; i < type.length; i++) { |
interact.on(type[i], listener, useCapture); |
} |
return interact; |
} |
if (isObject(type)) { |
for (var prop in type) { |
interact.on(prop, type[prop], listener); |
} |
return interact; |
} |
// if it is an InteractEvent type, add listener to globalEvents |
if (contains(eventTypes, type)) { |
// if this type of event was never bound |
if (!globalEvents[type]) { |
globalEvents[type] = [listener]; |
} |
else { |
globalEvents[type].push(listener); |
} |
} |
// If non InteractEvent type, addEventListener to document |
else { |
events.add(document, type, listener, useCapture); |
} |
return interact; |
}; |
/*\ |
* interact.off |
[ method ] |
* |
* Removes a global InteractEvent listener or DOM event from `document` |
* |
- type (string | array | object) The types of events that were listened for |
- listener (function) The listener function to be removed |
- useCapture (boolean) #optional useCapture flag for removeEventListener |
= (object) interact |
\*/ |
interact.off = function (type, listener, useCapture) { |
if (isString(type) && type.search(' ') !== -1) { |
type = type.trim().split(/ +/); |
} |
if (isArray(type)) { |
for (var i = 0; i < type.length; i++) { |
interact.off(type[i], listener, useCapture); |
} |
return interact; |
} |
if (isObject(type)) { |
for (var prop in type) { |
interact.off(prop, type[prop], listener); |
} |
return interact; |
} |
if (!contains(eventTypes, type)) { |
events.remove(document, type, listener, useCapture); |
} |
else { |
var index; |
if (type in globalEvents |
&& (index = indexOf(globalEvents[type], listener)) !== -1) { |
globalEvents[type].splice(index, 1); |
} |
} |
return interact; |
}; |
/*\ |
* interact.enableDragging |
[ method ] |
* |
* Deprecated. |
* |
* Returns or sets whether dragging is enabled for any Interactables |
* |
- newValue (boolean) #optional `true` to allow the action; `false` to disable action for all Interactables |
= (boolean | object) The current setting or interact |
\*/ |
interact.enableDragging = warnOnce(function (newValue) { |
if (newValue !== null && newValue !== undefined) { |
actionIsEnabled.drag = newValue; |
return interact; |
} |
return actionIsEnabled.drag; |
}, 'interact.enableDragging is deprecated and will soon be removed.'); |
/*\ |
* interact.enableResizing |
[ method ] |
* |
* Deprecated. |
* |
* Returns or sets whether resizing is enabled for any Interactables |
* |
- newValue (boolean) #optional `true` to allow the action; `false` to disable action for all Interactables |
= (boolean | object) The current setting or interact |
\*/ |
interact.enableResizing = warnOnce(function (newValue) { |
if (newValue !== null && newValue !== undefined) { |
actionIsEnabled.resize = newValue; |
return interact; |
} |
return actionIsEnabled.resize; |
}, 'interact.enableResizing is deprecated and will soon be removed.'); |
/*\ |
* interact.enableGesturing |
[ method ] |
* |
* Deprecated. |
* |
* Returns or sets whether gesturing is enabled for any Interactables |
* |
- newValue (boolean) #optional `true` to allow the action; `false` to disable action for all Interactables |
= (boolean | object) The current setting or interact |
\*/ |
interact.enableGesturing = warnOnce(function (newValue) { |
if (newValue !== null && newValue !== undefined) { |
actionIsEnabled.gesture = newValue; |
return interact; |
} |
return actionIsEnabled.gesture; |
}, 'interact.enableGesturing is deprecated and will soon be removed.'); |
interact.eventTypes = eventTypes; |
/*\ |
* interact.debug |
[ method ] |
* |
* Returns debugging data |
= (object) An object with properties that outline the current state and expose internal functions and variables |
\*/ |
interact.debug = function () { |
var interaction = interactions[0] || new Interaction(); |
return { |
interactions : interactions, |
target : interaction.target, |
dragging : interaction.dragging, |
resizing : interaction.resizing, |
gesturing : interaction.gesturing, |
prepared : interaction.prepared, |
matches : interaction.matches, |
matchElements : interaction.matchElements, |
prevCoords : interaction.prevCoords, |
startCoords : interaction.startCoords, |
pointerIds : interaction.pointerIds, |
pointers : interaction.pointers, |
addPointer : listeners.addPointer, |
removePointer : listeners.removePointer, |
recordPointer : listeners.recordPointer, |
snap : interaction.snapStatus, |
restrict : interaction.restrictStatus, |
inertia : interaction.inertiaStatus, |
downTime : interaction.downTimes[0], |
downEvent : interaction.downEvent, |
downPointer : interaction.downPointer, |
prevEvent : interaction.prevEvent, |
Interactable : Interactable, |
interactables : interactables, |
pointerIsDown : interaction.pointerIsDown, |
defaultOptions : defaultOptions, |
defaultActionChecker : defaultActionChecker, |
actionCursors : actionCursors, |
dragMove : listeners.dragMove, |
resizeMove : listeners.resizeMove, |
gestureMove : listeners.gestureMove, |
pointerUp : listeners.pointerUp, |
pointerDown : listeners.pointerDown, |
pointerMove : listeners.pointerMove, |
pointerHover : listeners.pointerHover, |
eventTypes : eventTypes, |
events : events, |
globalEvents : globalEvents, |
delegatedEvents : delegatedEvents, |
prefixedPropREs : prefixedPropREs |
}; |
}; |
// expose the functions used to calculate multi-touch properties |
interact.getPointerAverage = pointerAverage; |
interact.getTouchBBox = touchBBox; |
interact.getTouchDistance = touchDistance; |
interact.getTouchAngle = touchAngle; |
interact.getElementRect = getElementRect; |
interact.getElementClientRect = getElementClientRect; |
interact.matchesSelector = matchesSelector; |
interact.closest = closest; |
/*\ |
* interact.margin |
[ method ] |
* |
* Deprecated. Use `interact(target).resizable({ margin: number });` instead. |
* Returns or sets the margin for autocheck resizing used in |
* @Interactable.getAction. That is the distance from the bottom and right |
* edges of an element clicking in which will start resizing |
* |
- newValue (number) #optional |
= (number | interact) The current margin value or interact |
\*/ |
interact.margin = warnOnce(function (newvalue) { |
if (isNumber(newvalue)) { |
margin = newvalue; |
return interact; |
} |
return margin; |
}, |
'interact.margin is deprecated. Use interact(target).resizable({ margin: number }); instead.') ; |
/*\ |
* interact.supportsTouch |
[ method ] |
* |
= (boolean) Whether or not the browser supports touch input |
\*/ |
interact.supportsTouch = function () { |
return supportsTouch; |
}; |
/*\ |
* interact.supportsPointerEvent |
[ method ] |
* |
= (boolean) Whether or not the browser supports PointerEvents |
\*/ |
interact.supportsPointerEvent = function () { |
return supportsPointerEvent; |
}; |
/*\ |
* interact.stop |
[ method ] |
* |
* Cancels all interactions (end events are not fired) |
* |
- event (Event) An event on which to call preventDefault() |
= (object) interact |
\*/ |
interact.stop = function (event) { |
for (var i = interactions.length - 1; i >= 0; i--) { |
interactions[i].stop(event); |
} |
return interact; |
}; |
/*\ |
* interact.dynamicDrop |
[ method ] |
* |
* Returns or sets whether the dimensions of dropzone elements are |
* calculated on every dragmove or only on dragstart for the default |
* dropChecker |
* |
- newValue (boolean) #optional True to check on each move. False to check only before start |
= (boolean | interact) The current setting or interact |
\*/ |
interact.dynamicDrop = function (newValue) { |
if (isBool(newValue)) { |
//if (dragging && dynamicDrop !== newValue && !newValue) { |
//calcRects(dropzones); |
//} |
dynamicDrop = newValue; |
return interact; |
} |
return dynamicDrop; |
}; |
/*\ |
* interact.pointerMoveTolerance |
[ method ] |
* Returns or sets the distance the pointer must be moved before an action |
* sequence occurs. This also affects tolerance for tap events. |
* |
- newValue (number) #optional The movement from the start position must be greater than this value |
= (number | Interactable) The current setting or interact |
\*/ |
interact.pointerMoveTolerance = function (newValue) { |
if (isNumber(newValue)) { |
pointerMoveTolerance = newValue; |
return this; |
} |
return pointerMoveTolerance; |
}; |
/*\ |
* interact.maxInteractions |
[ method ] |
** |
* Returns or sets the maximum number of concurrent interactions allowed. |
* By default only 1 interaction is allowed at a time (for backwards |
* compatibility). To allow multiple interactions on the same Interactables |
* and elements, you need to enable it in the draggable, resizable and |
* gesturable `'max'` and `'maxPerElement'` options. |
** |
- newValue (number) #optional Any number. newValue <= 0 means no interactions. |
\*/ |
interact.maxInteractions = function (newValue) { |
if (isNumber(newValue)) { |
maxInteractions = newValue; |
return this; |
} |
return maxInteractions; |
}; |
interact.createSnapGrid = function (grid) { |
return function (x, y) { |
var offsetX = 0, |
offsetY = 0; |
if (isObject(grid.offset)) { |
offsetX = grid.offset.x; |
offsetY = grid.offset.y; |
} |
var gridx = Math.round((x - offsetX) / grid.x), |
gridy = Math.round((y - offsetY) / grid.y), |
newX = gridx * grid.x + offsetX, |
newY = gridy * grid.y + offsetY; |
return { |
x: newX, |
y: newY, |
range: grid.range |
}; |
}; |
}; |
function endAllInteractions (event) { |
for (var i = 0; i < interactions.length; i++) { |
interactions[i].pointerEnd(event, event); |
} |
} |
function listenToDocument (doc) { |
if (contains(documents, doc)) { return; } |
var win = doc.defaultView || doc.parentWindow; |
// add delegate event listener |
for (var eventType in delegatedEvents) { |
events.add(doc, eventType, delegateListener); |
events.add(doc, eventType, delegateUseCapture, true); |
} |
if (supportsPointerEvent) { |
if (PointerEvent === win.MSPointerEvent) { |
pEventTypes = { |
up: 'MSPointerUp', down: 'MSPointerDown', over: 'mouseover', |
out: 'mouseout', move: 'MSPointerMove', cancel: 'MSPointerCancel' }; |
} |
else { |
pEventTypes = { |
up: 'pointerup', down: 'pointerdown', over: 'pointerover', |
out: 'pointerout', move: 'pointermove', cancel: 'pointercancel' }; |
} |
events.add(doc, pEventTypes.down , listeners.selectorDown ); |
events.add(doc, pEventTypes.move , listeners.pointerMove ); |
events.add(doc, pEventTypes.over , listeners.pointerOver ); |
events.add(doc, pEventTypes.out , listeners.pointerOut ); |
events.add(doc, pEventTypes.up , listeners.pointerUp ); |
events.add(doc, pEventTypes.cancel, listeners.pointerCancel); |
// autoscroll |
events.add(doc, pEventTypes.move, listeners.autoScrollMove); |
} |
else { |
events.add(doc, 'mousedown', listeners.selectorDown); |
events.add(doc, 'mousemove', listeners.pointerMove ); |
events.add(doc, 'mouseup' , listeners.pointerUp ); |
events.add(doc, 'mouseover', listeners.pointerOver ); |
events.add(doc, 'mouseout' , listeners.pointerOut ); |
events.add(doc, 'touchstart' , listeners.selectorDown ); |
events.add(doc, 'touchmove' , listeners.pointerMove ); |
events.add(doc, 'touchend' , listeners.pointerUp ); |
events.add(doc, 'touchcancel', listeners.pointerCancel); |
// autoscroll |
events.add(doc, 'mousemove', listeners.autoScrollMove); |
events.add(doc, 'touchmove', listeners.autoScrollMove); |
} |
events.add(win, 'blur', endAllInteractions); |
try { |
if (win.frameElement) { |
var parentDoc = win.frameElement.ownerDocument, |
parentWindow = parentDoc.defaultView; |
events.add(parentDoc , 'mouseup' , listeners.pointerEnd); |
events.add(parentDoc , 'touchend' , listeners.pointerEnd); |
events.add(parentDoc , 'touchcancel' , listeners.pointerEnd); |
events.add(parentDoc , 'pointerup' , listeners.pointerEnd); |
events.add(parentDoc , 'MSPointerUp' , listeners.pointerEnd); |
events.add(parentWindow, 'blur' , endAllInteractions ); |
} |
} |
catch (error) { |
interact.windowParentError = error; |
} |
// prevent native HTML5 drag on interact.js target elements |
events.add(doc, 'dragstart', function (event) { |
for (var i = 0; i < interactions.length; i++) { |
var interaction = interactions[i]; |
if (interaction.element |
&& (interaction.element === event.target |
|| nodeContains(interaction.element, event.target))) { |
interaction.checkAndPreventDefault(event, interaction.target, interaction.element); |
return; |
} |
} |
}); |
if (events.useAttachEvent) { |
// For IE's lack of Event#preventDefault |
events.add(doc, 'selectstart', function (event) { |
var interaction = interactions[0]; |
if (interaction.currentAction()) { |
interaction.checkAndPreventDefault(event); |
} |
}); |
// For IE's bad dblclick event sequence |
events.add(doc, 'dblclick', doOnInteractions('ie8Dblclick')); |
} |
documents.push(doc); |
} |
listenToDocument(document); |
function indexOf (array, target) { |
for (var i = 0, len = array.length; i < len; i++) { |
if (array[i] === target) { |
return i; |
} |
} |
return -1; |
} |
function contains (array, target) { |
return indexOf(array, target) !== -1; |
} |
function matchesSelector (element, selector, nodeList) { |
if (ie8MatchesSelector) { |
return ie8MatchesSelector(element, selector, nodeList); |
} |
// remove /deep/ from selectors if shadowDOM polyfill is used |
if (window !== realWindow) { |
selector = selector.replace(/\/deep\//g, ' '); |
} |
return element[prefixedMatchesSelector](selector); |
} |
function matchesUpTo (element, selector, limit) { |
while (isElement(element)) { |
if (matchesSelector(element, selector)) { |
return true; |
} |
element = parentElement(element); |
if (element === limit) { |
return matchesSelector(element, selector); |
} |
} |
return false; |
} |
// For IE8's lack of an Element#matchesSelector |
// taken from http://tanalin.com/en/blog/2012/12/matches-selector-ie8/ and modified |
if (!(prefixedMatchesSelector in Element.prototype) || !isFunction(Element.prototype[prefixedMatchesSelector])) { |
ie8MatchesSelector = function (element, selector, elems) { |
elems = elems || element.parentNode.querySelectorAll(selector); |
for (var i = 0, len = elems.length; i < len; i++) { |
if (elems[i] === element) { |
return true; |
} |
} |
return false; |
}; |
} |
// requestAnimationFrame polyfill |
(function() { |
var lastTime = 0, |
vendors = ['ms', 'moz', 'webkit', 'o']; |
for(var x = 0; x < vendors.length && !realWindow.requestAnimationFrame; ++x) { |
reqFrame = realWindow[vendors[x]+'RequestAnimationFrame']; |
cancelFrame = realWindow[vendors[x]+'CancelAnimationFrame'] || realWindow[vendors[x]+'CancelRequestAnimationFrame']; |
} |
if (!reqFrame) { |
reqFrame = function(callback) { |
var currTime = new Date().getTime(), |
timeToCall = Math.max(0, 16 - (currTime - lastTime)), |
id = setTimeout(function() { callback(currTime + timeToCall); }, |
timeToCall); |
lastTime = currTime + timeToCall; |
return id; |
}; |
} |
if (!cancelFrame) { |
cancelFrame = function(id) { |
clearTimeout(id); |
}; |
} |
}()); |
/* global exports: true, module, define */ |
// http://documentcloud.github.io/underscore/docs/underscore.html#section-11 |
if (typeof exports !== 'undefined') { |
if (typeof module !== 'undefined' && module.exports) { |
exports = module.exports = interact; |
} |
exports.interact = interact; |
} |
// AMD |
else if (typeof define === 'function' && define.amd) { |
define('interact', function() { |
return interact; |
}); |
} |
else { |
realWindow.interact = interact; |
} |
} (typeof window === 'undefined'? undefined : window)); |
/base/000_base/node_modules/interactjs/dist/interact.min.js |
---|
@@ -0,0 +1,127 @@ |
/* interact.js v1.2.9 | https://raw.github.com/taye/interact.js/master/LICENSE */var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(m,J,r){m!=Array.prototype&&m!=Object.prototype&&(m[J]=r.value)};$jscomp.getGlobal=function(m){return"undefined"!=typeof window&&window===m?m:"undefined"!=typeof global&&null!=global?global:m};$jscomp.global=$jscomp.getGlobal(this); |
$jscomp.polyfill=function(m,J,r,M){if(J){r=$jscomp.global;m=m.split(".");for(M=0;M<m.length-1;M++){var B=m[M];B in r||(r[B]={});r=r[B]}m=m[m.length-1];M=r[m];J=J(M);J!=M&&null!=J&&$jscomp.defineProperty(r,m,{configurable:!0,writable:!0,value:J})}}; |
$jscomp.polyfill("Math.hypot",function(m){return m?m:function(m,r,M){m=Number(m);r=Number(r);var B,u=Math.max(Math.abs(m),Math.abs(r));for(B=2;B<arguments.length;B++)u=Math.max(u,Math.abs(arguments[B]));if(1E100<u||1E-100>u){m/=u;r/=u;var x=m*m+r*r;for(B=2;B<arguments.length;B++){var F=Number(arguments[B])/u;x+=F*F}return Math.sqrt(x)*u}x=m*m+r*r;for(B=2;B<arguments.length;B++)F=Number(arguments[B]),x+=F*F;return Math.sqrt(x)}},"es6-impl","es3"); |
(function(m){function J(){}function r(a){if(!a||"object"!==typeof a)return!1;var b=Y(a)||v;return/object|function/.test(typeof b.Element)?a instanceof b.Element:1===a.nodeType&&"string"===typeof a.nodeName}function M(a){return a===v||!(!a||!a.Window)&&a instanceof a.Window}function B(a){return u(a)&&!0&&x(a.splice)}function u(a){return!!a&&"object"===typeof a}function x(a){return"function"===typeof a}function F(a){return"number"===typeof a}function K(a){return"boolean"===typeof a}function P(a){return"string"=== |
typeof a}function fa(a){if(!P(a))return!1;S.querySelector(a);return!0}function C(a,b){for(var c in b)a[c]=b[c];return a}function qa(a,b){for(var c in b){var d=!1,e;for(e in za)if(0===c.indexOf(e)&&za[e].test(c)){d=!0;break}d||(a[c]=b[c])}return a}function ra(a,b){a.page=a.page||{};a.page.x=b.page.x;a.page.y=b.page.y;a.client=a.client||{};a.client.x=b.client.x;a.client.y=b.client.y;a.timeStamp=b.timeStamp}function Qa(a,b,c){a.page.x=c.page.x-b.page.x;a.page.y=c.page.y-b.page.y;a.client.x=c.client.x- |
b.client.x;a.client.y=c.client.y-b.client.y;a.timeStamp=(new Date).getTime()-b.timeStamp;b=Math.max(a.timeStamp/1E3,.001);a.page.speed=ga(a.page.x,a.page.y)/b;a.page.vx=a.page.x/b;a.page.vy=a.page.y/b;a.client.speed=ga(a.client.x,a.page.y)/b;a.client.vx=a.client.x/b;a.client.vy=a.client.y/b}function Ra(a){return a instanceof v.Event||ha&&v.Touch&&a instanceof v.Touch}function sa(a,b,c){c=c||{};a=a||"page";c.x=b[a+"X"];c.y=b[a+"Y"];return c}function Aa(a,b){b=b||{};Sa&&Ra(a)?(sa("screen",a,b),b.x+= |
v.scrollX,b.y+=v.scrollY):sa("page",a,b);return b}function Ta(a,b){b=b||{};Sa&&Ra(a)?sa("screen",a,b):sa("client",a,b);return b}function Q(a){return F(a.pointerId)?a.pointerId:a.identifier}function Ba(a){return a instanceof kb?a.correspondingUseElement:a}function Y(a){if(M(a))return a;a=a.ownerDocument||a;return a.defaultView||a.parentWindow||v}function Ca(a){return(a=a instanceof Ua?a.getBoundingClientRect():a.getClientRects()[0])&&{left:a.left,right:a.right,top:a.top,bottom:a.bottom,width:a.width|| |
a.right-a.left,height:a.height||a.bottom-a.top}}function ta(a){var b=Ca(a);if(!lb&&b){var c=(c=Y(a))||v;a=c.scrollX||c.document.documentElement.scrollLeft;c=c.scrollY||c.document.documentElement.scrollTop;b.left+=a;b.right+=a;b.top+=c;b.bottom+=c}return b}function Da(a){var b=[];B(a)?(b[0]=a[0],b[1]=a[1]):"touchend"===a.type?1===a.touches.length?(b[0]=a.touches[0],b[1]=a.changedTouches[0]):0===a.touches.length&&(b[0]=a.changedTouches[0],b[1]=a.changedTouches[1]):(b[0]=a.touches[0],b[1]=a.touches[1]); |
return b}function Va(a){for(var b={pageX:0,pageY:0,clientX:0,clientY:0,screenX:0,screenY:0},c,d=0;d<a.length;d++)for(c in b)b[c]+=a[d][c];for(c in b)b[c]/=a.length;return b}function Ea(a){if(a.length||a.touches&&1<a.touches.length){a=Da(a);var b=Math.min(a[0].pageX,a[1].pageX),c=Math.min(a[0].pageY,a[1].pageY);return{x:b,y:c,left:b,top:c,width:Math.max(a[0].pageX,a[1].pageX)-b,height:Math.max(a[0].pageY,a[1].pageY)-c}}}function Fa(a,b){b=b||H.deltaSource;var c=b+"X";b+="Y";a=Da(a);return ga(a[0][c]- |
a[1][c],a[0][b]-a[1][b])}function Ga(a,b,c){c=c||H.deltaSource;var d=c+"X";c+="Y";a=Da(a);d=180*Math.atan((a[0][c]-a[1][c])/(a[0][d]-a[1][d]))/Math.PI;F(b)&&(b=(d-b)%360,315<b?d-=360+d/360|0:135<b?d-=180+d/360|0:-315>b?d+=360+d/360|0:-135>b&&(d+=180+d/360|0));return d}function na(a,b){var c=a?a.options.origin:H.origin;"parent"===c?c=N(b):"self"===c?c=a.getRect(b):fa(c)&&(c=Ha(b,c)||{x:0,y:0});x(c)&&(c=c(a&&b));r(c)&&(c=ta(c));c.x="x"in c?c.x:c.left;c.y="y"in c?c.y:c.top;return c}function Wa(a,b,c, |
d){var e=1-a;return e*e*b+2*e*a*c+a*a*d}function ba(a,b){for(;b;){if(b===a)return!0;b=b.parentNode}return!1}function Ha(a,b){for(a=N(a);r(a);){if(T(a,b))return a;a=N(a)}return null}function N(a){if((a=a.parentNode)&&a instanceof Xa)for(;(a=a.host)&&a&&a instanceof Xa;);return a}function ua(a,b){return a._context===b.ownerDocument||ba(a._context,b)}function ca(a,b,c){return(a=a.options.ignoreFrom)&&r(c)?P(a)?Ia(c,a,b):r(a)?ba(a,c):!1:!1}function da(a,b,c){return(a=a.options.allowFrom)?r(c)?P(a)?Ia(c, |
a,b):r(a)?ba(a,c):!1:!1:!0}function Ya(a,b){if(!b)return!1;b=b.options.drag.axis;return"xy"===a||"xy"===b||b===a}function Ja(a,b){a=a.options;/^resize/.test(b)&&(b="resize");return a[b].snap&&a[b].snap.enabled}function Ka(a,b){a=a.options;/^resize/.test(b)&&(b="resize");return a[b].restrict&&a[b].restrict.enabled}function ia(a,b,c){for(var d=a.options,e=d[c.name].max,d=d[c.name].maxPerElement,k=0,h=0,f=0,q=0,G=w.length;q<G;q++){var n=w[q],t=n.prepared.name;if(n.interacting()&&(k++,k>=va||n.target=== |
a&&(h+=t===c.name|0,h>=e||n.element===b&&(f++,t!==c.name||f>=d))))return!1}return 0<va}function wa(){this.prevDropElement=this.prevDropTarget=this.dropElement=this.dropTarget=this.element=this.target=null;this.prepared={name:null,axis:null,edges:null};this.matches=[];this.matchElements=[];this.inertiaStatus={active:!1,smoothEnd:!1,ending:!1,startEvent:null,upCoords:{},xe:0,ye:0,sx:0,sy:0,t0:0,vx0:0,vys:0,duration:0,resumeDx:0,resumeDy:0,lambda_v0:0,one_ve_v0:0,i:null};if(x(Function.prototype.bind))this.boundInertiaFrame= |
this.inertiaFrame.bind(this),this.boundSmoothEndFrame=this.smoothEndFrame.bind(this);else{var a=this;this.boundInertiaFrame=function(){return a.inertiaFrame()};this.boundSmoothEndFrame=function(){return a.smoothEndFrame()}}this.activeDrops={dropzones:[],elements:[],rects:[]};this.pointers=[];this.pointerIds=[];this.downTargets=[];this.downTimes=[];this.holdTimers=[];this.prevCoords={page:{x:0,y:0},client:{x:0,y:0},timeStamp:0};this.curCoords={page:{x:0,y:0},client:{x:0,y:0},timeStamp:0};this.startCoords= |
{page:{x:0,y:0},client:{x:0,y:0},timeStamp:0};this.pointerDelta={page:{x:0,y:0,vx:0,vy:0,speed:0},client:{x:0,y:0,vx:0,vy:0,speed:0},timeStamp:0};this.downEvent=null;this.downPointer={};this.prevEvent=this._curEventTarget=this._eventTarget=null;this.tapTime=0;this.prevTap=null;this.startOffset={left:0,right:0,top:0,bottom:0};this.restrictOffset={left:0,right:0,top:0,bottom:0};this.snapOffsets=[];this.gesture={start:{x:0,y:0},startDistance:0,prevDistance:0,distance:0,scale:1,startAngle:0,prevAngle:0}; |
this.snapStatus={x:0,y:0,dx:0,dy:0,realX:0,realY:0,snappedX:0,snappedY:0,targets:[],locked:!1,changed:!1};this.restrictStatus={dx:0,dy:0,restrictedX:0,restrictedY:0,snap:null,restricted:!1,changed:!1};this.restrictStatus.snap=this.snapStatus;this.resizing=this.dragging=this.gesturing=this.pointerWasMoved=this.pointerIsDown=!1;this.resizeAxes="xy";this.mouse=!1;w.push(this)}function Za(a,b,c){var d=w.length,e=/mouse/i.test(a.pointerType||b)||4===a.pointerType,k=Q(a);if(/down|start/i.test(b))for(a= |
0;a<d;a++){var h=w[a];var f=c;if(h.inertiaStatus.active&&h.target.options[h.prepared.name].inertia.allowResume&&h.mouse===e)for(;f;){if(f===h.element)return h;f=N(f)}}if(e||!ha&&!U){for(a=0;a<d;a++)if(w[a].mouse&&!w[a].inertiaStatus.active)return w[a];for(a=0;a<d;a++)if(w[a].mouse&&(!/down/.test(b)||!w[a].inertiaStatus.active))return h;h=new wa;h.mouse=!0;return h}for(a=0;a<d;a++)if(-1!==y(w[a].pointerIds,k))return w[a];if(/up|end|out/i.test(b))return null;for(a=0;a<d;a++)if(h=w[a],!(h.prepared.name&& |
!h.target.options.gesture.enabled||h.interacting()||!e&&h.mouse))return h;return new wa}function $a(a){return function(b){var c,d=Ba(b.path?b.path[0]:b.target),e=Ba(b.currentTarget),k;if(ha&&/touch/.test(b.type))for(ab=(new Date).getTime(),k=0;k<b.changedTouches.length;k++){var h=b.changedTouches[k];if(c=Za(h,b.type,d))c._updateEventTargets(d,e),c[a](h,b,d,e)}else{if(!U&&/mouse/.test(b.type)){for(k=0;k<w.length;k++)if(!w[k].mouse&&w[k].pointerIsDown)return;if(500>(new Date).getTime()-ab)return}if(c= |
Za(b,b.type,d))c._updateEventTargets(d,e),c[a](b,b,d,e)}}}function I(a,b,c,d,e,k){var h=a.target,f=a.snapStatus,q=a.restrictStatus,G=a.pointers,n=(h&&h.options||H).deltaSource,t=n+"X",z=n+"Y",p=h?h.options:H,m=na(h,e),r="start"===d,l="end"===d;var A=r?a.startCoords:a.curCoords;e=e||a.element;var g=C({},A.page);A=C({},A.client);g.x-=m.x;g.y-=m.y;A.x-=m.x;A.y-=m.y;var ja=p[c].snap&&p[c].snap.relativePoints;!Ja(h,c)||r&&ja&&ja.length||(this.snap={range:f.range,locked:f.locked,x:f.snappedX,y:f.snappedY, |
realX:f.realX,realY:f.realY,dx:f.dx,dy:f.dy},f.locked&&(g.x+=f.dx,g.y+=f.dy,A.x+=f.dx,A.y+=f.dy));!Ka(h,c)||r&&p[c].restrict.elementRect||!q.restricted||(g.x+=q.dx,g.y+=q.dy,A.x+=q.dx,A.y+=q.dy,this.restrict={dx:q.dx,dy:q.dy});this.pageX=g.x;this.pageY=g.y;this.clientX=A.x;this.clientY=A.y;this.x0=a.startCoords.page.x-m.x;this.y0=a.startCoords.page.y-m.y;this.clientX0=a.startCoords.client.x-m.x;this.clientY0=a.startCoords.client.y-m.y;this.ctrlKey=b.ctrlKey;this.altKey=b.altKey;this.shiftKey=b.shiftKey; |
this.metaKey=b.metaKey;this.button=b.button;this.buttons=b.buttons;this.target=e;this.t0=a.downTimes[0];this.type=c+(d||"");this.interaction=a;this.interactable=h;e=a.inertiaStatus;e.active&&(this.detail="inertia");k&&(this.relatedTarget=k);l?"client"===n?(this.dx=A.x-a.startCoords.client.x,this.dy=A.y-a.startCoords.client.y):(this.dx=g.x-a.startCoords.page.x,this.dy=g.y-a.startCoords.page.y):r?this.dy=this.dx=0:"inertiastart"===d?(this.dx=a.prevEvent.dx,this.dy=a.prevEvent.dy):"client"===n?(this.dx= |
A.x-a.prevEvent.clientX,this.dy=A.y-a.prevEvent.clientY):(this.dx=g.x-a.prevEvent.pageX,this.dy=g.y-a.prevEvent.pageY);a.prevEvent&&"inertia"===a.prevEvent.detail&&!e.active&&p[c].inertia&&p[c].inertia.zeroResumeDelta&&(e.resumeDx+=this.dx,e.resumeDy+=this.dy,this.dx=this.dy=0);"resize"===c&&a.resizeAxes?p.resize.square?("y"===a.resizeAxes?this.dx=this.dy:this.dy=this.dx,this.axes="xy"):(this.axes=a.resizeAxes,"x"===a.resizeAxes?this.dy=0:"y"===a.resizeAxes&&(this.dx=0)):"gesture"===c&&(this.touches= |
[G[0],G[1]],r?(this.distance=Fa(G,n),this.box=Ea(G),this.scale=1,this.ds=0,this.angle=Ga(G,void 0,n),this.da=0):l||b instanceof I?(this.distance=a.prevEvent.distance,this.box=a.prevEvent.box,this.scale=a.prevEvent.scale,this.ds=this.scale-1,this.angle=a.prevEvent.angle,this.da=this.angle-a.gesture.startAngle):(this.distance=Fa(G,n),this.box=Ea(G),this.scale=this.distance/a.gesture.startDistance,this.angle=Ga(G,a.gesture.prevAngle,n),this.ds=this.scale-a.gesture.prevScale,this.da=this.angle-a.gesture.prevAngle)); |
r?(this.timeStamp=a.downTimes[0],this.velocityY=this.velocityX=this.speed=this.duration=this.dt=0):"inertiastart"===d?(this.timeStamp=a.prevEvent.timeStamp,this.dt=a.prevEvent.dt,this.duration=a.prevEvent.duration,this.speed=a.prevEvent.speed,this.velocityX=a.prevEvent.velocityX,this.velocityY=a.prevEvent.velocityY):(this.timeStamp=(new Date).getTime(),this.dt=this.timeStamp-a.prevEvent.timeStamp,this.duration=this.timeStamp-a.downTimes[0],b instanceof I?(b=this[t]-a.prevEvent[t],z=this[z]-a.prevEvent[z], |
c=this.dt/1E3,this.speed=ga(b,z)/c,this.velocityX=b/c,this.velocityY=z/c):(this.speed=a.pointerDelta[n].speed,this.velocityX=a.pointerDelta[n].vx,this.velocityY=a.pointerDelta[n].vy));(l||"inertiastart"===d)&&600<a.prevEvent.speed&&150>this.timeStamp-a.prevEvent.timeStamp&&(d=180*Math.atan2(a.prevEvent.velocityY,a.prevEvent.velocityX)/Math.PI,0>d&&(d+=360),l=112.5<=d&&247.5>d,z=202.5<=d&&337.5>d,this.swipe={up:z,down:!z&&22.5<=d&&157.5>d,left:l,right:!l&&(292.5<=d||67.5>d),angle:d,speed:a.prevEvent.speed, |
velocity:{x:a.prevEvent.velocityX,y:a.prevEvent.velocityY}})}function bb(){this.originalEvent.preventDefault()}function cb(a){var b="";"drag"===a.name&&(b=xa.drag);if("resize"===a.name)if(a.axis)b=xa[a.name+a.axis];else if(a.edges){for(var b="resize",c=["top","bottom","left","right"],d=0;4>d;d++)a.edges[c[d]]&&(b+=c[d]);b=xa[b]}return b}function db(a,b,c){var d=this.getRect(c),e=!1,k=null,h=C({},b.curCoords.page);a=this.options;if(!d)return null;if(V.resize&&a.resize.enabled){e=a.resize;var f={left:!1, |
right:!1,top:!1,bottom:!1};if(u(e.edges)){for(var q in f){var G=f,n=q;a:{var t=q;var z=e.edges[q],g=h,p=b._eventTarget,m=c,l=d,A=e.margin||oa;if(z){if(!0===z){var x=F(l.width)?l.width:l.right-l.left,ja=F(l.height)?l.height:l.bottom-l.top;0>x&&("left"===t?t="right":"right"===t&&(t="left"));0>ja&&("top"===t?t="bottom":"bottom"===t&&(t="top"));if("left"===t){t=g.x<(0<=x?l.left:l.right)+A;break a}if("top"===t){t=g.y<(0<=ja?l.top:l.bottom)+A;break a}if("right"===t){t=g.x>(0<=x?l.right:l.left)-A;break a}if("bottom"=== |
t){t=g.y>(0<=ja?l.bottom:l.top)-A;break a}}t=r(p)?r(z)?z===p:Ia(p,z,m):!1}else t=!1}G[n]=t}f.left=f.left&&!f.right;f.top=f.top&&!f.bottom;e=f.left||f.right||f.top||f.bottom}else c="y"!==a.resize.axis&&h.x>d.right-oa,d="x"!==a.resize.axis&&h.y>d.bottom-oa,e=c||d,k=(c?"x":"")+(d?"y":"")}a=e?"resize":V.drag&&a.drag.enabled?"drag":null;V.gesture&&2<=b.pointerIds.length&&!b.dragging&&!b.resizing&&(a="gesture");return a?{name:a,axis:k,edges:f}:null}function Z(a,b){if(!u(a))return null;var c=a.name;b=b.options; |
return("resize"===c&&b.resize.enabled||"drag"===c&&b.drag.enabled||"gesture"===c&&b.gesture.enabled)&&V[c]?a:null}function pa(a,b){var c={},d=R[a.type],e=Ba(a.path?a.path[0]:a.target),k=e;b=b?!0:!1;for(var h in a)c[h]=a[h];c.originalEvent=a;for(c.preventDefault=bb;r(k);){for(a=0;a<d.selectors.length;a++)if(h=d.contexts[a],T(k,d.selectors[a])&&ba(h,e)&&ba(h,k)){h=d.listeners[a];c.currentTarget=k;for(var f=0;f<h.length;f++)if(h[f][1]===b)h[f][0](c)}k=N(k)}}function ya(a){return pa.call(this,a,!0)}function p(a, |
b){return D.get(a,b)||new E(a,b)}function E(a,b){this._element=a;this._iEvents=this._iEvents||{};if(fa(a)){this.selector=a;var c=(a=b&&b.context)?Y(a):v;a&&(c.Node?a instanceof c.Node:r(a)||a===c.document)&&(this._context=a)}else c=Y(a),r(a,c)&&(U?(n.add(this._element,L.down,l.pointerDown),n.add(this._element,L.move,l.pointerHover)):(n.add(this._element,"mousedown",l.pointerDown),n.add(this._element,"mousemove",l.pointerHover),n.add(this._element,"touchstart",l.pointerDown),n.add(this._element,"touchmove", |
l.pointerHover)));this._doc=c.document;-1===y(ka,this._doc)&&eb(this._doc);D.push(this);this.set(b)}function O(a,b){var c=!1;return function(){c||(v.console.warn(b),c=!0);return a.apply(this,arguments)}}function fb(a){for(var b=0;b<w.length;b++)w[b].pointerEnd(a,a)}function eb(a){if(-1===y(ka,a)){var b=a.defaultView||a.parentWindow,c;for(c in R)n.add(a,c,pa),n.add(a,c,ya,!0);U?(L=gb===b.MSPointerEvent?{up:"MSPointerUp",down:"MSPointerDown",over:"mouseover",out:"mouseout",move:"MSPointerMove",cancel:"MSPointerCancel"}: |
{up:"pointerup",down:"pointerdown",over:"pointerover",out:"pointerout",move:"pointermove",cancel:"pointercancel"},n.add(a,L.down,l.selectorDown),n.add(a,L.move,l.pointerMove),n.add(a,L.over,l.pointerOver),n.add(a,L.out,l.pointerOut),n.add(a,L.up,l.pointerUp),n.add(a,L.cancel,l.pointerCancel),n.add(a,L.move,l.autoScrollMove)):(n.add(a,"mousedown",l.selectorDown),n.add(a,"mousemove",l.pointerMove),n.add(a,"mouseup",l.pointerUp),n.add(a,"mouseover",l.pointerOver),n.add(a,"mouseout",l.pointerOut),n.add(a, |
"touchstart",l.selectorDown),n.add(a,"touchmove",l.pointerMove),n.add(a,"touchend",l.pointerUp),n.add(a,"touchcancel",l.pointerCancel),n.add(a,"mousemove",l.autoScrollMove),n.add(a,"touchmove",l.autoScrollMove));n.add(b,"blur",fb);try{if(b.frameElement){var d=b.frameElement.ownerDocument,e=d.defaultView;n.add(d,"mouseup",l.pointerEnd);n.add(d,"touchend",l.pointerEnd);n.add(d,"touchcancel",l.pointerEnd);n.add(d,"pointerup",l.pointerEnd);n.add(d,"MSPointerUp",l.pointerEnd);n.add(e,"blur",fb)}}catch(k){p.windowParentError= |
k}n.add(a,"dragstart",function(a){for(var b=0;b<w.length;b++){var c=w[b];if(c.element&&(c.element===a.target||ba(c.element,a.target))){c.checkAndPreventDefault(a,c.target,c.element);break}}});n.useAttachEvent&&(n.add(a,"selectstart",function(a){var b=w[0];b.currentAction()&&b.checkAndPreventDefault(a)}),n.add(a,"dblclick",$a("ie8Dblclick")));ka.push(a)}}function y(a,b){for(var c=0,d=a.length;c<d;c++)if(a[c]===b)return c;return-1}function T(a,b,c){if(la)return la(a,b,c);v!==m&&(b=b.replace(/\/deep\//g, |
" "));return a[La](b)}function Ia(a,b,c){for(;r(a);){if(T(a,b))return!0;a=N(a);if(a===c)return T(a,b)}return!1}if(m){var v=function(){var a=m.document.createTextNode("");return a.ownerDocument!==m.document&&"function"===typeof m.wrap&&m.wrap(a)===a?m.wrap(m):m}(),S=v.document,Xa=v.DocumentFragment||J,Ua=v.SVGElement||J,mb=v.SVGSVGElement||J,kb=v.SVGElementInstance||J,nb=v.HTMLElement||v.Element,gb=v.PointerEvent||v.MSPointerEvent,L,ga=Math.hypot||function(a,b){return Math.sqrt(a*a+b*b)},ma={},ka= |
[],D=[],w=[],Ma=!1,R={},H={base:{accept:null,actionChecker:null,styleCursor:!0,preventDefault:"auto",origin:{x:0,y:0},deltaSource:"page",allowFrom:null,ignoreFrom:null,_context:S,dropChecker:null},drag:{enabled:!1,manualStart:!0,max:Infinity,maxPerElement:1,snap:null,restrict:null,inertia:null,autoScroll:null,axis:"xy"},drop:{enabled:!1,accept:null,overlap:"pointer"},resize:{enabled:!1,manualStart:!1,max:Infinity,maxPerElement:1,snap:null,restrict:null,inertia:null,autoScroll:null,square:!1,preserveAspectRatio:!1, |
axis:"xy",margin:NaN,edges:null,invert:"none"},gesture:{manualStart:!1,enabled:!1,max:Infinity,maxPerElement:1,restrict:null},perAction:{manualStart:!1,max:Infinity,maxPerElement:1,snap:{enabled:!1,endOnly:!1,range:Infinity,targets:null,offsets:null,relativePoints:null},restrict:{enabled:!1,endOnly:!1},autoScroll:{enabled:!1,container:null,margin:60,speed:300},inertia:{enabled:!1,resistance:10,minSpeed:100,endSpeed:10,allowResume:!0,zeroResumeDelta:!0,smoothEndDuration:300}},_holdDuration:600},g= |
{interaction:null,i:null,x:0,y:0,scroll:function(){var a=g.interaction.target.options[g.interaction.prepared.name].autoScroll,b=a.container||Y(g.interaction.element),c=(new Date).getTime(),d=(c-g.prevTimeX)/1E3,e=(c-g.prevTimeY)/1E3;if(a.velocity){var k=a.velocity.x;a=a.velocity.y}else k=a=a.speed;d*=k;e*=a;if(1<=d||1<=e)M(b)?b.scrollBy(g.x*d,g.y*e):b&&(b.scrollLeft+=g.x*d,b.scrollTop+=g.y*e),1<=d&&(g.prevTimeX=c),1<=e&&(g.prevTimeY=c);g.isScrolling&&(aa(g.i),g.i=W(g.scroll))},isScrolling:!1,prevTimeX:0, |
prevTimeY:0,start:function(a){g.isScrolling=!0;aa(g.i);g.interaction=a;g.prevTimeX=(new Date).getTime();g.prevTimeY=(new Date).getTime();g.i=W(g.scroll)},stop:function(){g.isScrolling=!1;aa(g.i)}},ha="ontouchstart"in v||v.DocumentTouch&&S instanceof v.DocumentTouch,U=gb&&!/Chrome/.test(navigator.userAgent),oa=ha||U?20:10,Na=1,ab=0,va=Infinity,xa=S.all&&!v.atob?{drag:"move",resizex:"e-resize",resizey:"s-resize",resizexy:"se-resize",resizetop:"n-resize",resizeleft:"w-resize",resizebottom:"s-resize", |
resizeright:"e-resize",resizetopleft:"se-resize",resizebottomright:"se-resize",resizetopright:"ne-resize",resizebottomleft:"ne-resize",gesture:""}:{drag:"move",resizex:"ew-resize",resizey:"ns-resize",resizexy:"nwse-resize",resizetop:"ns-resize",resizeleft:"ew-resize",resizebottom:"ns-resize",resizeright:"ew-resize",resizetopleft:"nwse-resize",resizebottomright:"nwse-resize",resizetopright:"nesw-resize",resizebottomleft:"nesw-resize",gesture:""},V={drag:!0,resize:!0,gesture:!0},hb="onmousewheel"in |
S?"mousewheel":"wheel",ea="dragstart dragmove draginertiastart dragend dragenter dragleave dropactivate dropdeactivate dropmove drop resizestart resizemove resizeinertiastart resizeend gesturestart gesturemove gestureinertiastart gestureend down move up cancel tap doubletap hold".split(" "),X={},Sa="Opera"==navigator.appName&&ha&&navigator.userAgent.match("Presto"),lb=/iP(hone|od|ad)/.test(navigator.platform)&&/OS 7[^\d]/.test(navigator.appVersion),La="matches"in Element.prototype?"matches":"webkitMatchesSelector"in |
Element.prototype?"webkitMatchesSelector":"mozMatchesSelector"in Element.prototype?"mozMatchesSelector":"oMatchesSelector"in Element.prototype?"oMatchesSelector":"msMatchesSelector",la,W=m.requestAnimationFrame,aa=m.cancelAnimationFrame,n=function(){function a(b,c,d,k){var t,l=y(q,b),g=G[l],p=d;if(g&&g.events){if(e){var z=n[l];var m=y(z.supplied,d);p=z.wrapped[m]}if("all"===c)for(c in g.events)g.events.hasOwnProperty(c)&&a(b,c,"all");else{if(g.events[c]){var r=g.events[c].length;if("all"===d){for(t= |
0;t<r;t++)a(b,c,g.events[c][t],!!k);return}for(t=0;t<r;t++)if(g.events[c][t]===d){b[h](f+c,p,k||!1);g.events[c].splice(t,1);e&&z&&(z.useCount[m]--,0===z.useCount[m]&&(z.supplied.splice(m,1),z.wrapped.splice(m,1),z.useCount.splice(m,1)));break}g.events[c]&&0===g.events[c].length&&(g.events[c]=null,g.typeCount--)}g.typeCount||(G.splice(l,1),q.splice(l,1),n.splice(l,1))}}}function b(){this.returnValue=!1}function c(){this.cancelBubble=!0}function d(){this.immediatePropagationStopped=this.cancelBubble= |
!0}var e="attachEvent"in v&&!("addEventListener"in v),k=e?"attachEvent":"addEventListener",h=e?"detachEvent":"removeEventListener",f=e?"on":"",q=[],G=[],n=[];return{add:function(a,h,g,l){var t=y(q,a),m=G[t];m||(m={events:{},typeCount:0},t=q.push(a)-1,G.push(m),n.push(e?{supplied:[],wrapped:[],useCount:[]}:null));m.events[h]||(m.events[h]=[],m.typeCount++);if(-1===y(m.events[h],g)){if(e){var t=n[t],p=y(t.supplied,g),z=t.wrapped[p]||function(e){e.immediatePropagationStopped||(e.target=e.srcElement, |
e.currentTarget=a,e.preventDefault=e.preventDefault||b,e.stopPropagation=e.stopPropagation||c,e.stopImmediatePropagation=e.stopImmediatePropagation||d,/mouse|click/.test(e.type)&&(e.pageX=e.clientX+Y(a).document.documentElement.scrollLeft,e.pageY=e.clientY+Y(a).document.documentElement.scrollTop),g(e))};l=a[k](f+h,z,!!l);-1===p?(t.supplied.push(g),t.wrapped.push(z),t.useCount.push(1)):t.useCount[p]++}else l=a[k](h,g,l||!1);m.events[h].push(g);return l}},remove:a,useAttachEvent:e,_elements:q,_targets:G, |
_attachedListeners:n}}(),za={webkit:/(Movement[XY]|Radius[XY]|RotationAngle|Force)$/};wa.prototype={getPageXY:function(a,b){return Aa(a,b,this)},getClientXY:function(a,b){return Ta(a,b,this)},setEventXY:function(a,b){b=1<b.length?Va(b):b[0];Aa(b,ma,this);a.page.x=ma.x;a.page.y=ma.y;Ta(b,ma,this);a.client.x=ma.x;a.client.y=ma.y;a.timeStamp=(new Date).getTime()},pointerOver:function(a,b,c){function d(a,b){a&&r(c)&&ua(a,c)&&!ca(a,c,c)&&da(a,c,c)&&T(c,b)&&(e.push(a),k.push(c))}if(!this.prepared.name&& |
this.mouse){var e=[],k=[],h=this.element;this.addPointer(a);!this.target||!ca(this.target,this.element,c)&&da(this.target,this.element,c)||(this.element=this.target=null,this.matches=[],this.matchElements=[]);var f=D.get(c),q=f&&!ca(f,c,c)&&da(f,c,c)&&Z(f.getAction(a,b,this,c),f);q&&!ia(f,c,q)&&(q=null);q?(this.target=f,this.element=c,this.matches=[],this.matchElements=[]):(D.forEachSelector(d),this.validateSelector(a,b,e,k)?(this.matches=e,this.matchElements=k,this.pointerHover(a,b,this.matches, |
this.matchElements),n.add(c,U?L.move:"mousemove",l.pointerHover)):this.target&&(ba(h,c)?(this.pointerHover(a,b,this.matches,this.matchElements),n.add(this.element,U?L.move:"mousemove",l.pointerHover)):(this.element=this.target=null,this.matches=[],this.matchElements=[])))}},pointerHover:function(a,b,c,d,e,k){c=this.target;if(!this.prepared.name&&this.mouse){var h;this.setEventXY(this.curCoords,[a]);e?h=this.validateSelector(a,b,e,k):c&&(h=Z(c.getAction(this.pointers[0],b,this,this.element),this.target)); |
c&&c.options.styleCursor&&(c._doc.documentElement.style.cursor=h?cb(h):"")}else this.prepared.name&&this.checkAndPreventDefault(b,c,this.element)},pointerOut:function(a,b,c){this.prepared.name||(D.get(c)||n.remove(c,U?L.move:"mousemove",l.pointerHover),this.target&&this.target.options.styleCursor&&!this.interacting()&&(this.target._doc.documentElement.style.cursor=""))},selectorDown:function(a,b,c,d){function e(a,b,d){d=la?d.querySelectorAll(b):void 0;ua(a,f)&&!ca(a,f,c)&&da(a,f,c)&&T(f,b,d)&&(k.matches.push(a), |
k.matchElements.push(f))}var k=this,h=n.useAttachEvent?C({},b):b,f=c,q=this.addPointer(a);this.holdTimers[q]=setTimeout(function(){k.pointerHold(n.useAttachEvent?h:a,h,c,d)},H._holdDuration);this.pointerIsDown=!0;if(this.inertiaStatus.active&&this.target.selector)for(;r(f);){if(f===this.element&&Z(this.target.getAction(a,b,this,this.element),this.target).name===this.prepared.name){aa(this.inertiaStatus.i);this.inertiaStatus.active=!1;this.collectEventTargets(a,b,c,"down");return}f=N(f)}if(!this.interacting()){this.setEventXY(this.curCoords, |
[a]);for(this.downEvent=b;r(f)&&!g;){this.matches=[];this.matchElements=[];D.forEachSelector(e);var g=this.validateSelector(a,b,this.matches,this.matchElements);f=N(f)}if(g)return this.prepared.name=g.name,this.prepared.axis=g.axis,this.prepared.edges=g.edges,this.collectEventTargets(a,b,c,"down"),this.pointerDown(a,b,c,d,g);this.downTimes[q]=(new Date).getTime();this.downTargets[q]=c;qa(this.downPointer,a);ra(this.prevCoords,this.curCoords);this.pointerWasMoved=!1}this.collectEventTargets(a,b,c, |
"down")},pointerDown:function(a,b,c,d,e){if(!e&&!this.inertiaStatus.active&&this.pointerWasMoved&&this.prepared.name)this.checkAndPreventDefault(b,this.target,this.element);else{this.pointerIsDown=!0;this.downEvent=b;var k=this.addPointer(a),h;if(1<this.pointerIds.length&&this.target._element===this.element){var f=Z(e||this.target.getAction(a,b,this,this.element),this.target);ia(this.target,this.element,f)&&(h=f);this.prepared.name=null}else this.prepared.name||(f=D.get(d))&&!ca(f,d,c)&&da(f,d,c)&& |
(h=Z(e||f.getAction(a,b,this,d),f,c))&&ia(f,d,h)&&(this.target=f,this.element=d);var q=(f=this.target)&&f.options;!f||!e&&this.prepared.name?this.inertiaStatus.active&&d===this.element&&Z(f.getAction(a,b,this,this.element),f).name===this.prepared.name&&(aa(this.inertiaStatus.i),this.inertiaStatus.active=!1,this.checkAndPreventDefault(b,f,this.element)):(h=h||Z(e||f.getAction(a,b,this,d),f,this.element),this.setEventXY(this.startCoords,this.pointers),h&&(q.styleCursor&&(f._doc.documentElement.style.cursor= |
cb(h)),this.resizeAxes="resize"===h.name?h.axis:null,"gesture"===h&&2>this.pointerIds.length&&(h=null),this.prepared.name=h.name,this.prepared.axis=h.axis,this.prepared.edges=h.edges,this.snapStatus.snappedX=this.snapStatus.snappedY=this.restrictStatus.restrictedX=this.restrictStatus.restrictedY=NaN,this.downTimes[k]=(new Date).getTime(),this.downTargets[k]=c,qa(this.downPointer,a),ra(this.prevCoords,this.startCoords),this.pointerWasMoved=!1,this.checkAndPreventDefault(b,f,this.element)))}},setModifications:function(a, |
b){var c=this.target,d=!0,e=Ja(c,this.prepared.name)&&(!c.options[this.prepared.name].snap.endOnly||b);b=Ka(c,this.prepared.name)&&(!c.options[this.prepared.name].restrict.endOnly||b);e?this.setSnapping(a):this.snapStatus.locked=!1;b?this.setRestriction(a):this.restrictStatus.restricted=!1;e&&this.snapStatus.locked&&!this.snapStatus.changed?d=b&&this.restrictStatus.restricted&&this.restrictStatus.changed:b&&this.restrictStatus.restricted&&!this.restrictStatus.changed&&(d=!1);return d},setStartOffsets:function(a, |
b,c){a=b.getRect(c);var d=na(b,c);c=b.options[this.prepared.name].snap;b=b.options[this.prepared.name].restrict;if(a){this.startOffset.left=this.startCoords.page.x-a.left;this.startOffset.top=this.startCoords.page.y-a.top;this.startOffset.right=a.right-this.startCoords.page.x;this.startOffset.bottom=a.bottom-this.startCoords.page.y;var e="width"in a?a.width:a.right-a.left;var k="height"in a?a.height:a.bottom-a.top}else this.startOffset.left=this.startOffset.top=this.startOffset.right=this.startOffset.bottom= |
0;this.snapOffsets.splice(0);d=c&&"startCoords"===c.offset?{x:this.startCoords.page.x-d.x,y:this.startCoords.page.y-d.y}:c&&c.offset||{x:0,y:0};if(a&&c&&c.relativePoints&&c.relativePoints.length)for(var h=0;h<c.relativePoints.length;h++)this.snapOffsets.push({x:this.startOffset.left-e*c.relativePoints[h].x+d.x,y:this.startOffset.top-k*c.relativePoints[h].y+d.y});else this.snapOffsets.push(d);a&&b.elementRect?(this.restrictOffset.left=this.startOffset.left-e*b.elementRect.left,this.restrictOffset.top= |
this.startOffset.top-k*b.elementRect.top,this.restrictOffset.right=this.startOffset.right-e*(1-b.elementRect.right),this.restrictOffset.bottom=this.startOffset.bottom-k*(1-b.elementRect.bottom)):this.restrictOffset.left=this.restrictOffset.top=this.restrictOffset.right=this.restrictOffset.bottom=0},start:function(a,b,c){this.interacting()||!this.pointerIsDown||this.pointerIds.length<("gesture"===a.name?2:1)||(-1===y(w,this)&&w.push(this),this.prepared.name||this.setEventXY(this.startCoords,this.pointers), |
this.prepared.name=a.name,this.prepared.axis=a.axis,this.prepared.edges=a.edges,this.target=b,this.element=c,this.setStartOffsets(a.name,b,c),this.setModifications(this.startCoords.page),this.prevEvent=this[this.prepared.name+"Start"](this.downEvent))},pointerMove:function(a,b,c,d,e){if(this.inertiaStatus.active){d=this.inertiaStatus.upCoords.page;var k=this.inertiaStatus.upCoords.client;this.setEventXY(this.curCoords,[{pageX:d.x+this.inertiaStatus.sx,pageY:d.y+this.inertiaStatus.sy,clientX:k.x+this.inertiaStatus.sx, |
clientY:k.y+this.inertiaStatus.sy}])}else this.recordPointer(a),this.setEventXY(this.curCoords,this.pointers);d=this.curCoords.page.x===this.prevCoords.page.x&&this.curCoords.page.y===this.prevCoords.page.y&&this.curCoords.client.x===this.prevCoords.client.x&&this.curCoords.client.y===this.prevCoords.client.y;var k=this.mouse?0:y(this.pointerIds,Q(a));if(this.pointerIsDown&&!this.pointerWasMoved){var h=this.curCoords.client.x-this.startCoords.client.x;var f=this.curCoords.client.y-this.startCoords.client.y; |
this.pointerWasMoved=ga(h,f)>Na}d||this.pointerIsDown&&!this.pointerWasMoved||(this.pointerIsDown&&clearTimeout(this.holdTimers[k]),this.collectEventTargets(a,b,c,"move"));if(this.pointerIsDown)if(d&&this.pointerWasMoved&&!e)this.checkAndPreventDefault(b,this.target,this.element);else if(Qa(this.pointerDelta,this.prevCoords,this.curCoords),this.prepared.name){if(this.pointerWasMoved&&(!this.inertiaStatus.active||a instanceof I&&/inertiastart/.test(a.type))){if(!this.interacting()&&(Qa(this.pointerDelta, |
this.prevCoords,this.curCoords),"drag"===this.prepared.name)){h=Math.abs(h);f=Math.abs(f);d=this.target.options.drag.axis;var q=h>f?"x":h<f?"y":"xy";if("xy"!==q&&"xy"!==d&&d!==q){this.prepared.name=null;for(var g=c;r(g);){if((f=D.get(g))&&f!==this.target&&!f.options.drag.manualStart&&"drag"===f.getAction(this.downPointer,this.downEvent,this,g).name&&Ya(q,f)){this.prepared.name="drag";this.target=f;this.element=g;break}g=N(g)}if(!this.prepared.name){var n=this;f=function(a,b,d){d=la?d.querySelectorAll(b): |
void 0;if(a!==n.target&&ua(a,c)&&!a.options.drag.manualStart&&!ca(a,g,c)&&da(a,g,c)&&T(g,b,d)&&"drag"===a.getAction(n.downPointer,n.downEvent,n,g).name&&Ya(q,a)&&ia(a,g,"drag"))return a};for(g=c;r(g);){if(h=D.forEachSelector(f)){this.prepared.name="drag";this.target=h;this.element=g;break}g=N(g)}}}}if((f=!!this.prepared.name&&!this.interacting())&&(this.target.options[this.prepared.name].manualStart||!ia(this.target,this.element,this.prepared))){this.stop(b);return}if(this.prepared.name&&this.target){f&& |
this.start(this.prepared,this.target,this.element);if(this.setModifications(this.curCoords.page,e)||f)this.prevEvent=this[this.prepared.name+"Move"](b);this.checkAndPreventDefault(b,this.target,this.element)}}ra(this.prevCoords,this.curCoords);(this.dragging||this.resizing)&&this.autoScrollMove(a)}},dragStart:function(a){var b=new I(this,a,"drag","start",this.element);this.dragging=!0;this.target.fire(b);this.activeDrops.dropzones=[];this.activeDrops.elements=[];this.activeDrops.rects=[];this.dynamicDrop|| |
this.setActiveDrops(this.element);a=this.getDropEvents(a,b);a.activate&&this.fireActiveDrops(a.activate);return b},dragMove:function(a){var b=this.target,c=new I(this,a,"drag","move",this.element),d=this.getDrop(c,a,this.element);this.dropTarget=d.dropzone;this.dropElement=d.element;a=this.getDropEvents(a,c);b.fire(c);a.leave&&this.prevDropTarget.fire(a.leave);a.enter&&this.dropTarget.fire(a.enter);a.move&&this.dropTarget.fire(a.move);this.prevDropTarget=this.dropTarget;this.prevDropElement=this.dropElement; |
return c},resizeStart:function(a){a=new I(this,a,"resize","start",this.element);if(this.prepared.edges){var b=this.target.getRect(this.element);if(this.target.options.resize.square||this.target.options.resize.preserveAspectRatio){var c=C({},this.prepared.edges);c.top=c.top||c.left&&!c.bottom;c.left=c.left||c.top&&!c.right;c.bottom=c.bottom||c.right&&!c.top;c.right=c.right||c.bottom&&!c.left;this.prepared._linkedEdges=c}else this.prepared._linkedEdges=null;this.target.options.resize.preserveAspectRatio&& |
(this.resizeStartAspectRatio=b.width/b.height);this.resizeRects={start:b,current:C({},b),restricted:C({},b),previous:C({},b),delta:{left:0,right:0,width:0,top:0,bottom:0,height:0}};a.rect=this.resizeRects.restricted;a.deltaRect=this.resizeRects.delta}this.target.fire(a);this.resizing=!0;return a},resizeMove:function(a){a=new I(this,a,"resize","move",this.element);var b=this.prepared.edges,c=this.target.options.resize.invert,d="reposition"===c||"negate"===c;if(b){var e=a.dx,k=a.dy,h=this.resizeRects.start, |
f=this.resizeRects.current,q=this.resizeRects.restricted,g=this.resizeRects.delta,n=C(this.resizeRects.previous,q),l=b;if(this.target.options.resize.preserveAspectRatio){var m=this.resizeStartAspectRatio,b=this.prepared._linkedEdges;if(l.left&&l.bottom||l.right&&l.top)k=-e/m;else if(l.left||l.right)k=e/m;else if(l.top||l.bottom)e=k*m}else if(this.target.options.resize.square)if(b=this.prepared._linkedEdges,l.left&&l.bottom||l.right&&l.top)k=-e;else if(l.left||l.right)k=e;else if(l.top||l.bottom)e= |
k;b.top&&(f.top+=k);b.bottom&&(f.bottom+=k);b.left&&(f.left+=e);b.right&&(f.right+=e);d?(C(q,f),"reposition"===c&&(q.top>q.bottom&&(b=q.top,q.top=q.bottom,q.bottom=b),q.left>q.right&&(b=q.left,q.left=q.right,q.right=b))):(q.top=Math.min(f.top,h.bottom),q.bottom=Math.max(f.bottom,h.top),q.left=Math.min(f.left,h.right),q.right=Math.max(f.right,h.left));q.width=q.right-q.left;q.height=q.bottom-q.top;for(var p in q)g[p]=q[p]-n[p];a.edges=this.prepared.edges;a.rect=q;a.deltaRect=g}this.target.fire(a); |
return a},gestureStart:function(a){a=new I(this,a,"gesture","start",this.element);a.ds=0;this.gesture.startDistance=this.gesture.prevDistance=a.distance;this.gesture.startAngle=this.gesture.prevAngle=a.angle;this.gesture.scale=1;this.gesturing=!0;this.target.fire(a);return a},gestureMove:function(a){if(!this.pointerIds.length)return this.prevEvent;a=new I(this,a,"gesture","move",this.element);a.ds=a.scale-this.gesture.scale;this.target.fire(a);this.gesture.prevAngle=a.angle;this.gesture.prevDistance= |
a.distance;Infinity===a.scale||null===a.scale||void 0===a.scale||isNaN(a.scale)||(this.gesture.scale=a.scale);return a},pointerHold:function(a,b,c){this.collectEventTargets(a,b,c,"hold")},pointerUp:function(a,b,c,d){var e=this.mouse?0:y(this.pointerIds,Q(a));clearTimeout(this.holdTimers[e]);this.collectEventTargets(a,b,c,"up");this.collectEventTargets(a,b,c,"tap");this.pointerEnd(a,b,c,d);this.removePointer(a)},pointerCancel:function(a,b,c,d){var e=this.mouse?0:y(this.pointerIds,Q(a));clearTimeout(this.holdTimers[e]); |
this.collectEventTargets(a,b,c,"cancel");this.pointerEnd(a,b,c,d);this.removePointer(a)},ie8Dblclick:function(a,b,c){this.prevTap&&b.clientX===this.prevTap.clientX&&b.clientY===this.prevTap.clientY&&c===this.prevTap.target&&(this.downTargets[0]=c,this.downTimes[0]=(new Date).getTime(),this.collectEventTargets(a,b,c,"tap"))},pointerEnd:function(a,b,c,d){var e=this.target,k=e&&e.options,h=k&&this.prepared.name&&k[this.prepared.name].inertia;var f=this.inertiaStatus;if(this.interacting()){if(f.active&& |
!f.ending)return;var q=(new Date).getTime(),g,l=!1,n=Ja(e,this.prepared.name)&&k[this.prepared.name].snap.endOnly,m=Ka(e,this.prepared.name)&&k[this.prepared.name].restrict.endOnly,p=0,r=0,k=this.dragging?"x"===k.drag.axis?Math.abs(this.pointerDelta.client.vx):"y"===k.drag.axis?Math.abs(this.pointerDelta.client.vy):this.pointerDelta.client.speed:this.pointerDelta.client.speed,h=(g=h&&h.enabled&&"gesture"!==this.prepared.name&&b!==f.startEvent)&&50>q-this.curCoords.timeStamp&&k>h.minSpeed&&k>h.endSpeed; |
g&&!h&&(n||m)&&(g={},g.snap=g.restrict=g,n&&(this.setSnapping(this.curCoords.page,g),g.locked&&(p+=g.dx,r+=g.dy)),m&&(this.setRestriction(this.curCoords.page,g),g.restricted&&(p+=g.dx,r+=g.dy)),p||r)&&(l=!0);if(h||l){ra(f.upCoords,this.curCoords);this.pointers[0]=f.startEvent=new I(this,b,this.prepared.name,"inertiastart",this.element);f.t0=q;e.fire(f.startEvent);h?(f.vx0=this.pointerDelta.client.vx,f.vy0=this.pointerDelta.client.vy,f.v0=k,this.calcInertia(f),b=C({},this.curCoords.page),e=na(e,this.element), |
b.x=b.x+f.xe-e.x,b.y=b.y+f.ye-e.y,e={useStatusXY:!0,x:b.x,y:b.y,dx:0,dy:0,snap:null},e.snap=e,p=r=0,n&&(b=this.setSnapping(this.curCoords.page,e),b.locked&&(p+=b.dx,r+=b.dy)),m&&(e=this.setRestriction(this.curCoords.page,e),e.restricted&&(p+=e.dx,r+=e.dy)),f.modifiedXe+=p,f.modifiedYe+=r,f.i=W(this.boundInertiaFrame)):(f.smoothEnd=!0,f.xe=p,f.ye=r,f.sx=f.sy=0,f.i=W(this.boundSmoothEndFrame));f.active=!0;return}(n||m)&&this.pointerMove(a,b,c,d,!0)}this.dragging?(f=new I(this,b,"drag","end",this.element), |
m=this.getDrop(f,b,this.element),this.dropTarget=m.dropzone,this.dropElement=m.element,m=this.getDropEvents(b,f),m.leave&&this.prevDropTarget.fire(m.leave),m.enter&&this.dropTarget.fire(m.enter),m.drop&&this.dropTarget.fire(m.drop),m.deactivate&&this.fireActiveDrops(m.deactivate),e.fire(f)):this.resizing?(f=new I(this,b,"resize","end",this.element),e.fire(f)):this.gesturing&&(f=new I(this,b,"gesture","end",this.element),e.fire(f));this.stop(b)},collectDrops:function(a){var b=[],c=[],d;a=a||this.element; |
for(d=0;d<D.length;d++)if(D[d].options.drop.enabled){var e=D[d],k=e.options.drop.accept;if(!(r(k)&&k!==a||P(k)&&!T(a,k)))for(var k=e.selector?e._context.querySelectorAll(e.selector):[e._element],h=0,f=k.length;h<f;h++){var g=k[h];g!==a&&(b.push(e),c.push(g))}}return{dropzones:b,elements:c}},fireActiveDrops:function(a){var b;for(b=0;b<this.activeDrops.dropzones.length;b++){var c=this.activeDrops.dropzones[b];var d=this.activeDrops.elements[b];d!==e&&(a.target=d,c.fire(a));var e=d}},setActiveDrops:function(a){a= |
this.collectDrops(a,!0);this.activeDrops.dropzones=a.dropzones;this.activeDrops.elements=a.elements;this.activeDrops.rects=[];for(a=0;a<this.activeDrops.dropzones.length;a++)this.activeDrops.rects[a]=this.activeDrops.dropzones[a].getRect(this.activeDrops.elements[a])},getDrop:function(a,b,c){var d=[];Ma&&this.setActiveDrops(c);for(var e=0;e<this.activeDrops.dropzones.length;e++){var k=this.activeDrops.elements[e];d.push(this.activeDrops.dropzones[e].dropCheck(a,b,this.target,c,k,this.activeDrops.rects[e])? |
k:null)}c=(b=d[0])?0:-1;for(var h,e=[],f,k=1;k<d.length;k++)if((a=d[k])&&a!==b)if(!b)b=a,c=k;else if(a.parentNode!==a.ownerDocument)if(b.parentNode===a.ownerDocument)b=a,c=k;else{if(!e.length)for(h=b;h.parentNode&&h.parentNode!==h.ownerDocument;)e.unshift(h),h=h.parentNode;if(b instanceof nb&&a instanceof Ua&&!(a instanceof mb)){if(a===b.parentNode)continue;h=a.ownerSVGElement}else h=a;for(f=[];h.parentNode!==h.ownerDocument;)f.unshift(h),h=h.parentNode;for(h=0;f[h]&&f[h]===e[h];)h++;h=[f[h-1],f[h], |
e[h]];for(f=h[0].lastChild;f;){if(f===h[1]){b=a;c=k;e=[];break}else if(f===h[2])break;f=f.previousSibling}}d=c;return{dropzone:this.activeDrops.dropzones[d]||null,element:this.activeDrops.elements[d]||null}},getDropEvents:function(a,b){a={enter:null,leave:null,activate:null,deactivate:null,move:null,drop:null};this.dropElement!==this.prevDropElement&&(this.prevDropTarget&&(a.leave={target:this.prevDropElement,dropzone:this.prevDropTarget,relatedTarget:b.target,draggable:b.interactable,dragEvent:b, |
interaction:this,timeStamp:b.timeStamp,type:"dragleave"},b.dragLeave=this.prevDropElement,b.prevDropzone=this.prevDropTarget),this.dropTarget&&(a.enter={target:this.dropElement,dropzone:this.dropTarget,relatedTarget:b.target,draggable:b.interactable,dragEvent:b,interaction:this,timeStamp:b.timeStamp,type:"dragenter"},b.dragEnter=this.dropElement,b.dropzone=this.dropTarget));"dragend"===b.type&&this.dropTarget&&(a.drop={target:this.dropElement,dropzone:this.dropTarget,relatedTarget:b.target,draggable:b.interactable, |
dragEvent:b,interaction:this,timeStamp:b.timeStamp,type:"drop"},b.dropzone=this.dropTarget);"dragstart"===b.type&&(a.activate={target:null,dropzone:null,relatedTarget:b.target,draggable:b.interactable,dragEvent:b,interaction:this,timeStamp:b.timeStamp,type:"dropactivate"});"dragend"===b.type&&(a.deactivate={target:null,dropzone:null,relatedTarget:b.target,draggable:b.interactable,dragEvent:b,interaction:this,timeStamp:b.timeStamp,type:"dropdeactivate"});"dragmove"===b.type&&this.dropTarget&&(a.move= |
{target:this.dropElement,dropzone:this.dropTarget,relatedTarget:b.target,draggable:b.interactable,dragEvent:b,interaction:this,dragmove:b,timeStamp:b.timeStamp,type:"dropmove"},b.dropzone=this.dropTarget);return a},currentAction:function(){return this.dragging&&"drag"||this.resizing&&"resize"||this.gesturing&&"gesture"||null},interacting:function(){return this.dragging||this.resizing||this.gesturing},clearTargets:function(){this.dropTarget=this.dropElement=this.prevDropTarget=this.prevDropElement= |
this.target=this.element=null},stop:function(a){if(this.interacting()){g.stop();this.matches=[];this.matchElements=[];var b=this.target;b.options.styleCursor&&(b._doc.documentElement.style.cursor="");a&&x(a.preventDefault)&&this.checkAndPreventDefault(a,b,this.element);this.dragging&&(this.activeDrops.dropzones=this.activeDrops.elements=this.activeDrops.rects=null)}this.clearTargets();this.pointerIsDown=this.snapStatus.locked=this.dragging=this.resizing=this.gesturing=!1;this.prepared.name=this.prevEvent= |
null;for(a=this.inertiaStatus.resumeDx=this.inertiaStatus.resumeDy=0;a<this.pointers.length;a++)-1===y(this.pointerIds,Q(this.pointers[a]))&&this.pointers.splice(a,1)},inertiaFrame:function(){var a=this.inertiaStatus;var b=this.target.options[this.prepared.name].inertia.resistance;var c=(new Date).getTime()/1E3-a.t0;if(c<a.te){c=1-(Math.exp(-b*c)-a.lambda_v0)/a.one_ve_v0;if(a.modifiedXe===a.xe&&a.modifiedYe===a.ye)a.sx=a.xe*c,a.sy=a.ye*c;else{var d=a.ye,e=a.modifiedYe;b=Wa(c,0,a.xe,a.modifiedXe); |
c=Wa(c,0,d,e);a.sx=b;a.sy=c}this.pointerMove(a.startEvent,a.startEvent);a.i=W(this.boundInertiaFrame)}else a.ending=!0,a.sx=a.modifiedXe,a.sy=a.modifiedYe,this.pointerMove(a.startEvent,a.startEvent),this.pointerEnd(a.startEvent,a.startEvent),a.active=a.ending=!1},smoothEndFrame:function(){var a=this.inertiaStatus,b=(new Date).getTime()-a.t0,c=this.target.options[this.prepared.name].inertia.smoothEndDuration;if(b<c){var d=b/c;a.sx=-a.xe*d*(d-2)+0;b/=c;a.sy=-a.ye*b*(b-2)+0;this.pointerMove(a.startEvent, |
a.startEvent);a.i=W(this.boundSmoothEndFrame)}else a.ending=!0,a.sx=a.xe,a.sy=a.ye,this.pointerMove(a.startEvent,a.startEvent),this.pointerEnd(a.startEvent,a.startEvent),a.smoothEnd=a.active=a.ending=!1},addPointer:function(a){var b=Q(a),c=this.mouse?0:y(this.pointerIds,b);-1===c&&(c=this.pointerIds.length);this.pointerIds[c]=b;this.pointers[c]=a;return c},removePointer:function(a){a=Q(a);a=this.mouse?0:y(this.pointerIds,a);-1!==a&&(this.pointers.splice(a,1),this.pointerIds.splice(a,1),this.downTargets.splice(a, |
1),this.downTimes.splice(a,1),this.holdTimers.splice(a,1))},recordPointer:function(a){var b=this.mouse?0:y(this.pointerIds,Q(a));-1!==b&&(this.pointers[b]=a)},collectEventTargets:function(a,b,c,d){function e(a,b,e){e=la?e.querySelectorAll(b):void 0;a._iEvents[d]&&r(g)&&ua(a,g)&&!ca(a,g,c)&&da(a,g,c)&&T(g,b,e)&&(h.push(a),f.push(g))}var k=this.mouse?0:y(this.pointerIds,Q(a));if("tap"!==d||!this.pointerWasMoved&&this.downTargets[k]&&this.downTargets[k]===c){for(var h=[],f=[],g=c;g;)p.isSet(g)&&p(g)._iEvents[d]&& |
(h.push(p(g)),f.push(g)),D.forEachSelector(e),g=N(g);(h.length||"tap"===d)&&this.firePointers(a,b,c,h,f,d)}},firePointers:function(a,b,c,d,e,k){var h=this.mouse?0:y(this.pointerIds,Q(a)),f={};"doubletap"===k?f=a:(qa(f,b),b!==a&&qa(f,a),f.preventDefault=bb,f.stopPropagation=I.prototype.stopPropagation,f.stopImmediatePropagation=I.prototype.stopImmediatePropagation,f.interaction=this,f.timeStamp=(new Date).getTime(),f.originalEvent=b,f.originalPointer=a,f.type=k,f.pointerId=Q(a),f.pointerType=this.mouse? |
"mouse":U?P(a.pointerType)?a.pointerType:[,,"touch","pen","mouse"][a.pointerType]:"touch");if("tap"===k){f.dt=f.timeStamp-this.downTimes[h];var g=f.timeStamp-this.tapTime;var l=!!(this.prevTap&&"doubletap"!==this.prevTap.type&&this.prevTap.target===f.target&&500>g);f.double=l;this.tapTime=f.timeStamp}for(a=0;a<d.length&&!(f.currentTarget=e[a],f.interactable=d[a],d[a].fire(f),f.immediatePropagationStopped||f.propagationStopped&&e[a+1]!==f.currentTarget);a++);l?(d={},C(d,f),d.dt=g,d.type="doubletap", |
this.collectEventTargets(d,b,c,"doubletap"),this.prevTap=d):"tap"===k&&(this.prevTap=f)},validateSelector:function(a,b,c,d){for(var e=0,k=c.length;e<k;e++){var h=c[e],f=d[e],g=Z(h.getAction(a,b,this,f),h);if(g&&ia(h,f,g))return this.target=h,this.element=f,g}},setSnapping:function(a,b){var c=this.target.options[this.prepared.name].snap,d=[],e;b=b||this.snapStatus;if(b.useStatusXY)a={x:b.x,y:b.y};else{var k=na(this.target,this.element);a=C({},a);a.x-=k.x;a.y-=k.y}b.realX=a.x;b.realY=a.y;a.x-=this.inertiaStatus.resumeDx; |
a.y-=this.inertiaStatus.resumeDy;for(var h=c.targets?c.targets.length:0,f=0;f<this.snapOffsets.length;f++){var g=a.x-this.snapOffsets[f].x,l=a.y-this.snapOffsets[f].y;for(e=0;e<h;e++)(k=x(c.targets[e])?c.targets[e](g,l,this):c.targets[e])&&d.push({x:F(k.x)?k.x+this.snapOffsets[f].x:g,y:F(k.y)?k.y+this.snapOffsets[f].y:l,range:F(k.range)?k.range:c.range})}var c=null,f=!1,m=0,n=0;e=l=g=0;for(h=d.length;e<h;e++){k=d[e];var p=k.range,r=k.x-a.x,u=k.y-a.y,v=ga(r,u),w=v<=p;Infinity===p&&f&&Infinity!==n&& |
(w=!1);if(!c||(w?f&&Infinity!==p?v/p<m/n:Infinity===p&&Infinity!==n||v<m:!f&&v<m))Infinity===p&&(w=!0),c=k,m=v,n=p,f=w,g=r,l=u,b.range=p}c?(d=b.snappedX!==c.x||b.snappedY!==c.y,b.snappedX=c.x,b.snappedY=c.y):(d=!0,b.snappedX=NaN,b.snappedY=NaN);b.dx=g;b.dy=l;b.changed=d||f&&!b.locked;b.locked=f;return b},setRestriction:function(a,b){var c=this.target,d=c&&c.options[this.prepared.name].restrict,e=d&&d.restriction;if(!e)return b;b=b||this.restrictStatus;d=b.useStatusXY?d={x:b.x,y:b.y}:d=C({},a);b.snap&& |
b.snap.locked&&(d.x+=b.snap.dx||0,d.y+=b.snap.dy||0);d.x-=this.inertiaStatus.resumeDx;d.y-=this.inertiaStatus.resumeDy;b.dx=0;b.dy=0;b.restricted=!1;if(P(e)&&(e="parent"===e?N(this.element):"self"===e?c.getRect(this.element):Ha(this.element,e),!e))return b;x(e)&&(e=e(d.x,d.y,this.element));r(e)&&(e=ta(e));(a=e)?"x"in e&&"y"in e?(c=Math.max(Math.min(a.x+a.width-this.restrictOffset.right,d.x),a.x+this.restrictOffset.left),a=Math.max(Math.min(a.y+a.height-this.restrictOffset.bottom,d.y),a.y+this.restrictOffset.top)): |
(c=Math.max(Math.min(a.right-this.restrictOffset.right,d.x),a.left+this.restrictOffset.left),a=Math.max(Math.min(a.bottom-this.restrictOffset.bottom,d.y),a.top+this.restrictOffset.top)):(c=d.x,a=d.y);b.dx=c-d.x;b.dy=a-d.y;b.changed=b.restrictedX!==c||b.restrictedY!==a;b.restricted=!(!b.dx&&!b.dy);b.restrictedX=c;b.restrictedY=a;return b},checkAndPreventDefault:function(a,b,c){if(b=b||this.target){b=b.options;var d=b.preventDefault;"auto"===d&&c&&!/^(input|select|textarea)$/i.test(a.target.nodeName)? |
/down|start/i.test(a.type)&&"drag"===this.prepared.name&&"xy"!==b.drag.axis||b[this.prepared.name]&&b[this.prepared.name].manualStart&&!this.interacting()||a.preventDefault():"always"===d&&a.preventDefault()}},calcInertia:function(a){var b=this.target.options[this.prepared.name].inertia,c=b.resistance,d=-Math.log(b.endSpeed/a.v0)/c;a.x0=this.prevEvent.pageX;a.y0=this.prevEvent.pageY;a.t0=a.startEvent.timeStamp/1E3;a.sx=a.sy=0;a.modifiedXe=a.xe=(a.vx0-d)/c;a.modifiedYe=a.ye=(a.vy0-d)/c;a.te=d;a.lambda_v0= |
c/a.v0;a.one_ve_v0=1-b.endSpeed/a.v0},autoScrollMove:function(a){var b;if(b=this.interacting()){b=this.prepared.name;var c=this.target.options;/^resize/.test(b)&&(b="resize");b=c[b].autoScroll&&c[b].autoScroll.enabled}if(b)if(this.inertiaStatus.active)g.x=g.y=0;else{var d=this.target.options[this.prepared.name].autoScroll,e=d.container||Y(this.element);if(M(e)){var k=a.clientX<g.margin;b=a.clientY<g.margin;c=a.clientX>e.innerWidth-g.margin;a=a.clientY>e.innerHeight-g.margin}else e=Ca(e),k=a.clientX< |
e.left+g.margin,b=a.clientY<e.top+g.margin,c=a.clientX>e.right-g.margin,a=a.clientY>e.bottom-g.margin;g.x=c?1:k?-1:0;g.y=a?1:b?-1:0;g.isScrolling||(g.margin=d.margin,g.speed=d.speed,g.start(this))}},_updateEventTargets:function(a,b){this._eventTarget=a;this._curEventTarget=b}};I.prototype={preventDefault:J,stopImmediatePropagation:function(){this.immediatePropagationStopped=this.propagationStopped=!0},stopPropagation:function(){this.propagationStopped=!0}};for(var l={},ib="dragStart dragMove resizeStart resizeMove gestureStart gestureMove pointerOver pointerOut pointerHover selectorDown pointerDown pointerMove pointerUp pointerCancel pointerEnd addPointer removePointer recordPointer autoScrollMove".split(" "), |
Oa=0,Pa=ib.length;Oa<Pa;Oa++){var jb=ib[Oa];l[jb]=$a(jb)}D.indexOfElement=function(a,b){b=b||S;for(var c=0;c<this.length;c++){var d=this[c];if(d.selector===a&&d._context===b||!d.selector&&d._element===a)return c}return-1};D.get=function(a,b){return this[this.indexOfElement(a,b&&b.context)]};D.forEachSelector=function(a){for(var b=0;b<this.length;b++){var c=this[b];if(c.selector&&(c=a(c,c.selector,c._context,b,this),void 0!==c))return c}};E.prototype={setOnEvents:function(a,b){"drop"===a?(x(b.ondrop)&& |
(this.ondrop=b.ondrop),x(b.ondropactivate)&&(this.ondropactivate=b.ondropactivate),x(b.ondropdeactivate)&&(this.ondropdeactivate=b.ondropdeactivate),x(b.ondragenter)&&(this.ondragenter=b.ondragenter),x(b.ondragleave)&&(this.ondragleave=b.ondragleave),x(b.ondropmove)&&(this.ondropmove=b.ondropmove)):(a="on"+a,x(b.onstart)&&(this[a+"start"]=b.onstart),x(b.onmove)&&(this[a+"move"]=b.onmove),x(b.onend)&&(this[a+"end"]=b.onend),x(b.oninertiastart)&&(this[a+"inertiastart"]=b.oninertiastart));return this}, |
draggable:function(a){return u(a)?(this.options.drag.enabled=!1===a.enabled?!1:!0,this.setPerAction("drag",a),this.setOnEvents("drag",a),/^x$|^y$|^xy$/.test(a.axis)?this.options.drag.axis=a.axis:null===a.axis&&delete this.options.drag.axis,this):K(a)?(this.options.drag.enabled=a,this):this.options.drag},setPerAction:function(a,b){for(var c in b)c in H[a]&&(u(b[c])?(this.options[a][c]=C(this.options[a][c]||{},b[c]),u(H.perAction[c])&&"enabled"in H.perAction[c]&&(this.options[a][c].enabled=!1===b[c].enabled? |
!1:!0)):K(b[c])&&u(H.perAction[c])?this.options[a][c].enabled=b[c]:void 0!==b[c]&&(this.options[a][c]=b[c]))},dropzone:function(a){return u(a)?(this.options.drop.enabled=!1===a.enabled?!1:!0,this.setOnEvents("drop",a),/^(pointer|center)$/.test(a.overlap)?this.options.drop.overlap=a.overlap:F(a.overlap)&&(this.options.drop.overlap=Math.max(Math.min(1,a.overlap),0)),"accept"in a&&(this.options.drop.accept=a.accept),"checker"in a&&(this.options.drop.checker=a.checker),this):K(a)?(this.options.drop.enabled= |
a,this):this.options.drop},dropCheck:function(a,b,c,d,e,k){var h=!1;if(!(k=k||this.getRect(e)))return this.options.drop.checker?this.options.drop.checker(a,b,h,this,e,c,d):!1;var f=this.options.drop.overlap;if("pointer"===f){var g=Aa(a),h=na(c,d);g.x+=h.x;g.y+=h.y;h=g.x>k.left&&g.x<k.right;g=g.y>k.top&&g.y<k.bottom;h=h&&g}g=c.getRect(d);if("center"===f)var h=g.left+g.width/2,l=g.top+g.height/2,h=h>=k.left&&h<=k.right&&l>=k.top&&l<=k.bottom;F(f)&&(h=Math.max(0,Math.min(k.right,g.right)-Math.max(k.left, |
g.left))*Math.max(0,Math.min(k.bottom,g.bottom)-Math.max(k.top,g.top))/(g.width*g.height)>=f);this.options.drop.checker&&(h=this.options.drop.checker(a,b,h,this,e,c,d));return h},dropChecker:function(a){return x(a)?(this.options.drop.checker=a,this):null===a?(delete this.options.getRect,this):this.options.drop.checker},accept:function(a){return r(a)||fa(a)?(this.options.drop.accept=a,this):null===a?(delete this.options.drop.accept,this):this.options.drop.accept},resizable:function(a){return u(a)? |
(this.options.resize.enabled=!1===a.enabled?!1:!0,this.setPerAction("resize",a),this.setOnEvents("resize",a),/^x$|^y$|^xy$/.test(a.axis)?this.options.resize.axis=a.axis:null===a.axis&&(this.options.resize.axis=H.resize.axis),K(a.preserveAspectRatio)?this.options.resize.preserveAspectRatio=a.preserveAspectRatio:K(a.square)&&(this.options.resize.square=a.square),this):K(a)?(this.options.resize.enabled=a,this):this.options.resize},squareResize:function(a){return K(a)?(this.options.resize.square=a,this): |
null===a?(delete this.options.resize.square,this):this.options.resize.square},gesturable:function(a){return u(a)?(this.options.gesture.enabled=!1===a.enabled?!1:!0,this.setPerAction("gesture",a),this.setOnEvents("gesture",a),this):K(a)?(this.options.gesture.enabled=a,this):this.options.gesture},autoScroll:function(a){u(a)?a=C({actions:["drag","resize"]},a):K(a)&&(a={actions:["drag","resize"],enabled:a});return this.setOptions("autoScroll",a)},snap:function(a){a=this.setOptions("snap",a);return a=== |
this?this:a.drag},setOptions:function(a,b){var c=b&&B(b.actions)?b.actions:["drag"],d;if(u(b)||K(b)){for(d=0;d<c.length;d++){var e=/resize/.test(c[d])?"resize":c[d];u(this.options[e])&&(e=this.options[e][a],u(b)?(C(e,b),e.enabled=!1===b.enabled?!1:!0,"snap"===a&&("grid"===e.mode?e.targets=[p.createSnapGrid(C({offset:e.gridOffset||{x:0,y:0}},e.grid||{}))]:"anchor"===e.mode?e.targets=e.anchors:"path"===e.mode&&(e.targets=e.paths),"elementOrigin"in b&&(e.relativePoints=[b.elementOrigin]))):K(b)&&(e.enabled= |
b))}return this}b={};c=["drag","resize","gesture"];for(d=0;d<c.length;d++)a in H[c[d]]&&(b[c[d]]=this.options[c[d]][a]);return b},inertia:function(a){a=this.setOptions("inertia",a);return a===this?this:a.drag},getAction:function(a,b,c,d){var e=this.defaultActionChecker(a,c,d);return this.options.actionChecker?this.options.actionChecker(a,b,e,this,d,c):e},defaultActionChecker:db,actionChecker:function(a){return x(a)?(this.options.actionChecker=a,this):null===a?(delete this.options.actionChecker,this): |
this.options.actionChecker},getRect:function(a){a=a||this._element;this.selector&&!r(a)&&(a=this._context.querySelector(this.selector));return ta(a)},rectChecker:function(a){return x(a)?(this.getRect=a,this):null===a?(delete this.options.getRect,this):this.getRect},styleCursor:function(a){return K(a)?(this.options.styleCursor=a,this):null===a?(delete this.options.styleCursor,this):this.options.styleCursor},preventDefault:function(a){return/^(always|never|auto)$/.test(a)?(this.options.preventDefault= |
a,this):K(a)?(this.options.preventDefault=a?"always":"never",this):this.options.preventDefault},origin:function(a){return fa(a)||u(a)?(this.options.origin=a,this):this.options.origin},deltaSource:function(a){return"page"===a||"client"===a?(this.options.deltaSource=a,this):this.options.deltaSource},restrict:function(a){if(!u(a))return this.setOptions("restrict",a);for(var b=["drag","resize","gesture"],c,d=0;d<b.length;d++){var e=b[d];e in a&&(c=C({actions:[e],restriction:a[e]},a),c=this.setOptions("restrict", |
c))}return c},context:function(){return this._context},_context:S,ignoreFrom:function(a){return fa(a)||r(a)?(this.options.ignoreFrom=a,this):this.options.ignoreFrom},allowFrom:function(a){return fa(a)||r(a)?(this.options.allowFrom=a,this):this.options.allowFrom},element:function(){return this._element},fire:function(a){if(!a||!a.type||-1===y(ea,a.type))return this;var b,c="on"+a.type;if(a.type in this._iEvents){var d=this._iEvents[a.type];var e=0;for(b=d.length;e<b&&!a.immediatePropagationStopped;e++)d[e](a)}if(x(this[c]))this[c](a); |
if(a.type in X&&(d=X[a.type]))for(e=0,b=d.length;e<b&&!a.immediatePropagationStopped;e++)d[e](a);return this},on:function(a,b,c){var d;P(a)&&-1!==a.search(" ")&&(a=a.trim().split(/ +/));if(B(a)){for(d=0;d<a.length;d++)this.on(a[d],b,c);return this}if(u(a)){for(d in a)this.on(d,a[d],b);return this}"wheel"===a&&(a=hb);c=c?!0:!1;if(-1!==y(ea,a))a in this._iEvents?this._iEvents[a].push(b):this._iEvents[a]=[b];else if(this.selector){if(!R[a])for(R[a]={selectors:[],contexts:[],listeners:[]},d=0;d<ka.length;d++)n.add(ka[d], |
a,pa),n.add(ka[d],a,ya,!0);a=R[a];for(d=a.selectors.length-1;0<=d&&(a.selectors[d]!==this.selector||a.contexts[d]!==this._context);d--);-1===d&&(d=a.selectors.length,a.selectors.push(this.selector),a.contexts.push(this._context),a.listeners.push([]));a.listeners[d].push([b,c])}else n.add(this._element,a,b,c);return this},off:function(a,b,c){var d;P(a)&&-1!==a.search(" ")&&(a=a.trim().split(/ +/));if(B(a)){for(d=0;d<a.length;d++)this.off(a[d],b,c);return this}if(u(a)){for(var e in a)this.off(e,a[e], |
b);return this}e=-1;c=c?!0:!1;"wheel"===a&&(a=hb);if(-1!==y(ea,a))(c=this._iEvents[a])&&-1!==(e=y(c,b))&&this._iEvents[a].splice(e,1);else if(this.selector){var g=R[a],h=!1;if(!g)return this;for(e=g.selectors.length-1;0<=e;e--)if(g.selectors[e]===this.selector&&g.contexts[e]===this._context){var f=g.listeners[e];for(d=f.length-1;0<=d;d--){var l=f[d][1];if(f[d][0]===b&&l===c){f.splice(d,1);f.length||(g.selectors.splice(e,1),g.contexts.splice(e,1),g.listeners.splice(e,1),n.remove(this._context,a,pa), |
n.remove(this._context,a,ya,!0),g.selectors.length||(R[a]=null));h=!0;break}}if(h)break}}else n.remove(this._element,a,b,c);return this},set:function(a){u(a)||(a={});this.options=C({},H.base);var b,c=["drag","drop","resize","gesture"],d=["draggable","dropzone","resizable","gesturable"],e=C(C({},H.perAction),a[g]||{});for(b=0;b<c.length;b++){var g=c[b];this.options[g]=C({},H[g]);this.setPerAction(g,e);this[d[b]](a[g])}g="accept actionChecker allowFrom deltaSource dropChecker ignoreFrom origin preventDefault rectChecker styleCursor".split(" "); |
b=0;for(Pa=g.length;b<Pa;b++)if(c=g[b],this.options[c]=H.base[c],c in a)this[c](a[c]);return this},unset:function(){n.remove(this._element,"all");if(P(this.selector))for(var a in R)for(var b=R[a];0<b.selectors.length;){b.selectors[0]===this.selector&&b.contexts[0]===this._context&&(b.selectors.splice(0,1),b.contexts.splice(0,1),b.listeners.splice(0,1),b.selectors.length||(R[a]=null));n.remove(this._context,a,pa);n.remove(this._context,a,ya,!0);break}else n.remove(this,"all"),this.options.styleCursor&& |
(this._element.style.cursor="");this.dropzone(!1);D.splice(y(D,this),1);return p}};E.prototype.snap=O(E.prototype.snap,"Interactable#snap is deprecated. See the new documentation for snapping at http://interactjs.io/docs/snapping");E.prototype.restrict=O(E.prototype.restrict,"Interactable#restrict is deprecated. See the new documentation for resticting at http://interactjs.io/docs/restriction");E.prototype.inertia=O(E.prototype.inertia,"Interactable#inertia is deprecated. See the new documentation for inertia at http://interactjs.io/docs/inertia"); |
E.prototype.autoScroll=O(E.prototype.autoScroll,"Interactable#autoScroll is deprecated. See the new documentation for autoScroll at http://interactjs.io/docs/#autoscroll");E.prototype.squareResize=O(E.prototype.squareResize,"Interactable#squareResize is deprecated. See http://interactjs.io/docs/#resize-square");E.prototype.accept=O(E.prototype.accept,"Interactable#accept is deprecated. use Interactable#dropzone({ accept: target }) instead");E.prototype.dropChecker=O(E.prototype.dropChecker,"Interactable#dropChecker is deprecated. use Interactable#dropzone({ dropChecker: checkerFunction }) instead"); |
E.prototype.context=O(E.prototype.context,"Interactable#context as a method is deprecated. It will soon be a DOM Node instead");p.isSet=function(a,b){return-1!==D.indexOfElement(a,b&&b.context)};p.on=function(a,b,c){P(a)&&-1!==a.search(" ")&&(a=a.trim().split(/ +/));if(B(a)){for(var d=0;d<a.length;d++)p.on(a[d],b,c);return p}if(u(a)){for(d in a)p.on(d,a[d],b);return p}-1!==y(ea,a)?X[a]?X[a].push(b):X[a]=[b]:n.add(S,a,b,c);return p};p.off=function(a,b,c){P(a)&&-1!==a.search(" ")&&(a=a.trim().split(/ +/)); |
if(B(a)){for(var d=0;d<a.length;d++)p.off(a[d],b,c);return p}if(u(a)){for(d in a)p.off(d,a[d],b);return p}if(-1===y(ea,a))n.remove(S,a,b,c);else{var e;a in X&&-1!==(e=y(X[a],b))&&X[a].splice(e,1)}return p};p.enableDragging=O(function(a){return null!==a&&void 0!==a?(V.drag=a,p):V.drag},"interact.enableDragging is deprecated and will soon be removed.");p.enableResizing=O(function(a){return null!==a&&void 0!==a?(V.resize=a,p):V.resize},"interact.enableResizing is deprecated and will soon be removed."); |
p.enableGesturing=O(function(a){return null!==a&&void 0!==a?(V.gesture=a,p):V.gesture},"interact.enableGesturing is deprecated and will soon be removed.");p.eventTypes=ea;p.debug=function(){var a=w[0]||new wa;return{interactions:w,target:a.target,dragging:a.dragging,resizing:a.resizing,gesturing:a.gesturing,prepared:a.prepared,matches:a.matches,matchElements:a.matchElements,prevCoords:a.prevCoords,startCoords:a.startCoords,pointerIds:a.pointerIds,pointers:a.pointers,addPointer:l.addPointer,removePointer:l.removePointer, |
recordPointer:l.recordPointer,snap:a.snapStatus,restrict:a.restrictStatus,inertia:a.inertiaStatus,downTime:a.downTimes[0],downEvent:a.downEvent,downPointer:a.downPointer,prevEvent:a.prevEvent,Interactable:E,interactables:D,pointerIsDown:a.pointerIsDown,defaultOptions:H,defaultActionChecker:db,actionCursors:xa,dragMove:l.dragMove,resizeMove:l.resizeMove,gestureMove:l.gestureMove,pointerUp:l.pointerUp,pointerDown:l.pointerDown,pointerMove:l.pointerMove,pointerHover:l.pointerHover,eventTypes:ea,events:n, |
globalEvents:X,delegatedEvents:R,prefixedPropREs:za}};p.getPointerAverage=Va;p.getTouchBBox=Ea;p.getTouchDistance=Fa;p.getTouchAngle=Ga;p.getElementRect=ta;p.getElementClientRect=Ca;p.matchesSelector=T;p.closest=Ha;p.margin=O(function(a){return F(a)?(oa=a,p):oa},"interact.margin is deprecated. Use interact(target).resizable({ margin: number }); instead.");p.supportsTouch=function(){return ha};p.supportsPointerEvent=function(){return U};p.stop=function(a){for(var b=w.length-1;0<=b;b--)w[b].stop(a); |
return p};p.dynamicDrop=function(a){return K(a)?(Ma=a,p):Ma};p.pointerMoveTolerance=function(a){return F(a)?(Na=a,this):Na};p.maxInteractions=function(a){return F(a)?(va=a,this):va};p.createSnapGrid=function(a){return function(b,c){var d=0,e=0;u(a.offset)&&(d=a.offset.x,e=a.offset.y);return{x:Math.round((b-d)/a.x)*a.x+d,y:Math.round((c-e)/a.y)*a.y+e,range:a.range}}};eb(S);La in Element.prototype&&x(Element.prototype[La])||(la=function(a,b,c){c=c||a.parentNode.querySelectorAll(b);b=0;for(var d=c.length;b< |
d;b++)if(c[b]===a)return!0;return!1});(function(){for(var a=0,b=["ms","moz","webkit","o"],c=0;c<b.length&&!m.requestAnimationFrame;++c)W=m[b[c]+"RequestAnimationFrame"],aa=m[b[c]+"CancelAnimationFrame"]||m[b[c]+"CancelRequestAnimationFrame"];W||(W=function(b){var c=(new Date).getTime(),d=Math.max(0,16-(c-a)),g=setTimeout(function(){b(c+d)},d);a=c+d;return g});aa||(aa=function(a){clearTimeout(a)})})();"undefined"!==typeof exports?("undefined"!==typeof module&&module.exports&&(exports=module.exports= |
p),exports.interact=p):"function"===typeof define&&define.amd?define("interact",function(){return p}):m.interact=p}})("undefined"===typeof window?void 0:window); |
//# sourceMappingURL=interact.min.js.map |
/base/000_base/node_modules/interactjs/dist/interact.min.js.map |
---|
@@ -0,0 +1,8 @@ |
{ |
"version":3, |
"file":"", |
"lineCount":126, |
"mappings":"AAyBA,IAAI,QAAU,OAAV,EAAqB,EAGzB,QAAA,MAAA,CAAgB,ECJhB,QAAA,WAAA,CAAqB,CAAA,CAMrB,QAAA,qBAAA,CAA+B,CAAA,CAM/B,QAAA,qBAAA,CAA+B,CAAA,CCA/B,QAAA,eAAA,CACI,OAAA,WAAA,EAAwD,UAAxD,EAAsB,MAAO,OAAA,iBAA7B,CACA,MAAA,eADA,CAEA,QAAQ,CAAC,CAAD,CAAS,CAAT,CAAmB,CAAnB,CAA+B,CAOjC,CAAJ,EAAc,KAAA,UAAd,EAAiC,CAAjC,EAA2C,MAAA,UAA3C,GACA,CAAA,CAAO,CAAP,CADA,CANuD,CAOpC,MADnB,CAPqC,CCV3C,QAAA,UAAA,CAAoB,QAAQ,CAAC,CAAD,CAAc,CACxC,MAAyB,WAAlB,EAAC,MAAO,OAAR,EAAiC,MAAjC,GAA4C,CAA5C,CACH,CADG,CAEe,WAAlB,EAAC,MAAO,OAAR,EAA2C,IAA3C,EAAiC,MAAjC,CAAmD,MAAnD,CAA4D,CAHxB,CAc1C,QAAA,OAAA,CAAiB,OAAA,UAAA,CAAkB,IAAlB,CCbjB;OAAA,SAAA,CAAmB,QAAQ,CAAC,CAAD,CAAS,CAAT,CAAmB,CAAnB,CAA6B,CAA7B,CAAqC,CAC9D,GAAK,CAAL,CAAA,CACI,CAAA,CAAM,OAAA,OACN,EAAA,CAAQ,CAAA,MAAA,CAAa,GAAb,CACZ,KAAS,CAAT,CAAa,CAAb,CAAgB,CAAhB,CAAoB,CAAA,OAApB,CAAmC,CAAnC,CA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,CAAX,CAAA,EA8BsB,YAAvB,GAAI,MAAOmd,QAAX,EAC0B,WAGtB,GAHI,MAAOC,OAGX,EAHqCA,MAAAD,QAGrC,GAFIA,OAEJ,CAFcC,MAAAD,QAEd;AAF+BtY,CAE/B,EAAAsY,OAAAtY,SAAA,CAAmBA,CAJvB,EAO2B,UAAtB,GAAI,MAAOwY,OAAX,EAAoCA,MAAAC,IAApC,CACDD,MAAA,CAAO,UAAP,CAAmB,QAAQ,EAAG,CAC1B,MAAOxY,EADmB,CAA9B,CADC,CAMD/V,CAAA+V,SANC,CAMqBA,CA30L1B,CAJmB,CAAtB,CAAA,CAk1LoB,WAAlB,GAAA,MAAOzV,OAAP,CAA+BiT,IAAAA,EAA/B,CAA2CjT,MAl1L7C;", |
"sources":[" [synthetic:base] "," [synthetic:util/defines] "," [synthetic:util/defineproperty] "," [synthetic:util/global] "," [synthetic:util/polyfill] "," [synthetic:es6/math/hypot] ","interact.js"], |
"names":["realWindow","blank","isElement","o","_window","getWindow","window","test","Element","nodeType","nodeName","isWindow","thing","Window","isArray","isObject","isFunction","splice","isNumber","isBool","isString","trySelector","value","document","querySelector","extend","dest","source","prop","pointerExtend","deprecated","vendor","prefixedPropREs","indexOf","copyCoords","src","page","x","y","client","timeStamp","setEventDeltas","targetObj","prev","cur","getTime","Date","dt","Math","max","speed","hypot","vx","vy","isNativePointer","pointer","Event","supportsTouch","Touch","getXY","type","xy","getPageXY","isOperaMobile","scrollX","scrollY","getClientXY","getPointerId","pointerId","identifier","getActualElement","element","SVGElementInstance","correspondingUseElement","node","rootNode","ownerDocument","defaultView","parentWindow","getElementClientRect","clientRect","SVGElement","getBoundingClientRect","getClientRects","left","right","top","bottom","width","height","getElementRect","isIOS7","win","documentElement","scrollLeft","scrollTop","getTouchPair","event","touches","length","changedTouches","pointerAverage","pointers","average","pageX","pageY","clientX","clientY","screenX","screenY","i","touchBBox","minX","min","minY","maxX","maxY","touchDistance","deltaSource","defaultOptions","sourceX","sourceY","touchAngle","prevAngle","angle","atan","PI","drClamped","getOriginXY","interactable","origin","options","parentElement","getRect","closest","_getQBezierValue","t","p1","p2","p3","iT","nodeContains","parent","child","parentNode","selector","matchesSelector","DocumentFragment","host","inContext","_context","testIgnore","interactableElement","ignoreFrom","matchesUpTo","testAllow","allowFrom","checkAxis","axis","thisAxis","drag","checkSnap","action","snap","enabled","checkRestrict","restrict","withinInteractionLimit","maxActions","name","maxPerElement","activeInteractions","targetCount","targetElementCount","len","interactions","interaction","otherAction","prepared","interacting","active","maxInteractions","target","Interaction","prevDropElement","prevDropTarget","dropElement","dropTarget","edges","matches","matchElements","inertiaStatus","smoothEnd","ending","startEvent","upCoords","xe","ye","sx","sy","t0","vx0","vys","duration","resumeDx","resumeDy","lambda_v0","one_ve_v0","Function","prototype","bind","boundInertiaFrame","inertiaFrame","boundSmoothEndFrame","smoothEndFrame","that","this.boundInertiaFrame","this.boundSmoothEndFrame","activeDrops","dropzones","elements","rects","pointerIds","downTargets","downTimes","holdTimers","prevCoords","curCoords","startCoords","pointerDelta","downEvent","downPointer","prevEvent","_curEventTarget","_eventTarget","tapTime","prevTap","startOffset","restrictOffset","snapOffsets","gesture","start","startDistance","prevDistance","distance","scale","startAngle","snapStatus","dx","dy","realX","realY","snappedX","snappedY","targets","locked","changed","restrictStatus","restrictedX","restrictedY","restricted","resizing","dragging","gesturing","pointerWasMoved","pointerIsDown","resizeAxes","mouse","push","getInteractionFromPointer","eventType","eventTarget","mouseEvent","pointerType","id","inertia","allowResume","supportsPointerEvent","doOnInteractions","method","path","curEventTarget","currentTarget","prevTouchTime","_updateEventTargets","InteractEvent","phase","related","starting","coords","relativePoints","range","elementRect","x0","y0","clientX0","clientY0","ctrlKey","altKey","shiftKey","metaKey","button","buttons","detail","relatedTarget","zeroResumeDelta","resize","square","axes","box","ds","undefined","da","prevScale","velocityY","velocityX","atan2","up","swipe","down","velocity","preventOriginalDefault","originalEvent","preventDefault","getActionCursor","cursor","actionCursors","cursorKey","edgeNames","defaultActionChecker","rect","shouldResize","actionIsEnabled","resizeOptions","resizeEdges","edge","margin","validateAction","actionName","delegateListener","useCapture","fakeEvent","delegated","delegatedEvents","selectors","context","contexts","listeners","j","delegateUseCapture","call","interact","interactables","get","Interactable","_element","_iEvents","Node","events","add","pEventTypes","pointerDown","move","pointerHover","_doc","documents","listenToDocument","set","warnOnce","message","warned","console","warn","apply","arguments","endAllInteractions","pointerEnd","doc","PointerEvent","MSPointerEvent","over","out","cancel","selectorDown","pointerMove","pointerOver","pointerOut","pointerUp","pointerCancel","autoScrollMove","frameElement","parentDoc","error","windowParentError","checkAndPreventDefault","useAttachEvent","currentAction","array","nodeList","ie8MatchesSelector","replace","prefixedMatchesSelector","limit","el","createTextNode","wrap","SVGSVGElement","HTMLElement","sqrt","tmpXY","dynamicDrop","base","accept","actionChecker","styleCursor","dropChecker","manualStart","Infinity","autoScroll","drop","overlap","preserveAspectRatio","NaN","invert","perAction","endOnly","offsets","container","resistance","minSpeed","endSpeed","smoothEndDuration","_holdDuration","scroll","now","dtx","prevTimeX","dty","prevTimeY","scrollBy","isScrolling","cancelFrame","reqFrame","stop","DocumentTouch","navigator","userAgent","pointerMoveTolerance","all","atob","resizex","resizey","resizexy","resizetop","resizeleft","resizebottom","resizeright","resizetopleft","resizebottomright","resizetopright","resizebottomleft","wheelEvent","eventTypes","globalEvents","appName","match","platform","appVersion","requestAnimationFrame","cancelAnimationFrame","remove","listener","elementIndex","wrapped","attachedListeners","listenerIndex","supplied","hasOwnProperty","removeEvent","on","useCount","typeCount","preventDef","returnValue","stopProp","cancelBubble","stopImmProp","immediatePropagationStopped","addEvent","srcElement","stopPropagation","stopImmediatePropagation","ret","_elements","_targets","_attachedListeners","webkit","setEventXY","ptr","pushCurMatches","curMatches","curMatchElements","prevTargetElement","addPointer","elementInteractable","elementAction","getAction","forEachSelector","validateSelector","style","pushMatches","querySelectorAll","eventCopy","pointerIndex","setTimeout","pointerHold","collectEventTargets","forceAction","newAction","setModifications","preEnd","shouldMove","shouldSnap","shouldRestrict","setSnapping","setRestriction","setStartOffsets","snapOffset","offset","pageUp","clientUp","inertiaPosition","recordPointer","duplicateMove","clearTimeout","absX","abs","absY","targetAxis","thisInteraction","getDraggable","selectorInteractable","dragStart","dragEvent","fire","setActiveDrops","dropEvents","getDropEvents","activate","fireActiveDrops","dragMove","getDrop","dropzone","leave","enter","resizeStart","resizeEvent","startRect","linkedEdges","_linkedEdges","resizeStartAspectRatio","resizeRects","current","previous","delta","deltaRect","resizeMove","invertible","originalEdges","swap","gestureStart","gestureEvent","gestureMove","isNaN","removePointer","ie8Dblclick","inertiaOptions","inertiaPossible","endSnap","endRestrict","pointerSpeed","snapRestrict","vy0","v0","calcInertia","statusObject","useStatusXY","modifiedXe","modifiedYe","endEvent","deactivate","collectDrops","drops","dropElements","currentElement","prevElement","dragElement","possibleDrops","validDrops","dropCheck","index","deepestZone","deepestZoneParents","dropzoneParents","unshift","ownerSVGElement","n","parents","lastChild","previousSibling","dropIndex","pointerEvent","draggable","dragLeave","prevDropzone","dragEnter","dragmove","clearTargets","lambda","te","progress","exp","startX","startY","cpY","endY","b","collectSelectors","els","isSet","firePointers","originalPointer","interval","createNewDoubleTap","double","propagationStopped","doubleTap","matchElement","pageCoords","status","relIndex","inRange","snapChanged","restriction","prevent","inertiaDur","log","innerWidth","innerHeight","interactionListeners","indexOfElement","interactables.indexOfElement","interactables.get","interactables.forEachSelector","callback","setOnEvents","phases","ondrop","ondropactivate","ondropdeactivate","ondragenter","ondragleave","ondropmove","onstart","onmove","onend","oninertiastart","setPerAction","option","checker","draggableElement","dropped","dropOverlap","horizontal","vertical","dragRect","cx","cy","newValue","resizable","squareResize","gesturable","actions","setOptions","thisOption","mode","createSnapGrid","gridOffset","grid","anchors","paths","elementOrigin","allActions","rectCheck","rectChecker","iEvent","onEvent","search","trim","split","off","eventList","matchFound","useCap","fn","methods","perActions","settings","setting","unset","interact.isSet","interact.on","interact.off","enableDragging","enableResizing","enableGesturing","debug","interact.debug","downTime","getPointerAverage","getTouchBBox","getTouchDistance","getTouchAngle","newvalue","interact.supportsTouch","interact.supportsPointerEvent","interact.stop","interact.dynamicDrop","interact.pointerMoveTolerance","interact.maxInteractions","interact.createSnapGrid","offsetX","offsetY","round","gridx","gridy","elems","lastTime","vendors","currTime","timeToCall","exports","module","define","amd"] |
} |
/base/000_base/node_modules/interactjs/interact.js |
---|
@@ -0,0 +1,5978 @@ |
/** |
* interact.js v1.2.9 |
* |
* Copyright (c) 2012-2015 Taye Adeyemi <dev@taye.me> |
* Open source under the MIT License. |
* https://raw.github.com/taye/interact.js/master/LICENSE |
*/ |
(function (realWindow) { |
'use strict'; |
// return early if there's no window to work with (eg. Node.js) |
if (!realWindow) { return; } |
var // get wrapped window if using Shadow DOM polyfill |
window = (function () { |
// create a TextNode |
var el = realWindow.document.createTextNode(''); |
// check if it's wrapped by a polyfill |
if (el.ownerDocument !== realWindow.document |
&& typeof realWindow.wrap === 'function' |
&& realWindow.wrap(el) === el) { |
// return wrapped window |
return realWindow.wrap(realWindow); |
} |
// no Shadow DOM polyfil or native implementation |
return realWindow; |
}()), |
document = window.document, |
DocumentFragment = window.DocumentFragment || blank, |
SVGElement = window.SVGElement || blank, |
SVGSVGElement = window.SVGSVGElement || blank, |
SVGElementInstance = window.SVGElementInstance || blank, |
HTMLElement = window.HTMLElement || window.Element, |
PointerEvent = (window.PointerEvent || window.MSPointerEvent), |
pEventTypes, |
hypot = Math.hypot || function (x, y) { return Math.sqrt(x * x + y * y); }, |
tmpXY = {}, // reduce object creation in getXY() |
documents = [], // all documents being listened to |
interactables = [], // all set interactables |
interactions = [], // all interactions |
dynamicDrop = false, |
// { |
// type: { |
// selectors: ['selector', ...], |
// contexts : [document, ...], |
// listeners: [[listener, useCapture], ...] |
// } |
// } |
delegatedEvents = {}, |
defaultOptions = { |
base: { |
accept : null, |
actionChecker : null, |
styleCursor : true, |
preventDefault: 'auto', |
origin : { x: 0, y: 0 }, |
deltaSource : 'page', |
allowFrom : null, |
ignoreFrom : null, |
_context : document, |
dropChecker : null |
}, |
drag: { |
enabled: false, |
manualStart: true, |
max: Infinity, |
maxPerElement: 1, |
snap: null, |
restrict: null, |
inertia: null, |
autoScroll: null, |
axis: 'xy' |
}, |
drop: { |
enabled: false, |
accept: null, |
overlap: 'pointer' |
}, |
resize: { |
enabled: false, |
manualStart: false, |
max: Infinity, |
maxPerElement: 1, |
snap: null, |
restrict: null, |
inertia: null, |
autoScroll: null, |
square: false, |
preserveAspectRatio: false, |
axis: 'xy', |
// use default margin |
margin: NaN, |
// object with props left, right, top, bottom which are |
// true/false values to resize when the pointer is over that edge, |
// CSS selectors to match the handles for each direction |
// or the Elements for each handle |
edges: null, |
// a value of 'none' will limit the resize rect to a minimum of 0x0 |
// 'negate' will alow the rect to have negative width/height |
// 'reposition' will keep the width/height positive by swapping |
// the top and bottom edges and/or swapping the left and right edges |
invert: 'none' |
}, |
gesture: { |
manualStart: false, |
enabled: false, |
max: Infinity, |
maxPerElement: 1, |
restrict: null |
}, |
perAction: { |
manualStart: false, |
max: Infinity, |
maxPerElement: 1, |
snap: { |
enabled : false, |
endOnly : false, |
range : Infinity, |
targets : null, |
offsets : null, |
relativePoints: null |
}, |
restrict: { |
enabled: false, |
endOnly: false |
}, |
autoScroll: { |
enabled : false, |
container : null, // the item that is scrolled (Window or HTMLElement) |
margin : 60, |
speed : 300 // the scroll speed in pixels per second |
}, |
inertia: { |
enabled : false, |
resistance : 10, // the lambda in exponential decay |
minSpeed : 100, // target speed must be above this for inertia to start |
endSpeed : 10, // the speed at which inertia is slow enough to stop |
allowResume : true, // allow resuming an action in inertia phase |
zeroResumeDelta : true, // if an action is resumed after launch, set dx/dy to 0 |
smoothEndDuration: 300 // animate to snap/restrict endOnly if there's no inertia |
} |
}, |
_holdDuration: 600 |
}, |
// Things related to autoScroll |
autoScroll = { |
interaction: null, |
i: null, // the handle returned by window.setInterval |
x: 0, y: 0, // Direction each pulse is to scroll in |
// scroll the window by the values in scroll.x/y |
scroll: function () { |
var options = autoScroll.interaction.target.options[autoScroll.interaction.prepared.name].autoScroll, |
container = options.container || getWindow(autoScroll.interaction.element), |
now = new Date().getTime(), |
// change in time in seconds |
dtx = (now - autoScroll.prevTimeX) / 1000, |
dty = (now - autoScroll.prevTimeY) / 1000, |
vx, vy, sx, sy; |
// displacement |
if (options.velocity) { |
vx = options.velocity.x; |
vy = options.velocity.y; |
} |
else { |
vx = vy = options.speed |
} |
sx = vx * dtx; |
sy = vy * dty; |
if (sx >= 1 || sy >= 1) { |
if (isWindow(container)) { |
container.scrollBy(autoScroll.x * sx, autoScroll.y * sy); |
} |
else if (container) { |
container.scrollLeft += autoScroll.x * sx; |
container.scrollTop += autoScroll.y * sy; |
} |
if (sx >=1) autoScroll.prevTimeX = now; |
if (sy >= 1) autoScroll.prevTimeY = now; |
} |
if (autoScroll.isScrolling) { |
cancelFrame(autoScroll.i); |
autoScroll.i = reqFrame(autoScroll.scroll); |
} |
}, |
isScrolling: false, |
prevTimeX: 0, |
prevTimeY: 0, |
start: function (interaction) { |
autoScroll.isScrolling = true; |
cancelFrame(autoScroll.i); |
autoScroll.interaction = interaction; |
autoScroll.prevTimeX = new Date().getTime(); |
autoScroll.prevTimeY = new Date().getTime(); |
autoScroll.i = reqFrame(autoScroll.scroll); |
}, |
stop: function () { |
autoScroll.isScrolling = false; |
cancelFrame(autoScroll.i); |
} |
}, |
// Does the browser support touch input? |
supportsTouch = (('ontouchstart' in window) || window.DocumentTouch && document instanceof window.DocumentTouch), |
// Does the browser support PointerEvents |
// Avoid PointerEvent bugs introduced in Chrome 55 |
supportsPointerEvent = PointerEvent && !/Chrome/.test(navigator.userAgent), |
// Less Precision with touch input |
margin = supportsTouch || supportsPointerEvent? 20: 10, |
pointerMoveTolerance = 1, |
// for ignoring browser's simulated mouse events |
prevTouchTime = 0, |
// Allow this many interactions to happen simultaneously |
maxInteractions = Infinity, |
// Check if is IE9 or older |
actionCursors = (document.all && !window.atob) ? { |
drag : 'move', |
resizex : 'e-resize', |
resizey : 's-resize', |
resizexy: 'se-resize', |
resizetop : 'n-resize', |
resizeleft : 'w-resize', |
resizebottom : 's-resize', |
resizeright : 'e-resize', |
resizetopleft : 'se-resize', |
resizebottomright: 'se-resize', |
resizetopright : 'ne-resize', |
resizebottomleft : 'ne-resize', |
gesture : '' |
} : { |
drag : 'move', |
resizex : 'ew-resize', |
resizey : 'ns-resize', |
resizexy: 'nwse-resize', |
resizetop : 'ns-resize', |
resizeleft : 'ew-resize', |
resizebottom : 'ns-resize', |
resizeright : 'ew-resize', |
resizetopleft : 'nwse-resize', |
resizebottomright: 'nwse-resize', |
resizetopright : 'nesw-resize', |
resizebottomleft : 'nesw-resize', |
gesture : '' |
}, |
actionIsEnabled = { |
drag : true, |
resize : true, |
gesture: true |
}, |
// because Webkit and Opera still use 'mousewheel' event type |
wheelEvent = 'onmousewheel' in document? 'mousewheel': 'wheel', |
eventTypes = [ |
'dragstart', |
'dragmove', |
'draginertiastart', |
'dragend', |
'dragenter', |
'dragleave', |
'dropactivate', |
'dropdeactivate', |
'dropmove', |
'drop', |
'resizestart', |
'resizemove', |
'resizeinertiastart', |
'resizeend', |
'gesturestart', |
'gesturemove', |
'gestureinertiastart', |
'gestureend', |
'down', |
'move', |
'up', |
'cancel', |
'tap', |
'doubletap', |
'hold' |
], |
globalEvents = {}, |
// Opera Mobile must be handled differently |
isOperaMobile = navigator.appName == 'Opera' && |
supportsTouch && |
navigator.userAgent.match('Presto'), |
// scrolling doesn't change the result of getClientRects on iOS 7 |
isIOS7 = (/iP(hone|od|ad)/.test(navigator.platform) |
&& /OS 7[^\d]/.test(navigator.appVersion)), |
// prefix matchesSelector |
prefixedMatchesSelector = 'matches' in Element.prototype? |
'matches': 'webkitMatchesSelector' in Element.prototype? |
'webkitMatchesSelector': 'mozMatchesSelector' in Element.prototype? |
'mozMatchesSelector': 'oMatchesSelector' in Element.prototype? |
'oMatchesSelector': 'msMatchesSelector', |
// will be polyfill function if browser is IE8 |
ie8MatchesSelector, |
// native requestAnimationFrame or polyfill |
reqFrame = realWindow.requestAnimationFrame, |
cancelFrame = realWindow.cancelAnimationFrame, |
// Events wrapper |
events = (function () { |
var useAttachEvent = ('attachEvent' in window) && !('addEventListener' in window), |
addEvent = useAttachEvent? 'attachEvent': 'addEventListener', |
removeEvent = useAttachEvent? 'detachEvent': 'removeEventListener', |
on = useAttachEvent? 'on': '', |
elements = [], |
targets = [], |
attachedListeners = []; |
function add (element, type, listener, useCapture) { |
var elementIndex = indexOf(elements, element), |
target = targets[elementIndex]; |
if (!target) { |
target = { |
events: {}, |
typeCount: 0 |
}; |
elementIndex = elements.push(element) - 1; |
targets.push(target); |
attachedListeners.push((useAttachEvent ? { |
supplied: [], |
wrapped : [], |
useCount: [] |
} : null)); |
} |
if (!target.events[type]) { |
target.events[type] = []; |
target.typeCount++; |
} |
if (!contains(target.events[type], listener)) { |
var ret; |
if (useAttachEvent) { |
var listeners = attachedListeners[elementIndex], |
listenerIndex = indexOf(listeners.supplied, listener); |
var wrapped = listeners.wrapped[listenerIndex] || function (event) { |
if (!event.immediatePropagationStopped) { |
event.target = event.srcElement; |
event.currentTarget = element; |
event.preventDefault = event.preventDefault || preventDef; |
event.stopPropagation = event.stopPropagation || stopProp; |
event.stopImmediatePropagation = event.stopImmediatePropagation || stopImmProp; |
if (/mouse|click/.test(event.type)) { |
event.pageX = event.clientX + getWindow(element).document.documentElement.scrollLeft; |
event.pageY = event.clientY + getWindow(element).document.documentElement.scrollTop; |
} |
listener(event); |
} |
}; |
ret = element[addEvent](on + type, wrapped, Boolean(useCapture)); |
if (listenerIndex === -1) { |
listeners.supplied.push(listener); |
listeners.wrapped.push(wrapped); |
listeners.useCount.push(1); |
} |
else { |
listeners.useCount[listenerIndex]++; |
} |
} |
else { |
ret = element[addEvent](type, listener, useCapture || false); |
} |
target.events[type].push(listener); |
return ret; |
} |
} |
function remove (element, type, listener, useCapture) { |
var i, |
elementIndex = indexOf(elements, element), |
target = targets[elementIndex], |
listeners, |
listenerIndex, |
wrapped = listener; |
if (!target || !target.events) { |
return; |
} |
if (useAttachEvent) { |
listeners = attachedListeners[elementIndex]; |
listenerIndex = indexOf(listeners.supplied, listener); |
wrapped = listeners.wrapped[listenerIndex]; |
} |
if (type === 'all') { |
for (type in target.events) { |
if (target.events.hasOwnProperty(type)) { |
remove(element, type, 'all'); |
} |
} |
return; |
} |
if (target.events[type]) { |
var len = target.events[type].length; |
if (listener === 'all') { |
for (i = 0; i < len; i++) { |
remove(element, type, target.events[type][i], Boolean(useCapture)); |
} |
return; |
} else { |
for (i = 0; i < len; i++) { |
if (target.events[type][i] === listener) { |
element[removeEvent](on + type, wrapped, useCapture || false); |
target.events[type].splice(i, 1); |
if (useAttachEvent && listeners) { |
listeners.useCount[listenerIndex]--; |
if (listeners.useCount[listenerIndex] === 0) { |
listeners.supplied.splice(listenerIndex, 1); |
listeners.wrapped.splice(listenerIndex, 1); |
listeners.useCount.splice(listenerIndex, 1); |
} |
} |
break; |
} |
} |
} |
if (target.events[type] && target.events[type].length === 0) { |
target.events[type] = null; |
target.typeCount--; |
} |
} |
if (!target.typeCount) { |
targets.splice(elementIndex, 1); |
elements.splice(elementIndex, 1); |
attachedListeners.splice(elementIndex, 1); |
} |
} |
function preventDef () { |
this.returnValue = false; |
} |
function stopProp () { |
this.cancelBubble = true; |
} |
function stopImmProp () { |
this.cancelBubble = true; |
this.immediatePropagationStopped = true; |
} |
return { |
add: add, |
remove: remove, |
useAttachEvent: useAttachEvent, |
_elements: elements, |
_targets: targets, |
_attachedListeners: attachedListeners |
}; |
}()); |
function blank () {} |
function isElement (o) { |
if (!o || (typeof o !== 'object')) { return false; } |
var _window = getWindow(o) || window; |
return (/object|function/.test(typeof _window.Element) |
? o instanceof _window.Element //DOM2 |
: o.nodeType === 1 && typeof o.nodeName === "string"); |
} |
function isWindow (thing) { return thing === window || !!(thing && thing.Window) && (thing instanceof thing.Window); } |
function isDocFrag (thing) { return !!thing && thing instanceof DocumentFragment; } |
function isArray (thing) { |
return isObject(thing) |
&& (typeof thing.length !== undefined) |
&& isFunction(thing.splice); |
} |
function isObject (thing) { return !!thing && (typeof thing === 'object'); } |
function isFunction (thing) { return typeof thing === 'function'; } |
function isNumber (thing) { return typeof thing === 'number' ; } |
function isBool (thing) { return typeof thing === 'boolean' ; } |
function isString (thing) { return typeof thing === 'string' ; } |
function trySelector (value) { |
if (!isString(value)) { return false; } |
// an exception will be raised if it is invalid |
document.querySelector(value); |
return true; |
} |
function extend (dest, source) { |
for (var prop in source) { |
dest[prop] = source[prop]; |
} |
return dest; |
} |
var prefixedPropREs = { |
webkit: /(Movement[XY]|Radius[XY]|RotationAngle|Force)$/ |
}; |
function pointerExtend (dest, source) { |
for (var prop in source) { |
var deprecated = false; |
// skip deprecated prefixed properties |
for (var vendor in prefixedPropREs) { |
if (prop.indexOf(vendor) === 0 && prefixedPropREs[vendor].test(prop)) { |
deprecated = true; |
break; |
} |
} |
if (!deprecated) { |
dest[prop] = source[prop]; |
} |
} |
return dest; |
} |
function copyCoords (dest, src) { |
dest.page = dest.page || {}; |
dest.page.x = src.page.x; |
dest.page.y = src.page.y; |
dest.client = dest.client || {}; |
dest.client.x = src.client.x; |
dest.client.y = src.client.y; |
dest.timeStamp = src.timeStamp; |
} |
function setEventXY (targetObj, pointers, interaction) { |
var pointer = (pointers.length > 1 |
? pointerAverage(pointers) |
: pointers[0]); |
getPageXY(pointer, tmpXY, interaction); |
targetObj.page.x = tmpXY.x; |
targetObj.page.y = tmpXY.y; |
getClientXY(pointer, tmpXY, interaction); |
targetObj.client.x = tmpXY.x; |
targetObj.client.y = tmpXY.y; |
targetObj.timeStamp = new Date().getTime(); |
} |
function setEventDeltas (targetObj, prev, cur) { |
targetObj.page.x = cur.page.x - prev.page.x; |
targetObj.page.y = cur.page.y - prev.page.y; |
targetObj.client.x = cur.client.x - prev.client.x; |
targetObj.client.y = cur.client.y - prev.client.y; |
targetObj.timeStamp = new Date().getTime() - prev.timeStamp; |
// set pointer velocity |
var dt = Math.max(targetObj.timeStamp / 1000, 0.001); |
targetObj.page.speed = hypot(targetObj.page.x, targetObj.page.y) / dt; |
targetObj.page.vx = targetObj.page.x / dt; |
targetObj.page.vy = targetObj.page.y / dt; |
targetObj.client.speed = hypot(targetObj.client.x, targetObj.page.y) / dt; |
targetObj.client.vx = targetObj.client.x / dt; |
targetObj.client.vy = targetObj.client.y / dt; |
} |
function isNativePointer (pointer) { |
return (pointer instanceof window.Event |
|| (supportsTouch && window.Touch && pointer instanceof window.Touch)); |
} |
// Get specified X/Y coords for mouse or event.touches[0] |
function getXY (type, pointer, xy) { |
xy = xy || {}; |
type = type || 'page'; |
xy.x = pointer[type + 'X']; |
xy.y = pointer[type + 'Y']; |
return xy; |
} |
function getPageXY (pointer, page) { |
page = page || {}; |
// Opera Mobile handles the viewport and scrolling oddly |
if (isOperaMobile && isNativePointer(pointer)) { |
getXY('screen', pointer, page); |
page.x += window.scrollX; |
page.y += window.scrollY; |
} |
else { |
getXY('page', pointer, page); |
} |
return page; |
} |
function getClientXY (pointer, client) { |
client = client || {}; |
if (isOperaMobile && isNativePointer(pointer)) { |
// Opera Mobile handles the viewport and scrolling oddly |
getXY('screen', pointer, client); |
} |
else { |
getXY('client', pointer, client); |
} |
return client; |
} |
function getScrollXY (win) { |
win = win || window; |
return { |
x: win.scrollX || win.document.documentElement.scrollLeft, |
y: win.scrollY || win.document.documentElement.scrollTop |
}; |
} |
function getPointerId (pointer) { |
return isNumber(pointer.pointerId)? pointer.pointerId : pointer.identifier; |
} |
function getActualElement (element) { |
return (element instanceof SVGElementInstance |
? element.correspondingUseElement |
: element); |
} |
function getWindow (node) { |
if (isWindow(node)) { |
return node; |
} |
var rootNode = (node.ownerDocument || node); |
return rootNode.defaultView || rootNode.parentWindow || window; |
} |
function getElementClientRect (element) { |
var clientRect = (element instanceof SVGElement |
? element.getBoundingClientRect() |
: element.getClientRects()[0]); |
return clientRect && { |
left : clientRect.left, |
right : clientRect.right, |
top : clientRect.top, |
bottom: clientRect.bottom, |
width : clientRect.width || clientRect.right - clientRect.left, |
height: clientRect.height || clientRect.bottom - clientRect.top |
}; |
} |
function getElementRect (element) { |
var clientRect = getElementClientRect(element); |
if (!isIOS7 && clientRect) { |
var scroll = getScrollXY(getWindow(element)); |
clientRect.left += scroll.x; |
clientRect.right += scroll.x; |
clientRect.top += scroll.y; |
clientRect.bottom += scroll.y; |
} |
return clientRect; |
} |
function getTouchPair (event) { |
var touches = []; |
// array of touches is supplied |
if (isArray(event)) { |
touches[0] = event[0]; |
touches[1] = event[1]; |
} |
// an event |
else { |
if (event.type === 'touchend') { |
if (event.touches.length === 1) { |
touches[0] = event.touches[0]; |
touches[1] = event.changedTouches[0]; |
} |
else if (event.touches.length === 0) { |
touches[0] = event.changedTouches[0]; |
touches[1] = event.changedTouches[1]; |
} |
} |
else { |
touches[0] = event.touches[0]; |
touches[1] = event.touches[1]; |
} |
} |
return touches; |
} |
function pointerAverage (pointers) { |
var average = { |
pageX : 0, |
pageY : 0, |
clientX: 0, |
clientY: 0, |
screenX: 0, |
screenY: 0 |
}; |
var prop; |
for (var i = 0; i < pointers.length; i++) { |
for (prop in average) { |
average[prop] += pointers[i][prop]; |
} |
} |
for (prop in average) { |
average[prop] /= pointers.length; |
} |
return average; |
} |
function touchBBox (event) { |
if (!event.length && !(event.touches && event.touches.length > 1)) { |
return; |
} |
var touches = getTouchPair(event), |
minX = Math.min(touches[0].pageX, touches[1].pageX), |
minY = Math.min(touches[0].pageY, touches[1].pageY), |
maxX = Math.max(touches[0].pageX, touches[1].pageX), |
maxY = Math.max(touches[0].pageY, touches[1].pageY); |
return { |
x: minX, |
y: minY, |
left: minX, |
top: minY, |
width: maxX - minX, |
height: maxY - minY |
}; |
} |
function touchDistance (event, deltaSource) { |
deltaSource = deltaSource || defaultOptions.deltaSource; |
var sourceX = deltaSource + 'X', |
sourceY = deltaSource + 'Y', |
touches = getTouchPair(event); |
var dx = touches[0][sourceX] - touches[1][sourceX], |
dy = touches[0][sourceY] - touches[1][sourceY]; |
return hypot(dx, dy); |
} |
function touchAngle (event, prevAngle, deltaSource) { |
deltaSource = deltaSource || defaultOptions.deltaSource; |
var sourceX = deltaSource + 'X', |
sourceY = deltaSource + 'Y', |
touches = getTouchPair(event), |
dx = touches[0][sourceX] - touches[1][sourceX], |
dy = touches[0][sourceY] - touches[1][sourceY], |
angle = 180 * Math.atan(dy / dx) / Math.PI; |
if (isNumber(prevAngle)) { |
var dr = angle - prevAngle, |
drClamped = dr % 360; |
if (drClamped > 315) { |
angle -= 360 + (angle / 360)|0 * 360; |
} |
else if (drClamped > 135) { |
angle -= 180 + (angle / 360)|0 * 360; |
} |
else if (drClamped < -315) { |
angle += 360 + (angle / 360)|0 * 360; |
} |
else if (drClamped < -135) { |
angle += 180 + (angle / 360)|0 * 360; |
} |
} |
return angle; |
} |
function getOriginXY (interactable, element) { |
var origin = interactable |
? interactable.options.origin |
: defaultOptions.origin; |
if (origin === 'parent') { |
origin = parentElement(element); |
} |
else if (origin === 'self') { |
origin = interactable.getRect(element); |
} |
else if (trySelector(origin)) { |
origin = closest(element, origin) || { x: 0, y: 0 }; |
} |
if (isFunction(origin)) { |
origin = origin(interactable && element); |
} |
if (isElement(origin)) { |
origin = getElementRect(origin); |
} |
origin.x = ('x' in origin)? origin.x : origin.left; |
origin.y = ('y' in origin)? origin.y : origin.top; |
return origin; |
} |
// http://stackoverflow.com/a/5634528/2280888 |
function _getQBezierValue(t, p1, p2, p3) { |
var iT = 1 - t; |
return iT * iT * p1 + 2 * iT * t * p2 + t * t * p3; |
} |
function getQuadraticCurvePoint(startX, startY, cpX, cpY, endX, endY, position) { |
return { |
x: _getQBezierValue(position, startX, cpX, endX), |
y: _getQBezierValue(position, startY, cpY, endY) |
}; |
} |
// http://gizma.com/easing/ |
function easeOutQuad (t, b, c, d) { |
t /= d; |
return -c * t*(t-2) + b; |
} |
function nodeContains (parent, child) { |
while (child) { |
if (child === parent) { |
return true; |
} |
child = child.parentNode; |
} |
return false; |
} |
function closest (child, selector) { |
var parent = parentElement(child); |
while (isElement(parent)) { |
if (matchesSelector(parent, selector)) { return parent; } |
parent = parentElement(parent); |
} |
return null; |
} |
function parentElement (node) { |
var parent = node.parentNode; |
if (isDocFrag(parent)) { |
// skip past #shado-root fragments |
while ((parent = parent.host) && isDocFrag(parent)) {} |
return parent; |
} |
return parent; |
} |
function inContext (interactable, element) { |
return interactable._context === element.ownerDocument |
|| nodeContains(interactable._context, element); |
} |
function testIgnore (interactable, interactableElement, element) { |
var ignoreFrom = interactable.options.ignoreFrom; |
if (!ignoreFrom || !isElement(element)) { return false; } |
if (isString(ignoreFrom)) { |
return matchesUpTo(element, ignoreFrom, interactableElement); |
} |
else if (isElement(ignoreFrom)) { |
return nodeContains(ignoreFrom, element); |
} |
return false; |
} |
function testAllow (interactable, interactableElement, element) { |
var allowFrom = interactable.options.allowFrom; |
if (!allowFrom) { return true; } |
if (!isElement(element)) { return false; } |
if (isString(allowFrom)) { |
return matchesUpTo(element, allowFrom, interactableElement); |
} |
else if (isElement(allowFrom)) { |
return nodeContains(allowFrom, element); |
} |
return false; |
} |
function checkAxis (axis, interactable) { |
if (!interactable) { return false; } |
var thisAxis = interactable.options.drag.axis; |
return (axis === 'xy' || thisAxis === 'xy' || thisAxis === axis); |
} |
function checkSnap (interactable, action) { |
var options = interactable.options; |
if (/^resize/.test(action)) { |
action = 'resize'; |
} |
return options[action].snap && options[action].snap.enabled; |
} |
function checkRestrict (interactable, action) { |
var options = interactable.options; |
if (/^resize/.test(action)) { |
action = 'resize'; |
} |
return options[action].restrict && options[action].restrict.enabled; |
} |
function checkAutoScroll (interactable, action) { |
var options = interactable.options; |
if (/^resize/.test(action)) { |
action = 'resize'; |
} |
return options[action].autoScroll && options[action].autoScroll.enabled; |
} |
function withinInteractionLimit (interactable, element, action) { |
var options = interactable.options, |
maxActions = options[action.name].max, |
maxPerElement = options[action.name].maxPerElement, |
activeInteractions = 0, |
targetCount = 0, |
targetElementCount = 0; |
for (var i = 0, len = interactions.length; i < len; i++) { |
var interaction = interactions[i], |
otherAction = interaction.prepared.name, |
active = interaction.interacting(); |
if (!active) { continue; } |
activeInteractions++; |
if (activeInteractions >= maxInteractions) { |
return false; |
} |
if (interaction.target !== interactable) { continue; } |
targetCount += (otherAction === action.name)|0; |
if (targetCount >= maxActions) { |
return false; |
} |
if (interaction.element === element) { |
targetElementCount++; |
if (otherAction !== action.name || targetElementCount >= maxPerElement) { |
return false; |
} |
} |
} |
return maxInteractions > 0; |
} |
// Test for the element that's "above" all other qualifiers |
function indexOfDeepestElement (elements) { |
var dropzone, |
deepestZone = elements[0], |
index = deepestZone? 0: -1, |
parent, |
deepestZoneParents = [], |
dropzoneParents = [], |
child, |
i, |
n; |
for (i = 1; i < elements.length; i++) { |
dropzone = elements[i]; |
// an element might belong to multiple selector dropzones |
if (!dropzone || dropzone === deepestZone) { |
continue; |
} |
if (!deepestZone) { |
deepestZone = dropzone; |
index = i; |
continue; |
} |
// check if the deepest or current are document.documentElement or document.rootElement |
// - if the current dropzone is, do nothing and continue |
if (dropzone.parentNode === dropzone.ownerDocument) { |
continue; |
} |
// - if deepest is, update with the current dropzone and continue to next |
else if (deepestZone.parentNode === dropzone.ownerDocument) { |
deepestZone = dropzone; |
index = i; |
continue; |
} |
if (!deepestZoneParents.length) { |
parent = deepestZone; |
while (parent.parentNode && parent.parentNode !== parent.ownerDocument) { |
deepestZoneParents.unshift(parent); |
parent = parent.parentNode; |
} |
} |
// if this element is an svg element and the current deepest is |
// an HTMLElement |
if (deepestZone instanceof HTMLElement |
&& dropzone instanceof SVGElement |
&& !(dropzone instanceof SVGSVGElement)) { |
if (dropzone === deepestZone.parentNode) { |
continue; |
} |
parent = dropzone.ownerSVGElement; |
} |
else { |
parent = dropzone; |
} |
dropzoneParents = []; |
while (parent.parentNode !== parent.ownerDocument) { |
dropzoneParents.unshift(parent); |
parent = parent.parentNode; |
} |
n = 0; |
// get (position of last common ancestor) + 1 |
while (dropzoneParents[n] && dropzoneParents[n] === deepestZoneParents[n]) { |
n++; |
} |
var parents = [ |
dropzoneParents[n - 1], |
dropzoneParents[n], |
deepestZoneParents[n] |
]; |
child = parents[0].lastChild; |
while (child) { |
if (child === parents[1]) { |
deepestZone = dropzone; |
index = i; |
deepestZoneParents = []; |
break; |
} |
else if (child === parents[2]) { |
break; |
} |
child = child.previousSibling; |
} |
} |
return index; |
} |
function Interaction () { |
this.target = null; // current interactable being interacted with |
this.element = null; // the target element of the interactable |
this.dropTarget = null; // the dropzone a drag target might be dropped into |
this.dropElement = null; // the element at the time of checking |
this.prevDropTarget = null; // the dropzone that was recently dragged away from |
this.prevDropElement = null; // the element at the time of checking |
this.prepared = { // action that's ready to be fired on next move event |
name : null, |
axis : null, |
edges: null |
}; |
this.matches = []; // all selectors that are matched by target element |
this.matchElements = []; // corresponding elements |
this.inertiaStatus = { |
active : false, |
smoothEnd : false, |
ending : false, |
startEvent: null, |
upCoords: {}, |
xe: 0, ye: 0, |
sx: 0, sy: 0, |
t0: 0, |
vx0: 0, vys: 0, |
duration: 0, |
resumeDx: 0, |
resumeDy: 0, |
lambda_v0: 0, |
one_ve_v0: 0, |
i : null |
}; |
if (isFunction(Function.prototype.bind)) { |
this.boundInertiaFrame = this.inertiaFrame.bind(this); |
this.boundSmoothEndFrame = this.smoothEndFrame.bind(this); |
} |
else { |
var that = this; |
this.boundInertiaFrame = function () { return that.inertiaFrame(); }; |
this.boundSmoothEndFrame = function () { return that.smoothEndFrame(); }; |
} |
this.activeDrops = { |
dropzones: [], // the dropzones that are mentioned below |
elements : [], // elements of dropzones that accept the target draggable |
rects : [] // the rects of the elements mentioned above |
}; |
// keep track of added pointers |
this.pointers = []; |
this.pointerIds = []; |
this.downTargets = []; |
this.downTimes = []; |
this.holdTimers = []; |
// Previous native pointer move event coordinates |
this.prevCoords = { |
page : { x: 0, y: 0 }, |
client : { x: 0, y: 0 }, |
timeStamp: 0 |
}; |
// current native pointer move event coordinates |
this.curCoords = { |
page : { x: 0, y: 0 }, |
client : { x: 0, y: 0 }, |
timeStamp: 0 |
}; |
// Starting InteractEvent pointer coordinates |
this.startCoords = { |
page : { x: 0, y: 0 }, |
client : { x: 0, y: 0 }, |
timeStamp: 0 |
}; |
// Change in coordinates and time of the pointer |
this.pointerDelta = { |
page : { x: 0, y: 0, vx: 0, vy: 0, speed: 0 }, |
client : { x: 0, y: 0, vx: 0, vy: 0, speed: 0 }, |
timeStamp: 0 |
}; |
this.downEvent = null; // pointerdown/mousedown/touchstart event |
this.downPointer = {}; |
this._eventTarget = null; |
this._curEventTarget = null; |
this.prevEvent = null; // previous action event |
this.tapTime = 0; // time of the most recent tap event |
this.prevTap = null; |
this.startOffset = { left: 0, right: 0, top: 0, bottom: 0 }; |
this.restrictOffset = { left: 0, right: 0, top: 0, bottom: 0 }; |
this.snapOffsets = []; |
this.gesture = { |
start: { x: 0, y: 0 }, |
startDistance: 0, // distance between two touches of touchStart |
prevDistance : 0, |
distance : 0, |
scale: 1, // gesture.distance / gesture.startDistance |
startAngle: 0, // angle of line joining two touches |
prevAngle : 0 // angle of the previous gesture event |
}; |
this.snapStatus = { |
x : 0, y : 0, |
dx : 0, dy : 0, |
realX : 0, realY : 0, |
snappedX: 0, snappedY: 0, |
targets : [], |
locked : false, |
changed : false |
}; |
this.restrictStatus = { |
dx : 0, dy : 0, |
restrictedX: 0, restrictedY: 0, |
snap : null, |
restricted : false, |
changed : false |
}; |
this.restrictStatus.snap = this.snapStatus; |
this.pointerIsDown = false; |
this.pointerWasMoved = false; |
this.gesturing = false; |
this.dragging = false; |
this.resizing = false; |
this.resizeAxes = 'xy'; |
this.mouse = false; |
interactions.push(this); |
} |
Interaction.prototype = { |
getPageXY : function (pointer, xy) { return getPageXY(pointer, xy, this); }, |
getClientXY: function (pointer, xy) { return getClientXY(pointer, xy, this); }, |
setEventXY : function (target, ptr) { return setEventXY(target, ptr, this); }, |
pointerOver: function (pointer, event, eventTarget) { |
if (this.prepared.name || !this.mouse) { return; } |
var curMatches = [], |
curMatchElements = [], |
prevTargetElement = this.element; |
this.addPointer(pointer); |
if (this.target |
&& (testIgnore(this.target, this.element, eventTarget) |
|| !testAllow(this.target, this.element, eventTarget))) { |
// if the eventTarget should be ignored or shouldn't be allowed |
// clear the previous target |
this.target = null; |
this.element = null; |
this.matches = []; |
this.matchElements = []; |
} |
var elementInteractable = interactables.get(eventTarget), |
elementAction = (elementInteractable |
&& !testIgnore(elementInteractable, eventTarget, eventTarget) |
&& testAllow(elementInteractable, eventTarget, eventTarget) |
&& validateAction( |
elementInteractable.getAction(pointer, event, this, eventTarget), |
elementInteractable)); |
if (elementAction && !withinInteractionLimit(elementInteractable, eventTarget, elementAction)) { |
elementAction = null; |
} |
function pushCurMatches (interactable, selector) { |
if (interactable |
&& isElement(eventTarget) |
&& inContext(interactable, eventTarget) |
&& !testIgnore(interactable, eventTarget, eventTarget) |
&& testAllow(interactable, eventTarget, eventTarget) |
&& matchesSelector(eventTarget, selector)) { |
curMatches.push(interactable); |
curMatchElements.push(eventTarget); |
} |
} |
if (elementAction) { |
this.target = elementInteractable; |
this.element = eventTarget; |
this.matches = []; |
this.matchElements = []; |
} |
else { |
interactables.forEachSelector(pushCurMatches); |
if (this.validateSelector(pointer, event, curMatches, curMatchElements)) { |
this.matches = curMatches; |
this.matchElements = curMatchElements; |
this.pointerHover(pointer, event, this.matches, this.matchElements); |
events.add(eventTarget, |
supportsPointerEvent? pEventTypes.move : 'mousemove', |
listeners.pointerHover); |
} |
else if (this.target) { |
if (nodeContains(prevTargetElement, eventTarget)) { |
this.pointerHover(pointer, event, this.matches, this.matchElements); |
events.add(this.element, |
supportsPointerEvent? pEventTypes.move : 'mousemove', |
listeners.pointerHover); |
} |
else { |
this.target = null; |
this.element = null; |
this.matches = []; |
this.matchElements = []; |
} |
} |
} |
}, |
// Check what action would be performed on pointerMove target if a mouse |
// button were pressed and change the cursor accordingly |
pointerHover: function (pointer, event, eventTarget, curEventTarget, matches, matchElements) { |
var target = this.target; |
if (!this.prepared.name && this.mouse) { |
var action; |
// update pointer coords for defaultActionChecker to use |
this.setEventXY(this.curCoords, [pointer]); |
if (matches) { |
action = this.validateSelector(pointer, event, matches, matchElements); |
} |
else if (target) { |
action = validateAction(target.getAction(this.pointers[0], event, this, this.element), this.target); |
} |
if (target && target.options.styleCursor) { |
if (action) { |
target._doc.documentElement.style.cursor = getActionCursor(action); |
} |
else { |
target._doc.documentElement.style.cursor = ''; |
} |
} |
} |
else if (this.prepared.name) { |
this.checkAndPreventDefault(event, target, this.element); |
} |
}, |
pointerOut: function (pointer, event, eventTarget) { |
if (this.prepared.name) { return; } |
// Remove temporary event listeners for selector Interactables |
if (!interactables.get(eventTarget)) { |
events.remove(eventTarget, |
supportsPointerEvent? pEventTypes.move : 'mousemove', |
listeners.pointerHover); |
} |
if (this.target && this.target.options.styleCursor && !this.interacting()) { |
this.target._doc.documentElement.style.cursor = ''; |
} |
}, |
selectorDown: function (pointer, event, eventTarget, curEventTarget) { |
var that = this, |
// copy event to be used in timeout for IE8 |
eventCopy = events.useAttachEvent? extend({}, event) : event, |
element = eventTarget, |
pointerIndex = this.addPointer(pointer), |
action; |
this.holdTimers[pointerIndex] = setTimeout(function () { |
that.pointerHold(events.useAttachEvent? eventCopy : pointer, eventCopy, eventTarget, curEventTarget); |
}, defaultOptions._holdDuration); |
this.pointerIsDown = true; |
// Check if the down event hits the current inertia target |
if (this.inertiaStatus.active && this.target.selector) { |
// climb up the DOM tree from the event target |
while (isElement(element)) { |
// if this element is the current inertia target element |
if (element === this.element |
// and the prospective action is the same as the ongoing one |
&& validateAction(this.target.getAction(pointer, event, this, this.element), this.target).name === this.prepared.name) { |
// stop inertia so that the next move will be a normal one |
cancelFrame(this.inertiaStatus.i); |
this.inertiaStatus.active = false; |
this.collectEventTargets(pointer, event, eventTarget, 'down'); |
return; |
} |
element = parentElement(element); |
} |
} |
// do nothing if interacting |
if (this.interacting()) { |
this.collectEventTargets(pointer, event, eventTarget, 'down'); |
return; |
} |
function pushMatches (interactable, selector, context) { |
var elements = ie8MatchesSelector |
? context.querySelectorAll(selector) |
: undefined; |
if (inContext(interactable, element) |
&& !testIgnore(interactable, element, eventTarget) |
&& testAllow(interactable, element, eventTarget) |
&& matchesSelector(element, selector, elements)) { |
that.matches.push(interactable); |
that.matchElements.push(element); |
} |
} |
// update pointer coords for defaultActionChecker to use |
this.setEventXY(this.curCoords, [pointer]); |
this.downEvent = event; |
while (isElement(element) && !action) { |
this.matches = []; |
this.matchElements = []; |
interactables.forEachSelector(pushMatches); |
action = this.validateSelector(pointer, event, this.matches, this.matchElements); |
element = parentElement(element); |
} |
if (action) { |
this.prepared.name = action.name; |
this.prepared.axis = action.axis; |
this.prepared.edges = action.edges; |
this.collectEventTargets(pointer, event, eventTarget, 'down'); |
return this.pointerDown(pointer, event, eventTarget, curEventTarget, action); |
} |
else { |
// do these now since pointerDown isn't being called from here |
this.downTimes[pointerIndex] = new Date().getTime(); |
this.downTargets[pointerIndex] = eventTarget; |
pointerExtend(this.downPointer, pointer); |
copyCoords(this.prevCoords, this.curCoords); |
this.pointerWasMoved = false; |
} |
this.collectEventTargets(pointer, event, eventTarget, 'down'); |
}, |
// Determine action to be performed on next pointerMove and add appropriate |
// style and event Listeners |
pointerDown: function (pointer, event, eventTarget, curEventTarget, forceAction) { |
if (!forceAction && !this.inertiaStatus.active && this.pointerWasMoved && this.prepared.name) { |
this.checkAndPreventDefault(event, this.target, this.element); |
return; |
} |
this.pointerIsDown = true; |
this.downEvent = event; |
var pointerIndex = this.addPointer(pointer), |
action; |
// If it is the second touch of a multi-touch gesture, keep the |
// target the same and get a new action if a target was set by the |
// first touch |
if (this.pointerIds.length > 1 && this.target._element === this.element) { |
var newAction = validateAction(forceAction || this.target.getAction(pointer, event, this, this.element), this.target); |
if (withinInteractionLimit(this.target, this.element, newAction)) { |
action = newAction; |
} |
this.prepared.name = null; |
} |
// Otherwise, set the target if there is no action prepared |
else if (!this.prepared.name) { |
var interactable = interactables.get(curEventTarget); |
if (interactable |
&& !testIgnore(interactable, curEventTarget, eventTarget) |
&& testAllow(interactable, curEventTarget, eventTarget) |
&& (action = validateAction(forceAction || interactable.getAction(pointer, event, this, curEventTarget), interactable, eventTarget)) |
&& withinInteractionLimit(interactable, curEventTarget, action)) { |
this.target = interactable; |
this.element = curEventTarget; |
} |
} |
var target = this.target, |
options = target && target.options; |
if (target && (forceAction || !this.prepared.name)) { |
action = action || validateAction(forceAction || target.getAction(pointer, event, this, curEventTarget), target, this.element); |
this.setEventXY(this.startCoords, this.pointers); |
if (!action) { return; } |
if (options.styleCursor) { |
target._doc.documentElement.style.cursor = getActionCursor(action); |
} |
this.resizeAxes = action.name === 'resize'? action.axis : null; |
if (action === 'gesture' && this.pointerIds.length < 2) { |
action = null; |
} |
this.prepared.name = action.name; |
this.prepared.axis = action.axis; |
this.prepared.edges = action.edges; |
this.snapStatus.snappedX = this.snapStatus.snappedY = |
this.restrictStatus.restrictedX = this.restrictStatus.restrictedY = NaN; |
this.downTimes[pointerIndex] = new Date().getTime(); |
this.downTargets[pointerIndex] = eventTarget; |
pointerExtend(this.downPointer, pointer); |
copyCoords(this.prevCoords, this.startCoords); |
this.pointerWasMoved = false; |
this.checkAndPreventDefault(event, target, this.element); |
} |
// if inertia is active try to resume action |
else if (this.inertiaStatus.active |
&& curEventTarget === this.element |
&& validateAction(target.getAction(pointer, event, this, this.element), target).name === this.prepared.name) { |
cancelFrame(this.inertiaStatus.i); |
this.inertiaStatus.active = false; |
this.checkAndPreventDefault(event, target, this.element); |
} |
}, |
setModifications: function (coords, preEnd) { |
var target = this.target, |
shouldMove = true, |
shouldSnap = checkSnap(target, this.prepared.name) && (!target.options[this.prepared.name].snap.endOnly || preEnd), |
shouldRestrict = checkRestrict(target, this.prepared.name) && (!target.options[this.prepared.name].restrict.endOnly || preEnd); |
if (shouldSnap ) { this.setSnapping (coords); } else { this.snapStatus .locked = false; } |
if (shouldRestrict) { this.setRestriction(coords); } else { this.restrictStatus.restricted = false; } |
if (shouldSnap && this.snapStatus.locked && !this.snapStatus.changed) { |
shouldMove = shouldRestrict && this.restrictStatus.restricted && this.restrictStatus.changed; |
} |
else if (shouldRestrict && this.restrictStatus.restricted && !this.restrictStatus.changed) { |
shouldMove = false; |
} |
return shouldMove; |
}, |
setStartOffsets: function (action, interactable, element) { |
var rect = interactable.getRect(element), |
origin = getOriginXY(interactable, element), |
snap = interactable.options[this.prepared.name].snap, |
restrict = interactable.options[this.prepared.name].restrict, |
width, height; |
if (rect) { |
this.startOffset.left = this.startCoords.page.x - rect.left; |
this.startOffset.top = this.startCoords.page.y - rect.top; |
this.startOffset.right = rect.right - this.startCoords.page.x; |
this.startOffset.bottom = rect.bottom - this.startCoords.page.y; |
if ('width' in rect) { width = rect.width; } |
else { width = rect.right - rect.left; } |
if ('height' in rect) { height = rect.height; } |
else { height = rect.bottom - rect.top; } |
} |
else { |
this.startOffset.left = this.startOffset.top = this.startOffset.right = this.startOffset.bottom = 0; |
} |
this.snapOffsets.splice(0); |
var snapOffset = snap && snap.offset === 'startCoords' |
? { |
x: this.startCoords.page.x - origin.x, |
y: this.startCoords.page.y - origin.y |
} |
: snap && snap.offset || { x: 0, y: 0 }; |
if (rect && snap && snap.relativePoints && snap.relativePoints.length) { |
for (var i = 0; i < snap.relativePoints.length; i++) { |
this.snapOffsets.push({ |
x: this.startOffset.left - (width * snap.relativePoints[i].x) + snapOffset.x, |
y: this.startOffset.top - (height * snap.relativePoints[i].y) + snapOffset.y |
}); |
} |
} |
else { |
this.snapOffsets.push(snapOffset); |
} |
if (rect && restrict.elementRect) { |
this.restrictOffset.left = this.startOffset.left - (width * restrict.elementRect.left); |
this.restrictOffset.top = this.startOffset.top - (height * restrict.elementRect.top); |
this.restrictOffset.right = this.startOffset.right - (width * (1 - restrict.elementRect.right)); |
this.restrictOffset.bottom = this.startOffset.bottom - (height * (1 - restrict.elementRect.bottom)); |
} |
else { |
this.restrictOffset.left = this.restrictOffset.top = this.restrictOffset.right = this.restrictOffset.bottom = 0; |
} |
}, |
/*\ |
* Interaction.start |
[ method ] |
* |
* Start an action with the given Interactable and Element as tartgets. The |
* action must be enabled for the target Interactable and an appropriate number |
* of pointers must be held down – 1 for drag/resize, 2 for gesture. |
* |
* Use it with `interactable.<action>able({ manualStart: false })` to always |
* [start actions manually](https://github.com/taye/interact.js/issues/114) |
* |
- action (object) The action to be performed - drag, resize, etc. |
- interactable (Interactable) The Interactable to target |
- element (Element) The DOM Element to target |
= (object) interact |
** |
| interact(target) |
| .draggable({ |
| // disable the default drag start by down->move |
| manualStart: true |
| }) |
| // start dragging after the user holds the pointer down |
| .on('hold', function (event) { |
| var interaction = event.interaction; |
| |
| if (!interaction.interacting()) { |
| interaction.start({ name: 'drag' }, |
| event.interactable, |
| event.currentTarget); |
| } |
| }); |
\*/ |
start: function (action, interactable, element) { |
if (this.interacting() |
|| !this.pointerIsDown |
|| this.pointerIds.length < (action.name === 'gesture'? 2 : 1)) { |
return; |
} |
// if this interaction had been removed after stopping |
// add it back |
if (indexOf(interactions, this) === -1) { |
interactions.push(this); |
} |
// set the startCoords if there was no prepared action |
if (!this.prepared.name) { |
this.setEventXY(this.startCoords, this.pointers); |
} |
this.prepared.name = action.name; |
this.prepared.axis = action.axis; |
this.prepared.edges = action.edges; |
this.target = interactable; |
this.element = element; |
this.setStartOffsets(action.name, interactable, element); |
this.setModifications(this.startCoords.page); |
this.prevEvent = this[this.prepared.name + 'Start'](this.downEvent); |
}, |
pointerMove: function (pointer, event, eventTarget, curEventTarget, preEnd) { |
if (this.inertiaStatus.active) { |
var pageUp = this.inertiaStatus.upCoords.page; |
var clientUp = this.inertiaStatus.upCoords.client; |
var inertiaPosition = { |
pageX : pageUp.x + this.inertiaStatus.sx, |
pageY : pageUp.y + this.inertiaStatus.sy, |
clientX: clientUp.x + this.inertiaStatus.sx, |
clientY: clientUp.y + this.inertiaStatus.sy |
}; |
this.setEventXY(this.curCoords, [inertiaPosition]); |
} |
else { |
this.recordPointer(pointer); |
this.setEventXY(this.curCoords, this.pointers); |
} |
var duplicateMove = (this.curCoords.page.x === this.prevCoords.page.x |
&& this.curCoords.page.y === this.prevCoords.page.y |
&& this.curCoords.client.x === this.prevCoords.client.x |
&& this.curCoords.client.y === this.prevCoords.client.y); |
var dx, dy, |
pointerIndex = this.mouse? 0 : indexOf(this.pointerIds, getPointerId(pointer)); |
// register movement greater than pointerMoveTolerance |
if (this.pointerIsDown && !this.pointerWasMoved) { |
dx = this.curCoords.client.x - this.startCoords.client.x; |
dy = this.curCoords.client.y - this.startCoords.client.y; |
this.pointerWasMoved = hypot(dx, dy) > pointerMoveTolerance; |
} |
if (!duplicateMove && (!this.pointerIsDown || this.pointerWasMoved)) { |
if (this.pointerIsDown) { |
clearTimeout(this.holdTimers[pointerIndex]); |
} |
this.collectEventTargets(pointer, event, eventTarget, 'move'); |
} |
if (!this.pointerIsDown) { return; } |
if (duplicateMove && this.pointerWasMoved && !preEnd) { |
this.checkAndPreventDefault(event, this.target, this.element); |
return; |
} |
// set pointer coordinate, time changes and speeds |
setEventDeltas(this.pointerDelta, this.prevCoords, this.curCoords); |
if (!this.prepared.name) { return; } |
if (this.pointerWasMoved |
// ignore movement while inertia is active |
&& (!this.inertiaStatus.active || (pointer instanceof InteractEvent && /inertiastart/.test(pointer.type)))) { |
// if just starting an action, calculate the pointer speed now |
if (!this.interacting()) { |
setEventDeltas(this.pointerDelta, this.prevCoords, this.curCoords); |
// check if a drag is in the correct axis |
if (this.prepared.name === 'drag') { |
var absX = Math.abs(dx), |
absY = Math.abs(dy), |
targetAxis = this.target.options.drag.axis, |
axis = (absX > absY ? 'x' : absX < absY ? 'y' : 'xy'); |
// if the movement isn't in the axis of the interactable |
if (axis !== 'xy' && targetAxis !== 'xy' && targetAxis !== axis) { |
// cancel the prepared action |
this.prepared.name = null; |
// then try to get a drag from another ineractable |
var element = eventTarget; |
// check element interactables |
while (isElement(element)) { |
var elementInteractable = interactables.get(element); |
if (elementInteractable |
&& elementInteractable !== this.target |
&& !elementInteractable.options.drag.manualStart |
&& elementInteractable.getAction(this.downPointer, this.downEvent, this, element).name === 'drag' |
&& checkAxis(axis, elementInteractable)) { |
this.prepared.name = 'drag'; |
this.target = elementInteractable; |
this.element = element; |
break; |
} |
element = parentElement(element); |
} |
// if there's no drag from element interactables, |
// check the selector interactables |
if (!this.prepared.name) { |
var thisInteraction = this; |
var getDraggable = function (interactable, selector, context) { |
var elements = ie8MatchesSelector |
? context.querySelectorAll(selector) |
: undefined; |
if (interactable === thisInteraction.target) { return; } |
if (inContext(interactable, eventTarget) |
&& !interactable.options.drag.manualStart |
&& !testIgnore(interactable, element, eventTarget) |
&& testAllow(interactable, element, eventTarget) |
&& matchesSelector(element, selector, elements) |
&& interactable.getAction(thisInteraction.downPointer, thisInteraction.downEvent, thisInteraction, element).name === 'drag' |
&& checkAxis(axis, interactable) |
&& withinInteractionLimit(interactable, element, 'drag')) { |
return interactable; |
} |
}; |
element = eventTarget; |
while (isElement(element)) { |
var selectorInteractable = interactables.forEachSelector(getDraggable); |
if (selectorInteractable) { |
this.prepared.name = 'drag'; |
this.target = selectorInteractable; |
this.element = element; |
break; |
} |
element = parentElement(element); |
} |
} |
} |
} |
} |
var starting = !!this.prepared.name && !this.interacting(); |
if (starting |
&& (this.target.options[this.prepared.name].manualStart |
|| !withinInteractionLimit(this.target, this.element, this.prepared))) { |
this.stop(event); |
return; |
} |
if (this.prepared.name && this.target) { |
if (starting) { |
this.start(this.prepared, this.target, this.element); |
} |
var shouldMove = this.setModifications(this.curCoords.page, preEnd); |
// move if snapping or restriction doesn't prevent it |
if (shouldMove || starting) { |
this.prevEvent = this[this.prepared.name + 'Move'](event); |
} |
this.checkAndPreventDefault(event, this.target, this.element); |
} |
} |
copyCoords(this.prevCoords, this.curCoords); |
if (this.dragging || this.resizing) { |
this.autoScrollMove(pointer); |
} |
}, |
dragStart: function (event) { |
var dragEvent = new InteractEvent(this, event, 'drag', 'start', this.element); |
this.dragging = true; |
this.target.fire(dragEvent); |
// reset active dropzones |
this.activeDrops.dropzones = []; |
this.activeDrops.elements = []; |
this.activeDrops.rects = []; |
if (!this.dynamicDrop) { |
this.setActiveDrops(this.element); |
} |
var dropEvents = this.getDropEvents(event, dragEvent); |
if (dropEvents.activate) { |
this.fireActiveDrops(dropEvents.activate); |
} |
return dragEvent; |
}, |
dragMove: function (event) { |
var target = this.target, |
dragEvent = new InteractEvent(this, event, 'drag', 'move', this.element), |
draggableElement = this.element, |
drop = this.getDrop(dragEvent, event, draggableElement); |
this.dropTarget = drop.dropzone; |
this.dropElement = drop.element; |
var dropEvents = this.getDropEvents(event, dragEvent); |
target.fire(dragEvent); |
if (dropEvents.leave) { this.prevDropTarget.fire(dropEvents.leave); } |
if (dropEvents.enter) { this.dropTarget.fire(dropEvents.enter); } |
if (dropEvents.move ) { this.dropTarget.fire(dropEvents.move ); } |
this.prevDropTarget = this.dropTarget; |
this.prevDropElement = this.dropElement; |
return dragEvent; |
}, |
resizeStart: function (event) { |
var resizeEvent = new InteractEvent(this, event, 'resize', 'start', this.element); |
if (this.prepared.edges) { |
var startRect = this.target.getRect(this.element); |
/* |
* When using the `resizable.square` or `resizable.preserveAspectRatio` options, resizing from one edge |
* will affect another. E.g. with `resizable.square`, resizing to make the right edge larger will make |
* the bottom edge larger by the same amount. We call these 'linked' edges. Any linked edges will depend |
* on the active edges and the edge being interacted with. |
*/ |
if (this.target.options.resize.square || this.target.options.resize.preserveAspectRatio) { |
var linkedEdges = extend({}, this.prepared.edges); |
linkedEdges.top = linkedEdges.top || (linkedEdges.left && !linkedEdges.bottom); |
linkedEdges.left = linkedEdges.left || (linkedEdges.top && !linkedEdges.right ); |
linkedEdges.bottom = linkedEdges.bottom || (linkedEdges.right && !linkedEdges.top ); |
linkedEdges.right = linkedEdges.right || (linkedEdges.bottom && !linkedEdges.left ); |
this.prepared._linkedEdges = linkedEdges; |
} |
else { |
this.prepared._linkedEdges = null; |
} |
// if using `resizable.preserveAspectRatio` option, record aspect ratio at the start of the resize |
if (this.target.options.resize.preserveAspectRatio) { |
this.resizeStartAspectRatio = startRect.width / startRect.height; |
} |
this.resizeRects = { |
start : startRect, |
current : extend({}, startRect), |
restricted: extend({}, startRect), |
previous : extend({}, startRect), |
delta : { |
left: 0, right : 0, width : 0, |
top : 0, bottom: 0, height: 0 |
} |
}; |
resizeEvent.rect = this.resizeRects.restricted; |
resizeEvent.deltaRect = this.resizeRects.delta; |
} |
this.target.fire(resizeEvent); |
this.resizing = true; |
return resizeEvent; |
}, |
resizeMove: function (event) { |
var resizeEvent = new InteractEvent(this, event, 'resize', 'move', this.element); |
var edges = this.prepared.edges, |
invert = this.target.options.resize.invert, |
invertible = invert === 'reposition' || invert === 'negate'; |
if (edges) { |
var dx = resizeEvent.dx, |
dy = resizeEvent.dy, |
start = this.resizeRects.start, |
current = this.resizeRects.current, |
restricted = this.resizeRects.restricted, |
delta = this.resizeRects.delta, |
previous = extend(this.resizeRects.previous, restricted), |
originalEdges = edges; |
// `resize.preserveAspectRatio` takes precedence over `resize.square` |
if (this.target.options.resize.preserveAspectRatio) { |
var resizeStartAspectRatio = this.resizeStartAspectRatio; |
edges = this.prepared._linkedEdges; |
if ((originalEdges.left && originalEdges.bottom) |
|| (originalEdges.right && originalEdges.top)) { |
dy = -dx / resizeStartAspectRatio; |
} |
else if (originalEdges.left || originalEdges.right) { dy = dx / resizeStartAspectRatio; } |
else if (originalEdges.top || originalEdges.bottom) { dx = dy * resizeStartAspectRatio; } |
} |
else if (this.target.options.resize.square) { |
edges = this.prepared._linkedEdges; |
if ((originalEdges.left && originalEdges.bottom) |
|| (originalEdges.right && originalEdges.top)) { |
dy = -dx; |
} |
else if (originalEdges.left || originalEdges.right) { dy = dx; } |
else if (originalEdges.top || originalEdges.bottom) { dx = dy; } |
} |
// update the 'current' rect without modifications |
if (edges.top ) { current.top += dy; } |
if (edges.bottom) { current.bottom += dy; } |
if (edges.left ) { current.left += dx; } |
if (edges.right ) { current.right += dx; } |
if (invertible) { |
// if invertible, copy the current rect |
extend(restricted, current); |
if (invert === 'reposition') { |
// swap edge values if necessary to keep width/height positive |
var swap; |
if (restricted.top > restricted.bottom) { |
swap = restricted.top; |
restricted.top = restricted.bottom; |
restricted.bottom = swap; |
} |
if (restricted.left > restricted.right) { |
swap = restricted.left; |
restricted.left = restricted.right; |
restricted.right = swap; |
} |
} |
} |
else { |
// if not invertible, restrict to minimum of 0x0 rect |
restricted.top = Math.min(current.top, start.bottom); |
restricted.bottom = Math.max(current.bottom, start.top); |
restricted.left = Math.min(current.left, start.right); |
restricted.right = Math.max(current.right, start.left); |
} |
restricted.width = restricted.right - restricted.left; |
restricted.height = restricted.bottom - restricted.top ; |
for (var edge in restricted) { |
delta[edge] = restricted[edge] - previous[edge]; |
} |
resizeEvent.edges = this.prepared.edges; |
resizeEvent.rect = restricted; |
resizeEvent.deltaRect = delta; |
} |
this.target.fire(resizeEvent); |
return resizeEvent; |
}, |
gestureStart: function (event) { |
var gestureEvent = new InteractEvent(this, event, 'gesture', 'start', this.element); |
gestureEvent.ds = 0; |
this.gesture.startDistance = this.gesture.prevDistance = gestureEvent.distance; |
this.gesture.startAngle = this.gesture.prevAngle = gestureEvent.angle; |
this.gesture.scale = 1; |
this.gesturing = true; |
this.target.fire(gestureEvent); |
return gestureEvent; |
}, |
gestureMove: function (event) { |
if (!this.pointerIds.length) { |
return this.prevEvent; |
} |
var gestureEvent; |
gestureEvent = new InteractEvent(this, event, 'gesture', 'move', this.element); |
gestureEvent.ds = gestureEvent.scale - this.gesture.scale; |
this.target.fire(gestureEvent); |
this.gesture.prevAngle = gestureEvent.angle; |
this.gesture.prevDistance = gestureEvent.distance; |
if (gestureEvent.scale !== Infinity && |
gestureEvent.scale !== null && |
gestureEvent.scale !== undefined && |
!isNaN(gestureEvent.scale)) { |
this.gesture.scale = gestureEvent.scale; |
} |
return gestureEvent; |
}, |
pointerHold: function (pointer, event, eventTarget) { |
this.collectEventTargets(pointer, event, eventTarget, 'hold'); |
}, |
pointerUp: function (pointer, event, eventTarget, curEventTarget) { |
var pointerIndex = this.mouse? 0 : indexOf(this.pointerIds, getPointerId(pointer)); |
clearTimeout(this.holdTimers[pointerIndex]); |
this.collectEventTargets(pointer, event, eventTarget, 'up' ); |
this.collectEventTargets(pointer, event, eventTarget, 'tap'); |
this.pointerEnd(pointer, event, eventTarget, curEventTarget); |
this.removePointer(pointer); |
}, |
pointerCancel: function (pointer, event, eventTarget, curEventTarget) { |
var pointerIndex = this.mouse? 0 : indexOf(this.pointerIds, getPointerId(pointer)); |
clearTimeout(this.holdTimers[pointerIndex]); |
this.collectEventTargets(pointer, event, eventTarget, 'cancel'); |
this.pointerEnd(pointer, event, eventTarget, curEventTarget); |
this.removePointer(pointer); |
}, |
// http://www.quirksmode.org/dom/events/click.html |
// >Events leading to dblclick |
// |
// IE8 doesn't fire down event before dblclick. |
// This workaround tries to fire a tap and doubletap after dblclick |
ie8Dblclick: function (pointer, event, eventTarget) { |
if (this.prevTap |
&& event.clientX === this.prevTap.clientX |
&& event.clientY === this.prevTap.clientY |
&& eventTarget === this.prevTap.target) { |
this.downTargets[0] = eventTarget; |
this.downTimes[0] = new Date().getTime(); |
this.collectEventTargets(pointer, event, eventTarget, 'tap'); |
} |
}, |
// End interact move events and stop auto-scroll unless inertia is enabled |
pointerEnd: function (pointer, event, eventTarget, curEventTarget) { |
var endEvent, |
target = this.target, |
options = target && target.options, |
inertiaOptions = options && this.prepared.name && options[this.prepared.name].inertia, |
inertiaStatus = this.inertiaStatus; |
if (this.interacting()) { |
if (inertiaStatus.active && !inertiaStatus.ending) { return; } |
var pointerSpeed, |
now = new Date().getTime(), |
inertiaPossible = false, |
inertia = false, |
smoothEnd = false, |
endSnap = checkSnap(target, this.prepared.name) && options[this.prepared.name].snap.endOnly, |
endRestrict = checkRestrict(target, this.prepared.name) && options[this.prepared.name].restrict.endOnly, |
dx = 0, |
dy = 0, |
startEvent; |
if (this.dragging) { |
if (options.drag.axis === 'x' ) { pointerSpeed = Math.abs(this.pointerDelta.client.vx); } |
else if (options.drag.axis === 'y' ) { pointerSpeed = Math.abs(this.pointerDelta.client.vy); } |
else /*options.drag.axis === 'xy'*/{ pointerSpeed = this.pointerDelta.client.speed; } |
} |
else { |
pointerSpeed = this.pointerDelta.client.speed; |
} |
// check if inertia should be started |
inertiaPossible = (inertiaOptions && inertiaOptions.enabled |
&& this.prepared.name !== 'gesture' |
&& event !== inertiaStatus.startEvent); |
inertia = (inertiaPossible |
&& (now - this.curCoords.timeStamp) < 50 |
&& pointerSpeed > inertiaOptions.minSpeed |
&& pointerSpeed > inertiaOptions.endSpeed); |
if (inertiaPossible && !inertia && (endSnap || endRestrict)) { |
var snapRestrict = {}; |
snapRestrict.snap = snapRestrict.restrict = snapRestrict; |
if (endSnap) { |
this.setSnapping(this.curCoords.page, snapRestrict); |
if (snapRestrict.locked) { |
dx += snapRestrict.dx; |
dy += snapRestrict.dy; |
} |
} |
if (endRestrict) { |
this.setRestriction(this.curCoords.page, snapRestrict); |
if (snapRestrict.restricted) { |
dx += snapRestrict.dx; |
dy += snapRestrict.dy; |
} |
} |
if (dx || dy) { |
smoothEnd = true; |
} |
} |
if (inertia || smoothEnd) { |
copyCoords(inertiaStatus.upCoords, this.curCoords); |
this.pointers[0] = inertiaStatus.startEvent = startEvent = |
new InteractEvent(this, event, this.prepared.name, 'inertiastart', this.element); |
inertiaStatus.t0 = now; |
target.fire(inertiaStatus.startEvent); |
if (inertia) { |
inertiaStatus.vx0 = this.pointerDelta.client.vx; |
inertiaStatus.vy0 = this.pointerDelta.client.vy; |
inertiaStatus.v0 = pointerSpeed; |
this.calcInertia(inertiaStatus); |
var page = extend({}, this.curCoords.page), |
origin = getOriginXY(target, this.element), |
statusObject; |
page.x = page.x + inertiaStatus.xe - origin.x; |
page.y = page.y + inertiaStatus.ye - origin.y; |
statusObject = { |
useStatusXY: true, |
x: page.x, |
y: page.y, |
dx: 0, |
dy: 0, |
snap: null |
}; |
statusObject.snap = statusObject; |
dx = dy = 0; |
if (endSnap) { |
var snap = this.setSnapping(this.curCoords.page, statusObject); |
if (snap.locked) { |
dx += snap.dx; |
dy += snap.dy; |
} |
} |
if (endRestrict) { |
var restrict = this.setRestriction(this.curCoords.page, statusObject); |
if (restrict.restricted) { |
dx += restrict.dx; |
dy += restrict.dy; |
} |
} |
inertiaStatus.modifiedXe += dx; |
inertiaStatus.modifiedYe += dy; |
inertiaStatus.i = reqFrame(this.boundInertiaFrame); |
} |
else { |
inertiaStatus.smoothEnd = true; |
inertiaStatus.xe = dx; |
inertiaStatus.ye = dy; |
inertiaStatus.sx = inertiaStatus.sy = 0; |
inertiaStatus.i = reqFrame(this.boundSmoothEndFrame); |
} |
inertiaStatus.active = true; |
return; |
} |
if (endSnap || endRestrict) { |
// fire a move event at the snapped coordinates |
this.pointerMove(pointer, event, eventTarget, curEventTarget, true); |
} |
} |
if (this.dragging) { |
endEvent = new InteractEvent(this, event, 'drag', 'end', this.element); |
var draggableElement = this.element, |
drop = this.getDrop(endEvent, event, draggableElement); |
this.dropTarget = drop.dropzone; |
this.dropElement = drop.element; |
var dropEvents = this.getDropEvents(event, endEvent); |
if (dropEvents.leave) { this.prevDropTarget.fire(dropEvents.leave); } |
if (dropEvents.enter) { this.dropTarget.fire(dropEvents.enter); } |
if (dropEvents.drop ) { this.dropTarget.fire(dropEvents.drop ); } |
if (dropEvents.deactivate) { |
this.fireActiveDrops(dropEvents.deactivate); |
} |
target.fire(endEvent); |
} |
else if (this.resizing) { |
endEvent = new InteractEvent(this, event, 'resize', 'end', this.element); |
target.fire(endEvent); |
} |
else if (this.gesturing) { |
endEvent = new InteractEvent(this, event, 'gesture', 'end', this.element); |
target.fire(endEvent); |
} |
this.stop(event); |
}, |
collectDrops: function (element) { |
var drops = [], |
elements = [], |
i; |
element = element || this.element; |
// collect all dropzones and their elements which qualify for a drop |
for (i = 0; i < interactables.length; i++) { |
if (!interactables[i].options.drop.enabled) { continue; } |
var current = interactables[i], |
accept = current.options.drop.accept; |
// test the draggable element against the dropzone's accept setting |
if ((isElement(accept) && accept !== element) |
|| (isString(accept) |
&& !matchesSelector(element, accept))) { |
continue; |
} |
// query for new elements if necessary |
var dropElements = current.selector? current._context.querySelectorAll(current.selector) : [current._element]; |
for (var j = 0, len = dropElements.length; j < len; j++) { |
var currentElement = dropElements[j]; |
if (currentElement === element) { |
continue; |
} |
drops.push(current); |
elements.push(currentElement); |
} |
} |
return { |
dropzones: drops, |
elements: elements |
}; |
}, |
fireActiveDrops: function (event) { |
var i, |
current, |
currentElement, |
prevElement; |
// loop through all active dropzones and trigger event |
for (i = 0; i < this.activeDrops.dropzones.length; i++) { |
current = this.activeDrops.dropzones[i]; |
currentElement = this.activeDrops.elements [i]; |
// prevent trigger of duplicate events on same element |
if (currentElement !== prevElement) { |
// set current element as event target |
event.target = currentElement; |
current.fire(event); |
} |
prevElement = currentElement; |
} |
}, |
// Collect a new set of possible drops and save them in activeDrops. |
// setActiveDrops should always be called when a drag has just started or a |
// drag event happens while dynamicDrop is true |
setActiveDrops: function (dragElement) { |
// get dropzones and their elements that could receive the draggable |
var possibleDrops = this.collectDrops(dragElement, true); |
this.activeDrops.dropzones = possibleDrops.dropzones; |
this.activeDrops.elements = possibleDrops.elements; |
this.activeDrops.rects = []; |
for (var i = 0; i < this.activeDrops.dropzones.length; i++) { |
this.activeDrops.rects[i] = this.activeDrops.dropzones[i].getRect(this.activeDrops.elements[i]); |
} |
}, |
getDrop: function (dragEvent, event, dragElement) { |
var validDrops = []; |
if (dynamicDrop) { |
this.setActiveDrops(dragElement); |
} |
// collect all dropzones and their elements which qualify for a drop |
for (var j = 0; j < this.activeDrops.dropzones.length; j++) { |
var current = this.activeDrops.dropzones[j], |
currentElement = this.activeDrops.elements [j], |
rect = this.activeDrops.rects [j]; |
validDrops.push(current.dropCheck(dragEvent, event, this.target, dragElement, currentElement, rect) |
? currentElement |
: null); |
} |
// get the most appropriate dropzone based on DOM depth and order |
var dropIndex = indexOfDeepestElement(validDrops), |
dropzone = this.activeDrops.dropzones[dropIndex] || null, |
element = this.activeDrops.elements [dropIndex] || null; |
return { |
dropzone: dropzone, |
element: element |
}; |
}, |
getDropEvents: function (pointerEvent, dragEvent) { |
var dropEvents = { |
enter : null, |
leave : null, |
activate : null, |
deactivate: null, |
move : null, |
drop : null |
}; |
if (this.dropElement !== this.prevDropElement) { |
// if there was a prevDropTarget, create a dragleave event |
if (this.prevDropTarget) { |
dropEvents.leave = { |
target : this.prevDropElement, |
dropzone : this.prevDropTarget, |
relatedTarget: dragEvent.target, |
draggable : dragEvent.interactable, |
dragEvent : dragEvent, |
interaction : this, |
timeStamp : dragEvent.timeStamp, |
type : 'dragleave' |
}; |
dragEvent.dragLeave = this.prevDropElement; |
dragEvent.prevDropzone = this.prevDropTarget; |
} |
// if the dropTarget is not null, create a dragenter event |
if (this.dropTarget) { |
dropEvents.enter = { |
target : this.dropElement, |
dropzone : this.dropTarget, |
relatedTarget: dragEvent.target, |
draggable : dragEvent.interactable, |
dragEvent : dragEvent, |
interaction : this, |
timeStamp : dragEvent.timeStamp, |
type : 'dragenter' |
}; |
dragEvent.dragEnter = this.dropElement; |
dragEvent.dropzone = this.dropTarget; |
} |
} |
if (dragEvent.type === 'dragend' && this.dropTarget) { |
dropEvents.drop = { |
target : this.dropElement, |
dropzone : this.dropTarget, |
relatedTarget: dragEvent.target, |
draggable : dragEvent.interactable, |
dragEvent : dragEvent, |
interaction : this, |
timeStamp : dragEvent.timeStamp, |
type : 'drop' |
}; |
dragEvent.dropzone = this.dropTarget; |
} |
if (dragEvent.type === 'dragstart') { |
dropEvents.activate = { |
target : null, |
dropzone : null, |
relatedTarget: dragEvent.target, |
draggable : dragEvent.interactable, |
dragEvent : dragEvent, |
interaction : this, |
timeStamp : dragEvent.timeStamp, |
type : 'dropactivate' |
}; |
} |
if (dragEvent.type === 'dragend') { |
dropEvents.deactivate = { |
target : null, |
dropzone : null, |
relatedTarget: dragEvent.target, |
draggable : dragEvent.interactable, |
dragEvent : dragEvent, |
interaction : this, |
timeStamp : dragEvent.timeStamp, |
type : 'dropdeactivate' |
}; |
} |
if (dragEvent.type === 'dragmove' && this.dropTarget) { |
dropEvents.move = { |
target : this.dropElement, |
dropzone : this.dropTarget, |
relatedTarget: dragEvent.target, |
draggable : dragEvent.interactable, |
dragEvent : dragEvent, |
interaction : this, |
dragmove : dragEvent, |
timeStamp : dragEvent.timeStamp, |
type : 'dropmove' |
}; |
dragEvent.dropzone = this.dropTarget; |
} |
return dropEvents; |
}, |
currentAction: function () { |
return (this.dragging && 'drag') || (this.resizing && 'resize') || (this.gesturing && 'gesture') || null; |
}, |
interacting: function () { |
return this.dragging || this.resizing || this.gesturing; |
}, |
clearTargets: function () { |
this.target = this.element = null; |
this.dropTarget = this.dropElement = this.prevDropTarget = this.prevDropElement = null; |
}, |
stop: function (event) { |
if (this.interacting()) { |
autoScroll.stop(); |
this.matches = []; |
this.matchElements = []; |
var target = this.target; |
if (target.options.styleCursor) { |
target._doc.documentElement.style.cursor = ''; |
} |
// prevent Default only if were previously interacting |
if (event && isFunction(event.preventDefault)) { |
this.checkAndPreventDefault(event, target, this.element); |
} |
if (this.dragging) { |
this.activeDrops.dropzones = this.activeDrops.elements = this.activeDrops.rects = null; |
} |
} |
this.clearTargets(); |
this.pointerIsDown = this.snapStatus.locked = this.dragging = this.resizing = this.gesturing = false; |
this.prepared.name = this.prevEvent = null; |
this.inertiaStatus.resumeDx = this.inertiaStatus.resumeDy = 0; |
// remove pointers if their ID isn't in this.pointerIds |
for (var i = 0; i < this.pointers.length; i++) { |
if (indexOf(this.pointerIds, getPointerId(this.pointers[i])) === -1) { |
this.pointers.splice(i, 1); |
} |
} |
}, |
inertiaFrame: function () { |
var inertiaStatus = this.inertiaStatus, |
options = this.target.options[this.prepared.name].inertia, |
lambda = options.resistance, |
t = new Date().getTime() / 1000 - inertiaStatus.t0; |
if (t < inertiaStatus.te) { |
var progress = 1 - (Math.exp(-lambda * t) - inertiaStatus.lambda_v0) / inertiaStatus.one_ve_v0; |
if (inertiaStatus.modifiedXe === inertiaStatus.xe && inertiaStatus.modifiedYe === inertiaStatus.ye) { |
inertiaStatus.sx = inertiaStatus.xe * progress; |
inertiaStatus.sy = inertiaStatus.ye * progress; |
} |
else { |
var quadPoint = getQuadraticCurvePoint( |
0, 0, |
inertiaStatus.xe, inertiaStatus.ye, |
inertiaStatus.modifiedXe, inertiaStatus.modifiedYe, |
progress); |
inertiaStatus.sx = quadPoint.x; |
inertiaStatus.sy = quadPoint.y; |
} |
this.pointerMove(inertiaStatus.startEvent, inertiaStatus.startEvent); |
inertiaStatus.i = reqFrame(this.boundInertiaFrame); |
} |
else { |
inertiaStatus.ending = true; |
inertiaStatus.sx = inertiaStatus.modifiedXe; |
inertiaStatus.sy = inertiaStatus.modifiedYe; |
this.pointerMove(inertiaStatus.startEvent, inertiaStatus.startEvent); |
this.pointerEnd(inertiaStatus.startEvent, inertiaStatus.startEvent); |
inertiaStatus.active = inertiaStatus.ending = false; |
} |
}, |
smoothEndFrame: function () { |
var inertiaStatus = this.inertiaStatus, |
t = new Date().getTime() - inertiaStatus.t0, |
duration = this.target.options[this.prepared.name].inertia.smoothEndDuration; |
if (t < duration) { |
inertiaStatus.sx = easeOutQuad(t, 0, inertiaStatus.xe, duration); |
inertiaStatus.sy = easeOutQuad(t, 0, inertiaStatus.ye, duration); |
this.pointerMove(inertiaStatus.startEvent, inertiaStatus.startEvent); |
inertiaStatus.i = reqFrame(this.boundSmoothEndFrame); |
} |
else { |
inertiaStatus.ending = true; |
inertiaStatus.sx = inertiaStatus.xe; |
inertiaStatus.sy = inertiaStatus.ye; |
this.pointerMove(inertiaStatus.startEvent, inertiaStatus.startEvent); |
this.pointerEnd(inertiaStatus.startEvent, inertiaStatus.startEvent); |
inertiaStatus.smoothEnd = |
inertiaStatus.active = inertiaStatus.ending = false; |
} |
}, |
addPointer: function (pointer) { |
var id = getPointerId(pointer), |
index = this.mouse? 0 : indexOf(this.pointerIds, id); |
if (index === -1) { |
index = this.pointerIds.length; |
} |
this.pointerIds[index] = id; |
this.pointers[index] = pointer; |
return index; |
}, |
removePointer: function (pointer) { |
var id = getPointerId(pointer), |
index = this.mouse? 0 : indexOf(this.pointerIds, id); |
if (index === -1) { return; } |
this.pointers .splice(index, 1); |
this.pointerIds .splice(index, 1); |
this.downTargets.splice(index, 1); |
this.downTimes .splice(index, 1); |
this.holdTimers .splice(index, 1); |
}, |
recordPointer: function (pointer) { |
var index = this.mouse? 0: indexOf(this.pointerIds, getPointerId(pointer)); |
if (index === -1) { return; } |
this.pointers[index] = pointer; |
}, |
collectEventTargets: function (pointer, event, eventTarget, eventType) { |
var pointerIndex = this.mouse? 0 : indexOf(this.pointerIds, getPointerId(pointer)); |
// do not fire a tap event if the pointer was moved before being lifted |
if (eventType === 'tap' && (this.pointerWasMoved |
// or if the pointerup target is different to the pointerdown target |
|| !(this.downTargets[pointerIndex] && this.downTargets[pointerIndex] === eventTarget))) { |
return; |
} |
var targets = [], |
elements = [], |
element = eventTarget; |
function collectSelectors (interactable, selector, context) { |
var els = ie8MatchesSelector |
? context.querySelectorAll(selector) |
: undefined; |
if (interactable._iEvents[eventType] |
&& isElement(element) |
&& inContext(interactable, element) |
&& !testIgnore(interactable, element, eventTarget) |
&& testAllow(interactable, element, eventTarget) |
&& matchesSelector(element, selector, els)) { |
targets.push(interactable); |
elements.push(element); |
} |
} |
while (element) { |
if (interact.isSet(element) && interact(element)._iEvents[eventType]) { |
targets.push(interact(element)); |
elements.push(element); |
} |
interactables.forEachSelector(collectSelectors); |
element = parentElement(element); |
} |
// create the tap event even if there are no listeners so that |
// doubletap can still be created and fired |
if (targets.length || eventType === 'tap') { |
this.firePointers(pointer, event, eventTarget, targets, elements, eventType); |
} |
}, |
firePointers: function (pointer, event, eventTarget, targets, elements, eventType) { |
var pointerIndex = this.mouse? 0 : indexOf(this.pointerIds, getPointerId(pointer)), |
pointerEvent = {}, |
i, |
// for tap events |
interval, createNewDoubleTap; |
// if it's a doubletap then the event properties would have been |
// copied from the tap event and provided as the pointer argument |
if (eventType === 'doubletap') { |
pointerEvent = pointer; |
} |
else { |
pointerExtend(pointerEvent, event); |
if (event !== pointer) { |
pointerExtend(pointerEvent, pointer); |
} |
pointerEvent.preventDefault = preventOriginalDefault; |
pointerEvent.stopPropagation = InteractEvent.prototype.stopPropagation; |
pointerEvent.stopImmediatePropagation = InteractEvent.prototype.stopImmediatePropagation; |
pointerEvent.interaction = this; |
pointerEvent.timeStamp = new Date().getTime(); |
pointerEvent.originalEvent = event; |
pointerEvent.originalPointer = pointer; |
pointerEvent.type = eventType; |
pointerEvent.pointerId = getPointerId(pointer); |
pointerEvent.pointerType = this.mouse? 'mouse' : !supportsPointerEvent? 'touch' |
: isString(pointer.pointerType) |
? pointer.pointerType |
: [,,'touch', 'pen', 'mouse'][pointer.pointerType]; |
} |
if (eventType === 'tap') { |
pointerEvent.dt = pointerEvent.timeStamp - this.downTimes[pointerIndex]; |
interval = pointerEvent.timeStamp - this.tapTime; |
createNewDoubleTap = !!(this.prevTap && this.prevTap.type !== 'doubletap' |
&& this.prevTap.target === pointerEvent.target |
&& interval < 500); |
pointerEvent.double = createNewDoubleTap; |
this.tapTime = pointerEvent.timeStamp; |
} |
for (i = 0; i < targets.length; i++) { |
pointerEvent.currentTarget = elements[i]; |
pointerEvent.interactable = targets[i]; |
targets[i].fire(pointerEvent); |
if (pointerEvent.immediatePropagationStopped |
||(pointerEvent.propagationStopped && elements[i + 1] !== pointerEvent.currentTarget)) { |
break; |
} |
} |
if (createNewDoubleTap) { |
var doubleTap = {}; |
extend(doubleTap, pointerEvent); |
doubleTap.dt = interval; |
doubleTap.type = 'doubletap'; |
this.collectEventTargets(doubleTap, event, eventTarget, 'doubletap'); |
this.prevTap = doubleTap; |
} |
else if (eventType === 'tap') { |
this.prevTap = pointerEvent; |
} |
}, |
validateSelector: function (pointer, event, matches, matchElements) { |
for (var i = 0, len = matches.length; i < len; i++) { |
var match = matches[i], |
matchElement = matchElements[i], |
action = validateAction(match.getAction(pointer, event, this, matchElement), match); |
if (action && withinInteractionLimit(match, matchElement, action)) { |
this.target = match; |
this.element = matchElement; |
return action; |
} |
} |
}, |
setSnapping: function (pageCoords, status) { |
var snap = this.target.options[this.prepared.name].snap, |
targets = [], |
target, |
page, |
i; |
status = status || this.snapStatus; |
if (status.useStatusXY) { |
page = { x: status.x, y: status.y }; |
} |
else { |
var origin = getOriginXY(this.target, this.element); |
page = extend({}, pageCoords); |
page.x -= origin.x; |
page.y -= origin.y; |
} |
status.realX = page.x; |
status.realY = page.y; |
page.x = page.x - this.inertiaStatus.resumeDx; |
page.y = page.y - this.inertiaStatus.resumeDy; |
var len = snap.targets? snap.targets.length : 0; |
for (var relIndex = 0; relIndex < this.snapOffsets.length; relIndex++) { |
var relative = { |
x: page.x - this.snapOffsets[relIndex].x, |
y: page.y - this.snapOffsets[relIndex].y |
}; |
for (i = 0; i < len; i++) { |
if (isFunction(snap.targets[i])) { |
target = snap.targets[i](relative.x, relative.y, this); |
} |
else { |
target = snap.targets[i]; |
} |
if (!target) { continue; } |
targets.push({ |
x: isNumber(target.x) ? (target.x + this.snapOffsets[relIndex].x) : relative.x, |
y: isNumber(target.y) ? (target.y + this.snapOffsets[relIndex].y) : relative.y, |
range: isNumber(target.range)? target.range: snap.range |
}); |
} |
} |
var closest = { |
target: null, |
inRange: false, |
distance: 0, |
range: 0, |
dx: 0, |
dy: 0 |
}; |
for (i = 0, len = targets.length; i < len; i++) { |
target = targets[i]; |
var range = target.range, |
dx = target.x - page.x, |
dy = target.y - page.y, |
distance = hypot(dx, dy), |
inRange = distance <= range; |
// Infinite targets count as being out of range |
// compared to non infinite ones that are in range |
if (range === Infinity && closest.inRange && closest.range !== Infinity) { |
inRange = false; |
} |
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 |
: (!closest.inRange && distance < closest.distance))) { |
if (range === Infinity) { |
inRange = true; |
} |
closest.target = target; |
closest.distance = distance; |
closest.range = range; |
closest.inRange = inRange; |
closest.dx = dx; |
closest.dy = dy; |
status.range = range; |
} |
} |
var snapChanged; |
if (closest.target) { |
snapChanged = (status.snappedX !== closest.target.x || status.snappedY !== closest.target.y); |
status.snappedX = closest.target.x; |
status.snappedY = closest.target.y; |
} |
else { |
snapChanged = true; |
status.snappedX = NaN; |
status.snappedY = NaN; |
} |
status.dx = closest.dx; |
status.dy = closest.dy; |
status.changed = (snapChanged || (closest.inRange && !status.locked)); |
status.locked = closest.inRange; |
return status; |
}, |
setRestriction: function (pageCoords, status) { |
var target = this.target, |
restrict = target && target.options[this.prepared.name].restrict, |
restriction = restrict && restrict.restriction, |
page; |
if (!restriction) { |
return status; |
} |
status = status || this.restrictStatus; |
page = status.useStatusXY |
? page = { x: status.x, y: status.y } |
: page = extend({}, pageCoords); |
if (status.snap && status.snap.locked) { |
page.x += status.snap.dx || 0; |
page.y += status.snap.dy || 0; |
} |
page.x -= this.inertiaStatus.resumeDx; |
page.y -= this.inertiaStatus.resumeDy; |
status.dx = 0; |
status.dy = 0; |
status.restricted = false; |
var rect, restrictedX, restrictedY; |
if (isString(restriction)) { |
if (restriction === 'parent') { |
restriction = parentElement(this.element); |
} |
else if (restriction === 'self') { |
restriction = target.getRect(this.element); |
} |
else { |
restriction = closest(this.element, restriction); |
} |
if (!restriction) { return status; } |
} |
if (isFunction(restriction)) { |
restriction = restriction(page.x, page.y, this.element); |
} |
if (isElement(restriction)) { |
restriction = getElementRect(restriction); |
} |
rect = restriction; |
if (!restriction) { |
restrictedX = page.x; |
restrictedY = page.y; |
} |
// object is assumed to have |
// x, y, width, height or |
// left, top, right, bottom |
else if ('x' in restriction && 'y' in restriction) { |
restrictedX = Math.max(Math.min(rect.x + rect.width - this.restrictOffset.right , page.x), rect.x + this.restrictOffset.left); |
restrictedY = Math.max(Math.min(rect.y + rect.height - this.restrictOffset.bottom, page.y), rect.y + this.restrictOffset.top ); |
} |
else { |
restrictedX = Math.max(Math.min(rect.right - this.restrictOffset.right , page.x), rect.left + this.restrictOffset.left); |
restrictedY = Math.max(Math.min(rect.bottom - this.restrictOffset.bottom, page.y), rect.top + this.restrictOffset.top ); |
} |
status.dx = restrictedX - page.x; |
status.dy = restrictedY - page.y; |
status.changed = status.restrictedX !== restrictedX || status.restrictedY !== restrictedY; |
status.restricted = !!(status.dx || status.dy); |
status.restrictedX = restrictedX; |
status.restrictedY = restrictedY; |
return status; |
}, |
checkAndPreventDefault: function (event, interactable, element) { |
if (!(interactable = interactable || this.target)) { return; } |
var options = interactable.options, |
prevent = options.preventDefault; |
if (prevent === 'auto' && element && !/^(input|select|textarea)$/i.test(event.target.nodeName)) { |
// do not preventDefault on pointerdown if the prepared action is a drag |
// and dragging can only start from a certain direction - this allows |
// a touch to pan the viewport if a drag isn't in the right direction |
if (/down|start/i.test(event.type) |
&& this.prepared.name === 'drag' && options.drag.axis !== 'xy') { |
return; |
} |
// with manualStart, only preventDefault while interacting |
if (options[this.prepared.name] && options[this.prepared.name].manualStart |
&& !this.interacting()) { |
return; |
} |
event.preventDefault(); |
return; |
} |
if (prevent === 'always') { |
event.preventDefault(); |
return; |
} |
}, |
calcInertia: function (status) { |
var inertiaOptions = this.target.options[this.prepared.name].inertia, |
lambda = inertiaOptions.resistance, |
inertiaDur = -Math.log(inertiaOptions.endSpeed / status.v0) / lambda; |
status.x0 = this.prevEvent.pageX; |
status.y0 = this.prevEvent.pageY; |
status.t0 = status.startEvent.timeStamp / 1000; |
status.sx = status.sy = 0; |
status.modifiedXe = status.xe = (status.vx0 - inertiaDur) / lambda; |
status.modifiedYe = status.ye = (status.vy0 - inertiaDur) / lambda; |
status.te = inertiaDur; |
status.lambda_v0 = lambda / status.v0; |
status.one_ve_v0 = 1 - inertiaOptions.endSpeed / status.v0; |
}, |
autoScrollMove: function (pointer) { |
if (!(this.interacting() |
&& checkAutoScroll(this.target, this.prepared.name))) { |
return; |
} |
if (this.inertiaStatus.active) { |
autoScroll.x = autoScroll.y = 0; |
return; |
} |
var top, |
right, |
bottom, |
left, |
options = this.target.options[this.prepared.name].autoScroll, |
container = options.container || getWindow(this.element); |
if (isWindow(container)) { |
left = pointer.clientX < autoScroll.margin; |
top = pointer.clientY < autoScroll.margin; |
right = pointer.clientX > container.innerWidth - autoScroll.margin; |
bottom = pointer.clientY > container.innerHeight - autoScroll.margin; |
} |
else { |
var rect = getElementClientRect(container); |
left = pointer.clientX < rect.left + autoScroll.margin; |
top = pointer.clientY < rect.top + autoScroll.margin; |
right = pointer.clientX > rect.right - autoScroll.margin; |
bottom = pointer.clientY > rect.bottom - autoScroll.margin; |
} |
autoScroll.x = (right ? 1: left? -1: 0); |
autoScroll.y = (bottom? 1: top? -1: 0); |
if (!autoScroll.isScrolling) { |
// set the autoScroll properties to those of the target |
autoScroll.margin = options.margin; |
autoScroll.speed = options.speed; |
autoScroll.start(this); |
} |
}, |
_updateEventTargets: function (target, currentTarget) { |
this._eventTarget = target; |
this._curEventTarget = currentTarget; |
} |
}; |
function getInteractionFromPointer (pointer, eventType, eventTarget) { |
var i = 0, len = interactions.length, |
mouseEvent = (/mouse/i.test(pointer.pointerType || eventType) |
// MSPointerEvent.MSPOINTER_TYPE_MOUSE |
|| pointer.pointerType === 4), |
interaction; |
var id = getPointerId(pointer); |
// try to resume inertia with a new pointer |
if (/down|start/i.test(eventType)) { |
for (i = 0; i < len; i++) { |
interaction = interactions[i]; |
var element = eventTarget; |
if (interaction.inertiaStatus.active && interaction.target.options[interaction.prepared.name].inertia.allowResume |
&& (interaction.mouse === mouseEvent)) { |
while (element) { |
// if the element is the interaction element |
if (element === interaction.element) { |
return interaction; |
} |
element = parentElement(element); |
} |
} |
} |
} |
// if it's a mouse interaction |
if (mouseEvent || !(supportsTouch || supportsPointerEvent)) { |
// find a mouse interaction that's not in inertia phase |
for (i = 0; i < len; i++) { |
if (interactions[i].mouse && !interactions[i].inertiaStatus.active) { |
return interactions[i]; |
} |
} |
// find any interaction specifically for mouse. |
// if the eventType is a mousedown, and inertia is active |
// ignore the interaction |
for (i = 0; i < len; i++) { |
if (interactions[i].mouse && !(/down/.test(eventType) && interactions[i].inertiaStatus.active)) { |
return interaction; |
} |
} |
// create a new interaction for mouse |
interaction = new Interaction(); |
interaction.mouse = true; |
return interaction; |
} |
// get interaction that has this pointer |
for (i = 0; i < len; i++) { |
if (contains(interactions[i].pointerIds, id)) { |
return interactions[i]; |
} |
} |
// at this stage, a pointerUp should not return an interaction |
if (/up|end|out/i.test(eventType)) { |
return null; |
} |
// get first idle interaction |
for (i = 0; i < len; i++) { |
interaction = interactions[i]; |
if ((!interaction.prepared.name || (interaction.target.options.gesture.enabled)) |
&& !interaction.interacting() |
&& !(!mouseEvent && interaction.mouse)) { |
return interaction; |
} |
} |
return new Interaction(); |
} |
function doOnInteractions (method) { |
return (function (event) { |
var interaction, |
eventTarget = getActualElement(event.path |
? event.path[0] |
: event.target), |
curEventTarget = getActualElement(event.currentTarget), |
i; |
if (supportsTouch && /touch/.test(event.type)) { |
prevTouchTime = new Date().getTime(); |
for (i = 0; i < event.changedTouches.length; i++) { |
var pointer = event.changedTouches[i]; |
interaction = getInteractionFromPointer(pointer, event.type, eventTarget); |
if (!interaction) { continue; } |
interaction._updateEventTargets(eventTarget, curEventTarget); |
interaction[method](pointer, event, eventTarget, curEventTarget); |
} |
} |
else { |
if (!supportsPointerEvent && /mouse/.test(event.type)) { |
// ignore mouse events while touch interactions are active |
for (i = 0; i < interactions.length; i++) { |
if (!interactions[i].mouse && interactions[i].pointerIsDown) { |
return; |
} |
} |
// try to ignore mouse events that are simulated by the browser |
// after a touch event |
if (new Date().getTime() - prevTouchTime < 500) { |
return; |
} |
} |
interaction = getInteractionFromPointer(event, event.type, eventTarget); |
if (!interaction) { return; } |
interaction._updateEventTargets(eventTarget, curEventTarget); |
interaction[method](event, event, eventTarget, curEventTarget); |
} |
}); |
} |
function InteractEvent (interaction, event, action, phase, element, related) { |
var client, |
page, |
target = interaction.target, |
snapStatus = interaction.snapStatus, |
restrictStatus = interaction.restrictStatus, |
pointers = interaction.pointers, |
deltaSource = (target && target.options || defaultOptions).deltaSource, |
sourceX = deltaSource + 'X', |
sourceY = deltaSource + 'Y', |
options = target? target.options: defaultOptions, |
origin = getOriginXY(target, element), |
starting = phase === 'start', |
ending = phase === 'end', |
coords = starting? interaction.startCoords : interaction.curCoords; |
element = element || interaction.element; |
page = extend({}, coords.page); |
client = extend({}, coords.client); |
page.x -= origin.x; |
page.y -= origin.y; |
client.x -= origin.x; |
client.y -= origin.y; |
var relativePoints = options[action].snap && options[action].snap.relativePoints ; |
if (checkSnap(target, action) && !(starting && relativePoints && relativePoints.length)) { |
this.snap = { |
range : snapStatus.range, |
locked : snapStatus.locked, |
x : snapStatus.snappedX, |
y : snapStatus.snappedY, |
realX : snapStatus.realX, |
realY : snapStatus.realY, |
dx : snapStatus.dx, |
dy : snapStatus.dy |
}; |
if (snapStatus.locked) { |
page.x += snapStatus.dx; |
page.y += snapStatus.dy; |
client.x += snapStatus.dx; |
client.y += snapStatus.dy; |
} |
} |
if (checkRestrict(target, action) && !(starting && options[action].restrict.elementRect) && restrictStatus.restricted) { |
page.x += restrictStatus.dx; |
page.y += restrictStatus.dy; |
client.x += restrictStatus.dx; |
client.y += restrictStatus.dy; |
this.restrict = { |
dx: restrictStatus.dx, |
dy: restrictStatus.dy |
}; |
} |
this.pageX = page.x; |
this.pageY = page.y; |
this.clientX = client.x; |
this.clientY = client.y; |
this.x0 = interaction.startCoords.page.x - origin.x; |
this.y0 = interaction.startCoords.page.y - origin.y; |
this.clientX0 = interaction.startCoords.client.x - origin.x; |
this.clientY0 = interaction.startCoords.client.y - origin.y; |
this.ctrlKey = event.ctrlKey; |
this.altKey = event.altKey; |
this.shiftKey = event.shiftKey; |
this.metaKey = event.metaKey; |
this.button = event.button; |
this.buttons = event.buttons; |
this.target = element; |
this.t0 = interaction.downTimes[0]; |
this.type = action + (phase || ''); |
this.interaction = interaction; |
this.interactable = target; |
var inertiaStatus = interaction.inertiaStatus; |
if (inertiaStatus.active) { |
this.detail = 'inertia'; |
} |
if (related) { |
this.relatedTarget = related; |
} |
// end event dx, dy is difference between start and end points |
if (ending) { |
if (deltaSource === 'client') { |
this.dx = client.x - interaction.startCoords.client.x; |
this.dy = client.y - interaction.startCoords.client.y; |
} |
else { |
this.dx = page.x - interaction.startCoords.page.x; |
this.dy = page.y - interaction.startCoords.page.y; |
} |
} |
else if (starting) { |
this.dx = 0; |
this.dy = 0; |
} |
// copy properties from previousmove if starting inertia |
else if (phase === 'inertiastart') { |
this.dx = interaction.prevEvent.dx; |
this.dy = interaction.prevEvent.dy; |
} |
else { |
if (deltaSource === 'client') { |
this.dx = client.x - interaction.prevEvent.clientX; |
this.dy = client.y - interaction.prevEvent.clientY; |
} |
else { |
this.dx = page.x - interaction.prevEvent.pageX; |
this.dy = page.y - interaction.prevEvent.pageY; |
} |
} |
if (interaction.prevEvent && interaction.prevEvent.detail === 'inertia' |
&& !inertiaStatus.active |
&& options[action].inertia && options[action].inertia.zeroResumeDelta) { |
inertiaStatus.resumeDx += this.dx; |
inertiaStatus.resumeDy += this.dy; |
this.dx = this.dy = 0; |
} |
if (action === 'resize' && interaction.resizeAxes) { |
if (options.resize.square) { |
if (interaction.resizeAxes === 'y') { |
this.dx = this.dy; |
} |
else { |
this.dy = this.dx; |
} |
this.axes = 'xy'; |
} |
else { |
this.axes = interaction.resizeAxes; |
if (interaction.resizeAxes === 'x') { |
this.dy = 0; |
} |
else if (interaction.resizeAxes === 'y') { |
this.dx = 0; |
} |
} |
} |
else if (action === 'gesture') { |
this.touches = [pointers[0], pointers[1]]; |
if (starting) { |
this.distance = touchDistance(pointers, deltaSource); |
this.box = touchBBox(pointers); |
this.scale = 1; |
this.ds = 0; |
this.angle = touchAngle(pointers, undefined, deltaSource); |
this.da = 0; |
} |
else if (ending || event instanceof InteractEvent) { |
this.distance = interaction.prevEvent.distance; |
this.box = interaction.prevEvent.box; |
this.scale = interaction.prevEvent.scale; |
this.ds = this.scale - 1; |
this.angle = interaction.prevEvent.angle; |
this.da = this.angle - interaction.gesture.startAngle; |
} |
else { |
this.distance = touchDistance(pointers, deltaSource); |
this.box = touchBBox(pointers); |
this.scale = this.distance / interaction.gesture.startDistance; |
this.angle = touchAngle(pointers, interaction.gesture.prevAngle, deltaSource); |
this.ds = this.scale - interaction.gesture.prevScale; |
this.da = this.angle - interaction.gesture.prevAngle; |
} |
} |
if (starting) { |
this.timeStamp = interaction.downTimes[0]; |
this.dt = 0; |
this.duration = 0; |
this.speed = 0; |
this.velocityX = 0; |
this.velocityY = 0; |
} |
else if (phase === 'inertiastart') { |
this.timeStamp = interaction.prevEvent.timeStamp; |
this.dt = interaction.prevEvent.dt; |
this.duration = interaction.prevEvent.duration; |
this.speed = interaction.prevEvent.speed; |
this.velocityX = interaction.prevEvent.velocityX; |
this.velocityY = interaction.prevEvent.velocityY; |
} |
else { |
this.timeStamp = new Date().getTime(); |
this.dt = this.timeStamp - interaction.prevEvent.timeStamp; |
this.duration = this.timeStamp - interaction.downTimes[0]; |
if (event instanceof InteractEvent) { |
var dx = this[sourceX] - interaction.prevEvent[sourceX], |
dy = this[sourceY] - interaction.prevEvent[sourceY], |
dt = this.dt / 1000; |
this.speed = hypot(dx, dy) / dt; |
this.velocityX = dx / dt; |
this.velocityY = dy / dt; |
} |
// if normal move or end event, use previous user event coords |
else { |
// speed and velocity in pixels per second |
this.speed = interaction.pointerDelta[deltaSource].speed; |
this.velocityX = interaction.pointerDelta[deltaSource].vx; |
this.velocityY = interaction.pointerDelta[deltaSource].vy; |
} |
} |
if ((ending || phase === 'inertiastart') |
&& interaction.prevEvent.speed > 600 && this.timeStamp - interaction.prevEvent.timeStamp < 150) { |
var angle = 180 * Math.atan2(interaction.prevEvent.velocityY, interaction.prevEvent.velocityX) / Math.PI, |
overlap = 22.5; |
if (angle < 0) { |
angle += 360; |
} |
var left = 135 - overlap <= angle && angle < 225 + overlap, |
up = 225 - overlap <= angle && angle < 315 + overlap, |
right = !left && (315 - overlap <= angle || angle < 45 + overlap), |
down = !up && 45 - overlap <= angle && angle < 135 + overlap; |
this.swipe = { |
up : up, |
down : down, |
left : left, |
right: right, |
angle: angle, |
speed: interaction.prevEvent.speed, |
velocity: { |
x: interaction.prevEvent.velocityX, |
y: interaction.prevEvent.velocityY |
} |
}; |
} |
} |
InteractEvent.prototype = { |
preventDefault: blank, |
stopImmediatePropagation: function () { |
this.immediatePropagationStopped = this.propagationStopped = true; |
}, |
stopPropagation: function () { |
this.propagationStopped = true; |
} |
}; |
function preventOriginalDefault () { |
this.originalEvent.preventDefault(); |
} |
function getActionCursor (action) { |
var cursor = ''; |
if (action.name === 'drag') { |
cursor = actionCursors.drag; |
} |
if (action.name === 'resize') { |
if (action.axis) { |
cursor = actionCursors[action.name + action.axis]; |
} |
else if (action.edges) { |
var cursorKey = 'resize', |
edgeNames = ['top', 'bottom', 'left', 'right']; |
for (var i = 0; i < 4; i++) { |
if (action.edges[edgeNames[i]]) { |
cursorKey += edgeNames[i]; |
} |
} |
cursor = actionCursors[cursorKey]; |
} |
} |
return cursor; |
} |
function checkResizeEdge (name, value, page, element, interactableElement, rect, margin) { |
// false, '', undefined, null |
if (!value) { return false; } |
// true value, use pointer coords and element rect |
if (value === true) { |
// if dimensions are negative, "switch" edges |
var width = isNumber(rect.width)? rect.width : rect.right - rect.left, |
height = isNumber(rect.height)? rect.height : rect.bottom - rect.top; |
if (width < 0) { |
if (name === 'left' ) { name = 'right'; } |
else if (name === 'right') { name = 'left' ; } |
} |
if (height < 0) { |
if (name === 'top' ) { name = 'bottom'; } |
else if (name === 'bottom') { name = 'top' ; } |
} |
if (name === 'left' ) { return page.x < ((width >= 0? rect.left: rect.right ) + margin); } |
if (name === 'top' ) { return page.y < ((height >= 0? rect.top : rect.bottom) + margin); } |
if (name === 'right' ) { return page.x > ((width >= 0? rect.right : rect.left) - margin); } |
if (name === 'bottom') { return page.y > ((height >= 0? rect.bottom: rect.top ) - margin); } |
} |
// the remaining checks require an element |
if (!isElement(element)) { return false; } |
return isElement(value) |
// the value is an element to use as a resize handle |
? value === element |
// otherwise check if element matches value as selector |
: matchesUpTo(element, value, interactableElement); |
} |
function defaultActionChecker (pointer, interaction, element) { |
var rect = this.getRect(element), |
shouldResize = false, |
action = null, |
resizeAxes = null, |
resizeEdges, |
page = extend({}, interaction.curCoords.page), |
options = this.options; |
if (!rect) { return null; } |
if (actionIsEnabled.resize && options.resize.enabled) { |
var resizeOptions = options.resize; |
resizeEdges = { |
left: false, right: false, top: false, bottom: false |
}; |
// if using resize.edges |
if (isObject(resizeOptions.edges)) { |
for (var edge in resizeEdges) { |
resizeEdges[edge] = checkResizeEdge(edge, |
resizeOptions.edges[edge], |
page, |
interaction._eventTarget, |
element, |
rect, |
resizeOptions.margin || margin); |
} |
resizeEdges.left = resizeEdges.left && !resizeEdges.right; |
resizeEdges.top = resizeEdges.top && !resizeEdges.bottom; |
shouldResize = resizeEdges.left || resizeEdges.right || resizeEdges.top || resizeEdges.bottom; |
} |
else { |
var right = options.resize.axis !== 'y' && page.x > (rect.right - margin), |
bottom = options.resize.axis !== 'x' && page.y > (rect.bottom - margin); |
shouldResize = right || bottom; |
resizeAxes = (right? 'x' : '') + (bottom? 'y' : ''); |
} |
} |
action = shouldResize |
? 'resize' |
: actionIsEnabled.drag && options.drag.enabled |
? 'drag' |
: null; |
if (actionIsEnabled.gesture |
&& interaction.pointerIds.length >=2 |
&& !(interaction.dragging || interaction.resizing)) { |
action = 'gesture'; |
} |
if (action) { |
return { |
name: action, |
axis: resizeAxes, |
edges: resizeEdges |
}; |
} |
return null; |
} |
// Check if action is enabled globally and the current target supports it |
// If so, return the validated action. Otherwise, return null |
function validateAction (action, interactable) { |
if (!isObject(action)) { return null; } |
var actionName = action.name, |
options = interactable.options; |
if (( (actionName === 'resize' && options.resize.enabled ) |
|| (actionName === 'drag' && options.drag.enabled ) |
|| (actionName === 'gesture' && options.gesture.enabled)) |
&& actionIsEnabled[actionName]) { |
if (actionName === 'resize' || actionName === 'resizeyx') { |
actionName = 'resizexy'; |
} |
return action; |
} |
return null; |
} |
var listeners = {}, |
interactionListeners = [ |
'dragStart', 'dragMove', 'resizeStart', 'resizeMove', 'gestureStart', 'gestureMove', |
'pointerOver', 'pointerOut', 'pointerHover', 'selectorDown', |
'pointerDown', 'pointerMove', 'pointerUp', 'pointerCancel', 'pointerEnd', |
'addPointer', 'removePointer', 'recordPointer', 'autoScrollMove' |
]; |
for (var i = 0, len = interactionListeners.length; i < len; i++) { |
var name = interactionListeners[i]; |
listeners[name] = doOnInteractions(name); |
} |
// bound to the interactable context when a DOM event |
// listener is added to a selector interactable |
function delegateListener (event, useCapture) { |
var fakeEvent = {}, |
delegated = delegatedEvents[event.type], |
eventTarget = getActualElement(event.path |
? event.path[0] |
: event.target), |
element = eventTarget; |
useCapture = useCapture? true: false; |
// duplicate the event so that currentTarget can be changed |
for (var prop in event) { |
fakeEvent[prop] = event[prop]; |
} |
fakeEvent.originalEvent = event; |
fakeEvent.preventDefault = preventOriginalDefault; |
// climb up document tree looking for selector matches |
while (isElement(element)) { |
for (var i = 0; i < delegated.selectors.length; i++) { |
var selector = delegated.selectors[i], |
context = delegated.contexts[i]; |
if (matchesSelector(element, selector) |
&& nodeContains(context, eventTarget) |
&& nodeContains(context, element)) { |
var listeners = delegated.listeners[i]; |
fakeEvent.currentTarget = element; |
for (var j = 0; j < listeners.length; j++) { |
if (listeners[j][1] === useCapture) { |
listeners[j][0](fakeEvent); |
} |
} |
} |
} |
element = parentElement(element); |
} |
} |
function delegateUseCapture (event) { |
return delegateListener.call(this, event, true); |
} |
interactables.indexOfElement = function indexOfElement (element, context) { |
context = context || document; |
for (var i = 0; i < this.length; i++) { |
var interactable = this[i]; |
if ((interactable.selector === element |
&& (interactable._context === context)) |
|| (!interactable.selector && interactable._element === element)) { |
return i; |
} |
} |
return -1; |
}; |
interactables.get = function interactableGet (element, options) { |
return this[this.indexOfElement(element, options && options.context)]; |
}; |
interactables.forEachSelector = function (callback) { |
for (var i = 0; i < this.length; i++) { |
var interactable = this[i]; |
if (!interactable.selector) { |
continue; |
} |
var ret = callback(interactable, interactable.selector, interactable._context, i, this); |
if (ret !== undefined) { |
return ret; |
} |
} |
}; |
/*\ |
* interact |
[ method ] |
* |
* The methods of this variable can be used to set elements as |
* interactables and also to change various default settings. |
* |
* Calling it as a function and passing an element or a valid CSS selector |
* string returns an Interactable object which has various methods to |
* configure it. |
* |
- element (Element | string) The HTML or SVG Element to interact with or CSS selector |
= (object) An @Interactable |
* |
> Usage |
| interact(document.getElementById('draggable')).draggable(true); |
| |
| var rectables = interact('rect'); |
| rectables |
| .gesturable(true) |
| .on('gesturemove', function (event) { |
| // something cool... |
| }) |
| .autoScroll(true); |
\*/ |
function interact (element, options) { |
return interactables.get(element, options) || new Interactable(element, options); |
} |
/*\ |
* Interactable |
[ property ] |
** |
* Object type returned by @interact |
\*/ |
function Interactable (element, options) { |
this._element = element; |
this._iEvents = this._iEvents || {}; |
var _window; |
if (trySelector(element)) { |
this.selector = element; |
var context = options && options.context; |
_window = context? getWindow(context) : window; |
if (context && (_window.Node |
? context instanceof _window.Node |
: (isElement(context) || context === _window.document))) { |
this._context = context; |
} |
} |
else { |
_window = getWindow(element); |
if (isElement(element, _window)) { |
if (supportsPointerEvent) { |
events.add(this._element, pEventTypes.down, listeners.pointerDown ); |
events.add(this._element, pEventTypes.move, listeners.pointerHover); |
} |
else { |
events.add(this._element, 'mousedown' , listeners.pointerDown ); |
events.add(this._element, 'mousemove' , listeners.pointerHover); |
events.add(this._element, 'touchstart', listeners.pointerDown ); |
events.add(this._element, 'touchmove' , listeners.pointerHover); |
} |
} |
} |
this._doc = _window.document; |
if (!contains(documents, this._doc)) { |
listenToDocument(this._doc); |
} |
interactables.push(this); |
this.set(options); |
} |
Interactable.prototype = { |
setOnEvents: function (action, phases) { |
if (action === 'drop') { |
if (isFunction(phases.ondrop) ) { this.ondrop = phases.ondrop ; } |
if (isFunction(phases.ondropactivate) ) { this.ondropactivate = phases.ondropactivate ; } |
if (isFunction(phases.ondropdeactivate)) { this.ondropdeactivate = phases.ondropdeactivate; } |
if (isFunction(phases.ondragenter) ) { this.ondragenter = phases.ondragenter ; } |
if (isFunction(phases.ondragleave) ) { this.ondragleave = phases.ondragleave ; } |
if (isFunction(phases.ondropmove) ) { this.ondropmove = phases.ondropmove ; } |
} |
else { |
action = 'on' + action; |
if (isFunction(phases.onstart) ) { this[action + 'start' ] = phases.onstart ; } |
if (isFunction(phases.onmove) ) { this[action + 'move' ] = phases.onmove ; } |
if (isFunction(phases.onend) ) { this[action + 'end' ] = phases.onend ; } |
if (isFunction(phases.oninertiastart)) { this[action + 'inertiastart' ] = phases.oninertiastart ; } |
} |
return this; |
}, |
/*\ |
* Interactable.draggable |
[ method ] |
* |
* Gets or sets whether drag actions can be performed on the |
* Interactable |
* |
= (boolean) Indicates if this can be the target of drag events |
| var isDraggable = interact('ul li').draggable(); |
* or |
- options (boolean | object) #optional true/false or An object with event listeners to be fired on drag events (object makes the Interactable draggable) |
= (object) This Interactable |
| interact(element).draggable({ |
| onstart: function (event) {}, |
| onmove : function (event) {}, |
| onend : function (event) {}, |
| |
| // the axis in which the first movement must be |
| // for the drag sequence to start |
| // 'xy' by default - any direction |
| axis: 'x' || 'y' || 'xy', |
| |
| // max number of drags that can happen concurrently |
| // with elements of this Interactable. Infinity by default |
| max: Infinity, |
| |
| // max number of drags that can target the same element+Interactable |
| // 1 by default |
| maxPerElement: 2 |
| }); |
\*/ |
draggable: function (options) { |
if (isObject(options)) { |
this.options.drag.enabled = options.enabled === false? false: true; |
this.setPerAction('drag', options); |
this.setOnEvents('drag', options); |
if (/^x$|^y$|^xy$/.test(options.axis)) { |
this.options.drag.axis = options.axis; |
} |
else if (options.axis === null) { |
delete this.options.drag.axis; |
} |
return this; |
} |
if (isBool(options)) { |
this.options.drag.enabled = options; |
return this; |
} |
return this.options.drag; |
}, |
setPerAction: function (action, options) { |
// for all the default per-action options |
for (var option in options) { |
// if this option exists for this action |
if (option in defaultOptions[action]) { |
// if the option in the options arg is an object value |
if (isObject(options[option])) { |
// duplicate the object |
this.options[action][option] = extend(this.options[action][option] || {}, options[option]); |
if (isObject(defaultOptions.perAction[option]) && 'enabled' in defaultOptions.perAction[option]) { |
this.options[action][option].enabled = options[option].enabled === false? false : true; |
} |
} |
else if (isBool(options[option]) && isObject(defaultOptions.perAction[option])) { |
this.options[action][option].enabled = options[option]; |
} |
else if (options[option] !== undefined) { |
// or if it's not undefined, do a plain assignment |
this.options[action][option] = options[option]; |
} |
} |
} |
}, |
/*\ |
* Interactable.dropzone |
[ method ] |
* |
* Returns or sets whether elements can be dropped onto this |
* Interactable to trigger drop events |
* |
* Dropzones can receive the following events: |
* - `dropactivate` and `dropdeactivate` when an acceptable drag starts and ends |
* - `dragenter` and `dragleave` when a draggable enters and leaves the dropzone |
* - `dragmove` when a draggable that has entered the dropzone is moved |
* - `drop` when a draggable is dropped into this dropzone |
* |
* Use the `accept` option to allow only elements that match the given CSS selector or element. |
* |
* Use the `overlap` option to set how drops are checked for. The allowed values are: |
* - `'pointer'`, the pointer must be over the dropzone (default) |
* - `'center'`, the draggable element's center must be over the dropzone |
* - a number from 0-1 which is the `(intersection area) / (draggable area)`. |
* e.g. `0.5` for drop to happen when half of the area of the |
* draggable is over the dropzone |
* |
- options (boolean | object | null) #optional The new value to be set. |
| interact('.drop').dropzone({ |
| accept: '.can-drop' || document.getElementById('single-drop'), |
| overlap: 'pointer' || 'center' || zeroToOne |
| } |
= (boolean | object) The current setting or this Interactable |
\*/ |
dropzone: function (options) { |
if (isObject(options)) { |
this.options.drop.enabled = options.enabled === false? false: true; |
this.setOnEvents('drop', options); |
if (/^(pointer|center)$/.test(options.overlap)) { |
this.options.drop.overlap = options.overlap; |
} |
else if (isNumber(options.overlap)) { |
this.options.drop.overlap = Math.max(Math.min(1, options.overlap), 0); |
} |
if ('accept' in options) { |
this.options.drop.accept = options.accept; |
} |
if ('checker' in options) { |
this.options.drop.checker = options.checker; |
} |
return this; |
} |
if (isBool(options)) { |
this.options.drop.enabled = options; |
return this; |
} |
return this.options.drop; |
}, |
dropCheck: function (dragEvent, event, draggable, draggableElement, dropElement, rect) { |
var dropped = false; |
// if the dropzone has no rect (eg. display: none) |
// call the custom dropChecker or just return false |
if (!(rect = rect || this.getRect(dropElement))) { |
return (this.options.drop.checker |
? this.options.drop.checker(dragEvent, event, dropped, this, dropElement, draggable, draggableElement) |
: false); |
} |
var dropOverlap = this.options.drop.overlap; |
if (dropOverlap === 'pointer') { |
var page = getPageXY(dragEvent), |
origin = getOriginXY(draggable, draggableElement), |
horizontal, |
vertical; |
page.x += origin.x; |
page.y += origin.y; |
horizontal = (page.x > rect.left) && (page.x < rect.right); |
vertical = (page.y > rect.top ) && (page.y < rect.bottom); |
dropped = horizontal && vertical; |
} |
var dragRect = draggable.getRect(draggableElement); |
if (dropOverlap === 'center') { |
var cx = dragRect.left + dragRect.width / 2, |
cy = dragRect.top + dragRect.height / 2; |
dropped = cx >= rect.left && cx <= rect.right && cy >= rect.top && cy <= rect.bottom; |
} |
if (isNumber(dropOverlap)) { |
var overlapArea = (Math.max(0, Math.min(rect.right , dragRect.right ) - Math.max(rect.left, dragRect.left)) |
* Math.max(0, Math.min(rect.bottom, dragRect.bottom) - Math.max(rect.top , dragRect.top ))), |
overlapRatio = overlapArea / (dragRect.width * dragRect.height); |
dropped = overlapRatio >= dropOverlap; |
} |
if (this.options.drop.checker) { |
dropped = this.options.drop.checker(dragEvent, event, dropped, this, dropElement, draggable, draggableElement); |
} |
return dropped; |
}, |
/*\ |
* Interactable.dropChecker |
[ method ] |
* |
* DEPRECATED. Use interactable.dropzone({ checker: function... }) instead. |
* |
* Gets or sets the function used to check if a dragged element is |
* over this Interactable. |
* |
- checker (function) #optional The function that will be called when checking for a drop |
= (Function | Interactable) The checker function or this Interactable |
* |
* The checker function takes the following arguments: |
* |
- dragEvent (InteractEvent) The related dragmove or dragend event |
- event (TouchEvent | PointerEvent | MouseEvent) The user move/up/end Event related to the dragEvent |
- dropped (boolean) The value from the default drop checker |
- dropzone (Interactable) The dropzone interactable |
- dropElement (Element) The dropzone element |
- draggable (Interactable) The Interactable being dragged |
- draggableElement (Element) The actual element that's being dragged |
* |
> Usage: |
| interact(target) |
| .dropChecker(function(dragEvent, // related dragmove or dragend event |
| event, // TouchEvent/PointerEvent/MouseEvent |
| dropped, // bool result of the default checker |
| dropzone, // dropzone Interactable |
| dropElement, // dropzone elemnt |
| draggable, // draggable Interactable |
| draggableElement) {// draggable element |
| |
| return dropped && event.target.hasAttribute('allow-drop'); |
| } |
\*/ |
dropChecker: function (checker) { |
if (isFunction(checker)) { |
this.options.drop.checker = checker; |
return this; |
} |
if (checker === null) { |
delete this.options.getRect; |
return this; |
} |
return this.options.drop.checker; |
}, |
/*\ |
* Interactable.accept |
[ method ] |
* |
* Deprecated. add an `accept` property to the options object passed to |
* @Interactable.dropzone instead. |
* |
* Gets or sets the Element or CSS selector match that this |
* Interactable accepts if it is a dropzone. |
* |
- newValue (Element | string | null) #optional |
* If it is an Element, then only that element can be dropped into this dropzone. |
* If it is a string, the element being dragged must match it as a selector. |
* If it is null, the accept options is cleared - it accepts any element. |
* |
= (string | Element | null | Interactable) The current accept option if given `undefined` or this Interactable |
\*/ |
accept: function (newValue) { |
if (isElement(newValue)) { |
this.options.drop.accept = newValue; |
return this; |
} |
// test if it is a valid CSS selector |
if (trySelector(newValue)) { |
this.options.drop.accept = newValue; |
return this; |
} |
if (newValue === null) { |
delete this.options.drop.accept; |
return this; |
} |
return this.options.drop.accept; |
}, |
/*\ |
* Interactable.resizable |
[ method ] |
* |
* Gets or sets whether resize actions can be performed on the |
* Interactable |
* |
= (boolean) Indicates if this can be the target of resize elements |
| var isResizeable = interact('input[type=text]').resizable(); |
* or |
- options (boolean | object) #optional true/false or An object with event listeners to be fired on resize events (object makes the Interactable resizable) |
= (object) This Interactable |
| interact(element).resizable({ |
| onstart: function (event) {}, |
| onmove : function (event) {}, |
| onend : function (event) {}, |
| |
| edges: { |
| top : true, // Use pointer coords to check for resize. |
| left : false, // Disable resizing from left edge. |
| bottom: '.resize-s',// Resize if pointer target matches selector |
| right : handleEl // Resize if pointer target is the given Element |
| }, |
| |
| // Width and height can be adjusted independently. When `true`, width and |
| // height are adjusted at a 1:1 ratio. |
| square: false, |
| |
| // Width and height can be adjusted independently. When `true`, width and |
| // height maintain the aspect ratio they had when resizing started. |
| preserveAspectRatio: false, |
| |
| // a value of 'none' will limit the resize rect to a minimum of 0x0 |
| // 'negate' will allow the rect to have negative width/height |
| // 'reposition' will keep the width/height positive by swapping |
| // the top and bottom edges and/or swapping the left and right edges |
| invert: 'none' || 'negate' || 'reposition' |
| |
| // limit multiple resizes. |
| // See the explanation in the @Interactable.draggable example |
| max: Infinity, |
| maxPerElement: 1, |
| }); |
\*/ |
resizable: function (options) { |
if (isObject(options)) { |
this.options.resize.enabled = options.enabled === false? false: true; |
this.setPerAction('resize', options); |
this.setOnEvents('resize', options); |
if (/^x$|^y$|^xy$/.test(options.axis)) { |
this.options.resize.axis = options.axis; |
} |
else if (options.axis === null) { |
this.options.resize.axis = defaultOptions.resize.axis; |
} |
if (isBool(options.preserveAspectRatio)) { |
this.options.resize.preserveAspectRatio = options.preserveAspectRatio; |
} |
else if (isBool(options.square)) { |
this.options.resize.square = options.square; |
} |
return this; |
} |
if (isBool(options)) { |
this.options.resize.enabled = options; |
return this; |
} |
return this.options.resize; |
}, |
/*\ |
* Interactable.squareResize |
[ method ] |
* |
* Deprecated. Add a `square: true || false` property to @Interactable.resizable instead |
* |
* Gets or sets whether resizing is forced 1:1 aspect |
* |
= (boolean) Current setting |
* |
* or |
* |
- newValue (boolean) #optional |
= (object) this Interactable |
\*/ |
squareResize: function (newValue) { |
if (isBool(newValue)) { |
this.options.resize.square = newValue; |
return this; |
} |
if (newValue === null) { |
delete this.options.resize.square; |
return this; |
} |
return this.options.resize.square; |
}, |
/*\ |
* Interactable.gesturable |
[ method ] |
* |
* Gets or sets whether multitouch gestures can be performed on the |
* Interactable's element |
* |
= (boolean) Indicates if this can be the target of gesture events |
| var isGestureable = interact(element).gesturable(); |
* or |
- options (boolean | object) #optional true/false or An object with event listeners to be fired on gesture events (makes the Interactable gesturable) |
= (object) this Interactable |
| interact(element).gesturable({ |
| onstart: function (event) {}, |
| onmove : function (event) {}, |
| onend : function (event) {}, |
| |
| // limit multiple gestures. |
| // See the explanation in @Interactable.draggable example |
| max: Infinity, |
| maxPerElement: 1, |
| }); |
\*/ |
gesturable: function (options) { |
if (isObject(options)) { |
this.options.gesture.enabled = options.enabled === false? false: true; |
this.setPerAction('gesture', options); |
this.setOnEvents('gesture', options); |
return this; |
} |
if (isBool(options)) { |
this.options.gesture.enabled = options; |
return this; |
} |
return this.options.gesture; |
}, |
/*\ |
* Interactable.autoScroll |
[ method ] |
** |
* Deprecated. Add an `autoscroll` property to the options object |
* passed to @Interactable.draggable or @Interactable.resizable instead. |
* |
* Returns or sets whether dragging and resizing near the edges of the |
* window/container trigger autoScroll for this Interactable |
* |
= (object) Object with autoScroll properties |
* |
* or |
* |
- options (object | boolean) #optional |
* options can be: |
* - an object with margin, distance and interval properties, |
* - true or false to enable or disable autoScroll or |
= (Interactable) this Interactable |
\*/ |
autoScroll: function (options) { |
if (isObject(options)) { |
options = extend({ actions: ['drag', 'resize']}, options); |
} |
else if (isBool(options)) { |
options = { actions: ['drag', 'resize'], enabled: options }; |
} |
return this.setOptions('autoScroll', options); |
}, |
/*\ |
* Interactable.snap |
[ method ] |
** |
* Deprecated. Add a `snap` property to the options object passed |
* to @Interactable.draggable or @Interactable.resizable instead. |
* |
* Returns or sets if and how action coordinates are snapped. By |
* default, snapping is relative to the pointer coordinates. You can |
* change this by setting the |
* [`elementOrigin`](https://github.com/taye/interact.js/pull/72). |
** |
= (boolean | object) `false` if snap is disabled; object with snap properties if snap is enabled |
** |
* or |
** |
- options (object | boolean | null) #optional |
= (Interactable) this Interactable |
> Usage |
| interact(document.querySelector('#thing')).snap({ |
| targets: [ |
| // snap to this specific point |
| { |
| x: 100, |
| y: 100, |
| range: 25 |
| }, |
| // give this function the x and y page coords and snap to the object returned |
| function (x, y) { |
| return { |
| x: x, |
| y: (75 + 50 * Math.sin(x * 0.04)), |
| range: 40 |
| }; |
| }, |
| // create a function that snaps to a grid |
| interact.createSnapGrid({ |
| x: 50, |
| y: 50, |
| range: 10, // optional |
| offset: { x: 5, y: 10 } // optional |
| }) |
| ], |
| // do not snap during normal movement. |
| // Instead, trigger only one snapped move event |
| // immediately before the end event. |
| endOnly: true, |
| |
| relativePoints: [ |
| { x: 0, y: 0 }, // snap relative to the top left of the element |
| { x: 1, y: 1 }, // and also to the bottom right |
| ], |
| |
| // offset the snap target coordinates |
| // can be an object with x/y or 'startCoords' |
| offset: { x: 50, y: 50 } |
| } |
| }); |
\*/ |
snap: function (options) { |
var ret = this.setOptions('snap', options); |
if (ret === this) { return this; } |
return ret.drag; |
}, |
setOptions: function (option, options) { |
var actions = options && isArray(options.actions) |
? options.actions |
: ['drag']; |
var i; |
if (isObject(options) || isBool(options)) { |
for (i = 0; i < actions.length; i++) { |
var action = /resize/.test(actions[i])? 'resize' : actions[i]; |
if (!isObject(this.options[action])) { continue; } |
var thisOption = this.options[action][option]; |
if (isObject(options)) { |
extend(thisOption, options); |
thisOption.enabled = options.enabled === false? false: true; |
if (option === 'snap') { |
if (thisOption.mode === 'grid') { |
thisOption.targets = [ |
interact.createSnapGrid(extend({ |
offset: thisOption.gridOffset || { x: 0, y: 0 } |
}, thisOption.grid || {})) |
]; |
} |
else if (thisOption.mode === 'anchor') { |
thisOption.targets = thisOption.anchors; |
} |
else if (thisOption.mode === 'path') { |
thisOption.targets = thisOption.paths; |
} |
if ('elementOrigin' in options) { |
thisOption.relativePoints = [options.elementOrigin]; |
} |
} |
} |
else if (isBool(options)) { |
thisOption.enabled = options; |
} |
} |
return this; |
} |
var ret = {}, |
allActions = ['drag', 'resize', 'gesture']; |
for (i = 0; i < allActions.length; i++) { |
if (option in defaultOptions[allActions[i]]) { |
ret[allActions[i]] = this.options[allActions[i]][option]; |
} |
} |
return ret; |
}, |
/*\ |
* Interactable.inertia |
[ method ] |
** |
* Deprecated. Add an `inertia` property to the options object passed |
* to @Interactable.draggable or @Interactable.resizable instead. |
* |
* Returns or sets if and how events continue to run after the pointer is released |
** |
= (boolean | object) `false` if inertia is disabled; `object` with inertia properties if inertia is enabled |
** |
* or |
** |
- options (object | boolean | null) #optional |
= (Interactable) this Interactable |
> Usage |
| // enable and use default settings |
| interact(element).inertia(true); |
| |
| // enable and use custom settings |
| interact(element).inertia({ |
| // value greater than 0 |
| // high values slow the object down more quickly |
| resistance : 16, |
| |
| // the minimum launch speed (pixels per second) that results in inertia start |
| minSpeed : 200, |
| |
| // inertia will stop when the object slows down to this speed |
| endSpeed : 20, |
| |
| // boolean; should actions be resumed when the pointer goes down during inertia |
| allowResume : true, |
| |
| // boolean; should the jump when resuming from inertia be ignored in event.dx/dy |
| zeroResumeDelta: false, |
| |
| // if snap/restrict are set to be endOnly and inertia is enabled, releasing |
| // the pointer without triggering inertia will animate from the release |
| // point to the snaped/restricted point in the given amount of time (ms) |
| smoothEndDuration: 300, |
| |
| // an array of action types that can have inertia (no gesture) |
| actions : ['drag', 'resize'] |
| }); |
| |
| // reset custom settings and use all defaults |
| interact(element).inertia(null); |
\*/ |
inertia: function (options) { |
var ret = this.setOptions('inertia', options); |
if (ret === this) { return this; } |
return ret.drag; |
}, |
getAction: function (pointer, event, interaction, element) { |
var action = this.defaultActionChecker(pointer, interaction, element); |
if (this.options.actionChecker) { |
return this.options.actionChecker(pointer, event, action, this, element, interaction); |
} |
return action; |
}, |
defaultActionChecker: defaultActionChecker, |
/*\ |
* Interactable.actionChecker |
[ method ] |
* |
* Gets or sets the function used to check action to be performed on |
* pointerDown |
* |
- checker (function | null) #optional A function which takes a pointer event, defaultAction string, interactable, element and interaction as parameters and returns an object with name property 'drag' 'resize' or 'gesture' and optionally an `edges` object with boolean 'top', 'left', 'bottom' and right props. |
= (Function | Interactable) The checker function or this Interactable |
* |
| interact('.resize-drag') |
| .resizable(true) |
| .draggable(true) |
| .actionChecker(function (pointer, event, action, interactable, element, interaction) { |
| |
| if (interact.matchesSelector(event.target, '.drag-handle') { |
| // force drag with handle target |
| action.name = drag; |
| } |
| else { |
| // resize from the top and right edges |
| action.name = 'resize'; |
| action.edges = { top: true, right: true }; |
| } |
| |
| return action; |
| }); |
\*/ |
actionChecker: function (checker) { |
if (isFunction(checker)) { |
this.options.actionChecker = checker; |
return this; |
} |
if (checker === null) { |
delete this.options.actionChecker; |
return this; |
} |
return this.options.actionChecker; |
}, |
/*\ |
* Interactable.getRect |
[ method ] |
* |
* The default function to get an Interactables bounding rect. Can be |
* overridden using @Interactable.rectChecker. |
* |
- element (Element) #optional The element to measure. |
= (object) The object's bounding rectangle. |
o { |
o top : 0, |
o left : 0, |
o bottom: 0, |
o right : 0, |
o width : 0, |
o height: 0 |
o } |
\*/ |
getRect: function rectCheck (element) { |
element = element || this._element; |
if (this.selector && !(isElement(element))) { |
element = this._context.querySelector(this.selector); |
} |
return getElementRect(element); |
}, |
/*\ |
* Interactable.rectChecker |
[ method ] |
* |
* Returns or sets the function used to calculate the interactable's |
* element's rectangle |
* |
- checker (function) #optional A function which returns this Interactable's bounding rectangle. See @Interactable.getRect |
= (function | object) The checker function or this Interactable |
\*/ |
rectChecker: function (checker) { |
if (isFunction(checker)) { |
this.getRect = checker; |
return this; |
} |
if (checker === null) { |
delete this.options.getRect; |
return this; |
} |
return this.getRect; |
}, |
/*\ |
* Interactable.styleCursor |
[ method ] |
* |
* Returns or sets whether the action that would be performed when the |
* mouse on the element are checked on `mousemove` so that the cursor |
* may be styled appropriately |
* |
- newValue (boolean) #optional |
= (boolean | Interactable) The current setting or this Interactable |
\*/ |
styleCursor: function (newValue) { |
if (isBool(newValue)) { |
this.options.styleCursor = newValue; |
return this; |
} |
if (newValue === null) { |
delete this.options.styleCursor; |
return this; |
} |
return this.options.styleCursor; |
}, |
/*\ |
* Interactable.preventDefault |
[ method ] |
* |
* Returns or sets whether to prevent the browser's default behaviour |
* in response to pointer events. Can be set to: |
* - `'always'` to always prevent |
* - `'never'` to never prevent |
* - `'auto'` to let interact.js try to determine what would be best |
* |
- newValue (string) #optional `true`, `false` or `'auto'` |
= (string | Interactable) The current setting or this Interactable |
\*/ |
preventDefault: function (newValue) { |
if (/^(always|never|auto)$/.test(newValue)) { |
this.options.preventDefault = newValue; |
return this; |
} |
if (isBool(newValue)) { |
this.options.preventDefault = newValue? 'always' : 'never'; |
return this; |
} |
return this.options.preventDefault; |
}, |
/*\ |
* Interactable.origin |
[ method ] |
* |
* Gets or sets the origin of the Interactable's element. The x and y |
* of the origin will be subtracted from action event coordinates. |
* |
- origin (object | string) #optional An object eg. { x: 0, y: 0 } or string 'parent', 'self' or any CSS selector |
* OR |
- origin (Element) #optional An HTML or SVG Element whose rect will be used |
** |
= (object) The current origin or this Interactable |
\*/ |
origin: function (newValue) { |
if (trySelector(newValue)) { |
this.options.origin = newValue; |
return this; |
} |
else if (isObject(newValue)) { |
this.options.origin = newValue; |
return this; |
} |
return this.options.origin; |
}, |
/*\ |
* Interactable.deltaSource |
[ method ] |
* |
* Returns or sets the mouse coordinate types used to calculate the |
* movement of the pointer. |
* |
- newValue (string) #optional Use 'client' if you will be scrolling while interacting; Use 'page' if you want autoScroll to work |
= (string | object) The current deltaSource or this Interactable |
\*/ |
deltaSource: function (newValue) { |
if (newValue === 'page' || newValue === 'client') { |
this.options.deltaSource = newValue; |
return this; |
} |
return this.options.deltaSource; |
}, |
/*\ |
* Interactable.restrict |
[ method ] |
** |
* Deprecated. Add a `restrict` property to the options object passed to |
* @Interactable.draggable, @Interactable.resizable or @Interactable.gesturable instead. |
* |
* Returns or sets the rectangles within which actions on this |
* interactable (after snap calculations) are restricted. By default, |
* restricting is relative to the pointer coordinates. You can change |
* this by setting the |
* [`elementRect`](https://github.com/taye/interact.js/pull/72). |
** |
- options (object) #optional an object with keys drag, resize, and/or gesture whose values are rects, Elements, CSS selectors, or 'parent' or 'self' |
= (object) The current restrictions object or this Interactable |
** |
| interact(element).restrict({ |
| // the rect will be `interact.getElementRect(element.parentNode)` |
| drag: element.parentNode, |
| |
| // x and y are relative to the the interactable's origin |
| resize: { x: 100, y: 100, width: 200, height: 200 } |
| }) |
| |
| interact('.draggable').restrict({ |
| // the rect will be the selected element's parent |
| drag: 'parent', |
| |
| // do not restrict during normal movement. |
| // Instead, trigger only one restricted move event |
| // immediately before the end event. |
| endOnly: true, |
| |
| // https://github.com/taye/interact.js/pull/72#issue-41813493 |
| elementRect: { top: 0, left: 0, bottom: 1, right: 1 } |
| }); |
\*/ |
restrict: function (options) { |
if (!isObject(options)) { |
return this.setOptions('restrict', options); |
} |
var actions = ['drag', 'resize', 'gesture'], |
ret; |
for (var i = 0; i < actions.length; i++) { |
var action = actions[i]; |
if (action in options) { |
var perAction = extend({ |
actions: [action], |
restriction: options[action] |
}, options); |
ret = this.setOptions('restrict', perAction); |
} |
} |
return ret; |
}, |
/*\ |
* Interactable.context |
[ method ] |
* |
* Gets the selector context Node of the Interactable. The default is `window.document`. |
* |
= (Node) The context Node of this Interactable |
** |
\*/ |
context: function () { |
return this._context; |
}, |
_context: document, |
/*\ |
* Interactable.ignoreFrom |
[ method ] |
* |
* If the target of the `mousedown`, `pointerdown` or `touchstart` |
* event or any of it's parents match the given CSS selector or |
* Element, no drag/resize/gesture is started. |
* |
- newValue (string | Element | null) #optional a CSS selector string, an Element or `null` to not ignore any elements |
= (string | Element | object) The current ignoreFrom value or this Interactable |
** |
| interact(element, { ignoreFrom: document.getElementById('no-action') }); |
| // or |
| interact(element).ignoreFrom('input, textarea, a'); |
\*/ |
ignoreFrom: function (newValue) { |
if (trySelector(newValue)) { // CSS selector to match event.target |
this.options.ignoreFrom = newValue; |
return this; |
} |
if (isElement(newValue)) { // specific element |
this.options.ignoreFrom = newValue; |
return this; |
} |
return this.options.ignoreFrom; |
}, |
/*\ |
* Interactable.allowFrom |
[ method ] |
* |
* A drag/resize/gesture is started only If the target of the |
* `mousedown`, `pointerdown` or `touchstart` event or any of it's |
* parents match the given CSS selector or Element. |
* |
- newValue (string | Element | null) #optional a CSS selector string, an Element or `null` to allow from any element |
= (string | Element | object) The current allowFrom value or this Interactable |
** |
| interact(element, { allowFrom: document.getElementById('drag-handle') }); |
| // or |
| interact(element).allowFrom('.handle'); |
\*/ |
allowFrom: function (newValue) { |
if (trySelector(newValue)) { // CSS selector to match event.target |
this.options.allowFrom = newValue; |
return this; |
} |
if (isElement(newValue)) { // specific element |
this.options.allowFrom = newValue; |
return this; |
} |
return this.options.allowFrom; |
}, |
/*\ |
* Interactable.element |
[ method ] |
* |
* If this is not a selector Interactable, it returns the element this |
* interactable represents |
* |
= (Element) HTML / SVG Element |
\*/ |
element: function () { |
return this._element; |
}, |
/*\ |
* Interactable.fire |
[ method ] |
* |
* Calls listeners for the given InteractEvent type bound globally |
* and directly to this Interactable |
* |
- iEvent (InteractEvent) The InteractEvent object to be fired on this Interactable |
= (Interactable) this Interactable |
\*/ |
fire: function (iEvent) { |
if (!(iEvent && iEvent.type) || !contains(eventTypes, iEvent.type)) { |
return this; |
} |
var listeners, |
i, |
len, |
onEvent = 'on' + iEvent.type, |
funcName = ''; |
// Interactable#on() listeners |
if (iEvent.type in this._iEvents) { |
listeners = this._iEvents[iEvent.type]; |
for (i = 0, len = listeners.length; i < len && !iEvent.immediatePropagationStopped; i++) { |
funcName = listeners[i].name; |
listeners[i](iEvent); |
} |
} |
// interactable.onevent listener |
if (isFunction(this[onEvent])) { |
funcName = this[onEvent].name; |
this[onEvent](iEvent); |
} |
// interact.on() listeners |
if (iEvent.type in globalEvents && (listeners = globalEvents[iEvent.type])) { |
for (i = 0, len = listeners.length; i < len && !iEvent.immediatePropagationStopped; i++) { |
funcName = listeners[i].name; |
listeners[i](iEvent); |
} |
} |
return this; |
}, |
/*\ |
* Interactable.on |
[ method ] |
* |
* Binds a listener for an InteractEvent or DOM event. |
* |
- eventType (string | array | object) The types of events to listen for |
- listener (function) The function to be called on the given event(s) |
- useCapture (boolean) #optional useCapture flag for addEventListener |
= (object) This Interactable |
\*/ |
on: function (eventType, listener, useCapture) { |
var i; |
if (isString(eventType) && eventType.search(' ') !== -1) { |
eventType = eventType.trim().split(/ +/); |
} |
if (isArray(eventType)) { |
for (i = 0; i < eventType.length; i++) { |
this.on(eventType[i], listener, useCapture); |
} |
return this; |
} |
if (isObject(eventType)) { |
for (var prop in eventType) { |
this.on(prop, eventType[prop], listener); |
} |
return this; |
} |
if (eventType === 'wheel') { |
eventType = wheelEvent; |
} |
// convert to boolean |
useCapture = useCapture? true: false; |
if (contains(eventTypes, eventType)) { |
// if this type of event was never bound to this Interactable |
if (!(eventType in this._iEvents)) { |
this._iEvents[eventType] = [listener]; |
} |
else { |
this._iEvents[eventType].push(listener); |
} |
} |
// delegated event for selector |
else if (this.selector) { |
if (!delegatedEvents[eventType]) { |
delegatedEvents[eventType] = { |
selectors: [], |
contexts : [], |
listeners: [] |
}; |
// add delegate listener functions |
for (i = 0; i < documents.length; i++) { |
events.add(documents[i], eventType, delegateListener); |
events.add(documents[i], eventType, delegateUseCapture, true); |
} |
} |
var delegated = delegatedEvents[eventType], |
index; |
for (index = delegated.selectors.length - 1; index >= 0; index--) { |
if (delegated.selectors[index] === this.selector |
&& delegated.contexts[index] === this._context) { |
break; |
} |
} |
if (index === -1) { |
index = delegated.selectors.length; |
delegated.selectors.push(this.selector); |
delegated.contexts .push(this._context); |
delegated.listeners.push([]); |
} |
// keep listener and useCapture flag |
delegated.listeners[index].push([listener, useCapture]); |
} |
else { |
events.add(this._element, eventType, listener, useCapture); |
} |
return this; |
}, |
/*\ |
* Interactable.off |
[ method ] |
* |
* Removes an InteractEvent or DOM event listener |
* |
- eventType (string | array | object) The types of events that were listened for |
- listener (function) The listener function to be removed |
- useCapture (boolean) #optional useCapture flag for removeEventListener |
= (object) This Interactable |
\*/ |
off: function (eventType, listener, useCapture) { |
var i; |
if (isString(eventType) && eventType.search(' ') !== -1) { |
eventType = eventType.trim().split(/ +/); |
} |
if (isArray(eventType)) { |
for (i = 0; i < eventType.length; i++) { |
this.off(eventType[i], listener, useCapture); |
} |
return this; |
} |
if (isObject(eventType)) { |
for (var prop in eventType) { |
this.off(prop, eventType[prop], listener); |
} |
return this; |
} |
var eventList, |
index = -1; |
// convert to boolean |
useCapture = useCapture? true: false; |
if (eventType === 'wheel') { |
eventType = wheelEvent; |
} |
// if it is an action event type |
if (contains(eventTypes, eventType)) { |
eventList = this._iEvents[eventType]; |
if (eventList && (index = indexOf(eventList, listener)) !== -1) { |
this._iEvents[eventType].splice(index, 1); |
} |
} |
// delegated event |
else if (this.selector) { |
var delegated = delegatedEvents[eventType], |
matchFound = false; |
if (!delegated) { return this; } |
// count from last index of delegated to 0 |
for (index = delegated.selectors.length - 1; index >= 0; index--) { |
// look for matching selector and context Node |
if (delegated.selectors[index] === this.selector |
&& delegated.contexts[index] === this._context) { |
var listeners = delegated.listeners[index]; |
// each item of the listeners array is an array: [function, useCaptureFlag] |
for (i = listeners.length - 1; i >= 0; i--) { |
var fn = listeners[i][0], |
useCap = listeners[i][1]; |
// check if the listener functions and useCapture flags match |
if (fn === listener && useCap === useCapture) { |
// remove the listener from the array of listeners |
listeners.splice(i, 1); |
// if all listeners for this interactable have been removed |
// remove the interactable from the delegated arrays |
if (!listeners.length) { |
delegated.selectors.splice(index, 1); |
delegated.contexts .splice(index, 1); |
delegated.listeners.splice(index, 1); |
// remove delegate function from context |
events.remove(this._context, eventType, delegateListener); |
events.remove(this._context, eventType, delegateUseCapture, true); |
// remove the arrays if they are empty |
if (!delegated.selectors.length) { |
delegatedEvents[eventType] = null; |
} |
} |
// only remove one listener |
matchFound = true; |
break; |
} |
} |
if (matchFound) { break; } |
} |
} |
} |
// remove listener from this Interatable's element |
else { |
events.remove(this._element, eventType, listener, useCapture); |
} |
return this; |
}, |
/*\ |
* Interactable.set |
[ method ] |
* |
* Reset the options of this Interactable |
- options (object) The new settings to apply |
= (object) This Interactable |
\*/ |
set: function (options) { |
if (!isObject(options)) { |
options = {}; |
} |
this.options = extend({}, defaultOptions.base); |
var i, |
actions = ['drag', 'drop', 'resize', 'gesture'], |
methods = ['draggable', 'dropzone', 'resizable', 'gesturable'], |
perActions = extend(extend({}, defaultOptions.perAction), options[action] || {}); |
for (i = 0; i < actions.length; i++) { |
var action = actions[i]; |
this.options[action] = extend({}, defaultOptions[action]); |
this.setPerAction(action, perActions); |
this[methods[i]](options[action]); |
} |
var settings = [ |
'accept', 'actionChecker', 'allowFrom', 'deltaSource', |
'dropChecker', 'ignoreFrom', 'origin', 'preventDefault', |
'rectChecker', 'styleCursor' |
]; |
for (i = 0, len = settings.length; i < len; i++) { |
var setting = settings[i]; |
this.options[setting] = defaultOptions.base[setting]; |
if (setting in options) { |
this[setting](options[setting]); |
} |
} |
return this; |
}, |
/*\ |
* Interactable.unset |
[ method ] |
* |
* Remove this interactable from the list of interactables and remove |
* it's drag, drop, resize and gesture capabilities |
* |
= (object) @interact |
\*/ |
unset: function () { |
events.remove(this._element, 'all'); |
if (!isString(this.selector)) { |
events.remove(this, 'all'); |
if (this.options.styleCursor) { |
this._element.style.cursor = ''; |
} |
} |
else { |
// remove delegated events |
for (var type in delegatedEvents) { |
var delegated = delegatedEvents[type]; |
for (var i = 0; i < delegated.selectors.length; i++) { |
if (delegated.selectors[i] === this.selector |
&& delegated.contexts[i] === this._context) { |
delegated.selectors.splice(i, 1); |
delegated.contexts .splice(i, 1); |
delegated.listeners.splice(i, 1); |
// remove the arrays if they are empty |
if (!delegated.selectors.length) { |
delegatedEvents[type] = null; |
} |
} |
events.remove(this._context, type, delegateListener); |
events.remove(this._context, type, delegateUseCapture, true); |
break; |
} |
} |
} |
this.dropzone(false); |
interactables.splice(indexOf(interactables, this), 1); |
return interact; |
} |
}; |
function warnOnce (method, message) { |
var warned = false; |
return function () { |
if (!warned) { |
window.console.warn(message); |
warned = true; |
} |
return method.apply(this, arguments); |
}; |
} |
Interactable.prototype.snap = warnOnce(Interactable.prototype.snap, |
'Interactable#snap is deprecated. See the new documentation for snapping at http://interactjs.io/docs/snapping'); |
Interactable.prototype.restrict = warnOnce(Interactable.prototype.restrict, |
'Interactable#restrict is deprecated. See the new documentation for resticting at http://interactjs.io/docs/restriction'); |
Interactable.prototype.inertia = warnOnce(Interactable.prototype.inertia, |
'Interactable#inertia is deprecated. See the new documentation for inertia at http://interactjs.io/docs/inertia'); |
Interactable.prototype.autoScroll = warnOnce(Interactable.prototype.autoScroll, |
'Interactable#autoScroll is deprecated. See the new documentation for autoScroll at http://interactjs.io/docs/#autoscroll'); |
Interactable.prototype.squareResize = warnOnce(Interactable.prototype.squareResize, |
'Interactable#squareResize is deprecated. See http://interactjs.io/docs/#resize-square'); |
Interactable.prototype.accept = warnOnce(Interactable.prototype.accept, |
'Interactable#accept is deprecated. use Interactable#dropzone({ accept: target }) instead'); |
Interactable.prototype.dropChecker = warnOnce(Interactable.prototype.dropChecker, |
'Interactable#dropChecker is deprecated. use Interactable#dropzone({ dropChecker: checkerFunction }) instead'); |
Interactable.prototype.context = warnOnce(Interactable.prototype.context, |
'Interactable#context as a method is deprecated. It will soon be a DOM Node instead'); |
/*\ |
* interact.isSet |
[ method ] |
* |
* Check if an element has been set |
- element (Element) The Element being searched for |
= (boolean) Indicates if the element or CSS selector was previously passed to interact |
\*/ |
interact.isSet = function(element, options) { |
return interactables.indexOfElement(element, options && options.context) !== -1; |
}; |
/*\ |
* interact.on |
[ method ] |
* |
* Adds a global listener for an InteractEvent or adds a DOM event to |
* `document` |
* |
- type (string | array | object) The types of events to listen for |
- listener (function) The function to be called on the given event(s) |
- useCapture (boolean) #optional useCapture flag for addEventListener |
= (object) interact |
\*/ |
interact.on = function (type, listener, useCapture) { |
if (isString(type) && type.search(' ') !== -1) { |
type = type.trim().split(/ +/); |
} |
if (isArray(type)) { |
for (var i = 0; i < type.length; i++) { |
interact.on(type[i], listener, useCapture); |
} |
return interact; |
} |
if (isObject(type)) { |
for (var prop in type) { |
interact.on(prop, type[prop], listener); |
} |
return interact; |
} |
// if it is an InteractEvent type, add listener to globalEvents |
if (contains(eventTypes, type)) { |
// if this type of event was never bound |
if (!globalEvents[type]) { |
globalEvents[type] = [listener]; |
} |
else { |
globalEvents[type].push(listener); |
} |
} |
// If non InteractEvent type, addEventListener to document |
else { |
events.add(document, type, listener, useCapture); |
} |
return interact; |
}; |
/*\ |
* interact.off |
[ method ] |
* |
* Removes a global InteractEvent listener or DOM event from `document` |
* |
- type (string | array | object) The types of events that were listened for |
- listener (function) The listener function to be removed |
- useCapture (boolean) #optional useCapture flag for removeEventListener |
= (object) interact |
\*/ |
interact.off = function (type, listener, useCapture) { |
if (isString(type) && type.search(' ') !== -1) { |
type = type.trim().split(/ +/); |
} |
if (isArray(type)) { |
for (var i = 0; i < type.length; i++) { |
interact.off(type[i], listener, useCapture); |
} |
return interact; |
} |
if (isObject(type)) { |
for (var prop in type) { |
interact.off(prop, type[prop], listener); |
} |
return interact; |
} |
if (!contains(eventTypes, type)) { |
events.remove(document, type, listener, useCapture); |
} |
else { |
var index; |
if (type in globalEvents |
&& (index = indexOf(globalEvents[type], listener)) !== -1) { |
globalEvents[type].splice(index, 1); |
} |
} |
return interact; |
}; |
/*\ |
* interact.enableDragging |
[ method ] |
* |
* Deprecated. |
* |
* Returns or sets whether dragging is enabled for any Interactables |
* |
- newValue (boolean) #optional `true` to allow the action; `false` to disable action for all Interactables |
= (boolean | object) The current setting or interact |
\*/ |
interact.enableDragging = warnOnce(function (newValue) { |
if (newValue !== null && newValue !== undefined) { |
actionIsEnabled.drag = newValue; |
return interact; |
} |
return actionIsEnabled.drag; |
}, 'interact.enableDragging is deprecated and will soon be removed.'); |
/*\ |
* interact.enableResizing |
[ method ] |
* |
* Deprecated. |
* |
* Returns or sets whether resizing is enabled for any Interactables |
* |
- newValue (boolean) #optional `true` to allow the action; `false` to disable action for all Interactables |
= (boolean | object) The current setting or interact |
\*/ |
interact.enableResizing = warnOnce(function (newValue) { |
if (newValue !== null && newValue !== undefined) { |
actionIsEnabled.resize = newValue; |
return interact; |
} |
return actionIsEnabled.resize; |
}, 'interact.enableResizing is deprecated and will soon be removed.'); |
/*\ |
* interact.enableGesturing |
[ method ] |
* |
* Deprecated. |
* |
* Returns or sets whether gesturing is enabled for any Interactables |
* |
- newValue (boolean) #optional `true` to allow the action; `false` to disable action for all Interactables |
= (boolean | object) The current setting or interact |
\*/ |
interact.enableGesturing = warnOnce(function (newValue) { |
if (newValue !== null && newValue !== undefined) { |
actionIsEnabled.gesture = newValue; |
return interact; |
} |
return actionIsEnabled.gesture; |
}, 'interact.enableGesturing is deprecated and will soon be removed.'); |
interact.eventTypes = eventTypes; |
/*\ |
* interact.debug |
[ method ] |
* |
* Returns debugging data |
= (object) An object with properties that outline the current state and expose internal functions and variables |
\*/ |
interact.debug = function () { |
var interaction = interactions[0] || new Interaction(); |
return { |
interactions : interactions, |
target : interaction.target, |
dragging : interaction.dragging, |
resizing : interaction.resizing, |
gesturing : interaction.gesturing, |
prepared : interaction.prepared, |
matches : interaction.matches, |
matchElements : interaction.matchElements, |
prevCoords : interaction.prevCoords, |
startCoords : interaction.startCoords, |
pointerIds : interaction.pointerIds, |
pointers : interaction.pointers, |
addPointer : listeners.addPointer, |
removePointer : listeners.removePointer, |
recordPointer : listeners.recordPointer, |
snap : interaction.snapStatus, |
restrict : interaction.restrictStatus, |
inertia : interaction.inertiaStatus, |
downTime : interaction.downTimes[0], |
downEvent : interaction.downEvent, |
downPointer : interaction.downPointer, |
prevEvent : interaction.prevEvent, |
Interactable : Interactable, |
interactables : interactables, |
pointerIsDown : interaction.pointerIsDown, |
defaultOptions : defaultOptions, |
defaultActionChecker : defaultActionChecker, |
actionCursors : actionCursors, |
dragMove : listeners.dragMove, |
resizeMove : listeners.resizeMove, |
gestureMove : listeners.gestureMove, |
pointerUp : listeners.pointerUp, |
pointerDown : listeners.pointerDown, |
pointerMove : listeners.pointerMove, |
pointerHover : listeners.pointerHover, |
eventTypes : eventTypes, |
events : events, |
globalEvents : globalEvents, |
delegatedEvents : delegatedEvents, |
prefixedPropREs : prefixedPropREs |
}; |
}; |
// expose the functions used to calculate multi-touch properties |
interact.getPointerAverage = pointerAverage; |
interact.getTouchBBox = touchBBox; |
interact.getTouchDistance = touchDistance; |
interact.getTouchAngle = touchAngle; |
interact.getElementRect = getElementRect; |
interact.getElementClientRect = getElementClientRect; |
interact.matchesSelector = matchesSelector; |
interact.closest = closest; |
/*\ |
* interact.margin |
[ method ] |
* |
* Deprecated. Use `interact(target).resizable({ margin: number });` instead. |
* Returns or sets the margin for autocheck resizing used in |
* @Interactable.getAction. That is the distance from the bottom and right |
* edges of an element clicking in which will start resizing |
* |
- newValue (number) #optional |
= (number | interact) The current margin value or interact |
\*/ |
interact.margin = warnOnce(function (newvalue) { |
if (isNumber(newvalue)) { |
margin = newvalue; |
return interact; |
} |
return margin; |
}, |
'interact.margin is deprecated. Use interact(target).resizable({ margin: number }); instead.') ; |
/*\ |
* interact.supportsTouch |
[ method ] |
* |
= (boolean) Whether or not the browser supports touch input |
\*/ |
interact.supportsTouch = function () { |
return supportsTouch; |
}; |
/*\ |
* interact.supportsPointerEvent |
[ method ] |
* |
= (boolean) Whether or not the browser supports PointerEvents |
\*/ |
interact.supportsPointerEvent = function () { |
return supportsPointerEvent; |
}; |
/*\ |
* interact.stop |
[ method ] |
* |
* Cancels all interactions (end events are not fired) |
* |
- event (Event) An event on which to call preventDefault() |
= (object) interact |
\*/ |
interact.stop = function (event) { |
for (var i = interactions.length - 1; i >= 0; i--) { |
interactions[i].stop(event); |
} |
return interact; |
}; |
/*\ |
* interact.dynamicDrop |
[ method ] |
* |
* Returns or sets whether the dimensions of dropzone elements are |
* calculated on every dragmove or only on dragstart for the default |
* dropChecker |
* |
- newValue (boolean) #optional True to check on each move. False to check only before start |
= (boolean | interact) The current setting or interact |
\*/ |
interact.dynamicDrop = function (newValue) { |
if (isBool(newValue)) { |
//if (dragging && dynamicDrop !== newValue && !newValue) { |
//calcRects(dropzones); |
//} |
dynamicDrop = newValue; |
return interact; |
} |
return dynamicDrop; |
}; |
/*\ |
* interact.pointerMoveTolerance |
[ method ] |
* Returns or sets the distance the pointer must be moved before an action |
* sequence occurs. This also affects tolerance for tap events. |
* |
- newValue (number) #optional The movement from the start position must be greater than this value |
= (number | Interactable) The current setting or interact |
\*/ |
interact.pointerMoveTolerance = function (newValue) { |
if (isNumber(newValue)) { |
pointerMoveTolerance = newValue; |
return this; |
} |
return pointerMoveTolerance; |
}; |
/*\ |
* interact.maxInteractions |
[ method ] |
** |
* Returns or sets the maximum number of concurrent interactions allowed. |
* By default only 1 interaction is allowed at a time (for backwards |
* compatibility). To allow multiple interactions on the same Interactables |
* and elements, you need to enable it in the draggable, resizable and |
* gesturable `'max'` and `'maxPerElement'` options. |
** |
- newValue (number) #optional Any number. newValue <= 0 means no interactions. |
\*/ |
interact.maxInteractions = function (newValue) { |
if (isNumber(newValue)) { |
maxInteractions = newValue; |
return this; |
} |
return maxInteractions; |
}; |
interact.createSnapGrid = function (grid) { |
return function (x, y) { |
var offsetX = 0, |
offsetY = 0; |
if (isObject(grid.offset)) { |
offsetX = grid.offset.x; |
offsetY = grid.offset.y; |
} |
var gridx = Math.round((x - offsetX) / grid.x), |
gridy = Math.round((y - offsetY) / grid.y), |
newX = gridx * grid.x + offsetX, |
newY = gridy * grid.y + offsetY; |
return { |
x: newX, |
y: newY, |
range: grid.range |
}; |
}; |
}; |
function endAllInteractions (event) { |
for (var i = 0; i < interactions.length; i++) { |
interactions[i].pointerEnd(event, event); |
} |
} |
function listenToDocument (doc) { |
if (contains(documents, doc)) { return; } |
var win = doc.defaultView || doc.parentWindow; |
// add delegate event listener |
for (var eventType in delegatedEvents) { |
events.add(doc, eventType, delegateListener); |
events.add(doc, eventType, delegateUseCapture, true); |
} |
if (supportsPointerEvent) { |
if (PointerEvent === win.MSPointerEvent) { |
pEventTypes = { |
up: 'MSPointerUp', down: 'MSPointerDown', over: 'mouseover', |
out: 'mouseout', move: 'MSPointerMove', cancel: 'MSPointerCancel' }; |
} |
else { |
pEventTypes = { |
up: 'pointerup', down: 'pointerdown', over: 'pointerover', |
out: 'pointerout', move: 'pointermove', cancel: 'pointercancel' }; |
} |
events.add(doc, pEventTypes.down , listeners.selectorDown ); |
events.add(doc, pEventTypes.move , listeners.pointerMove ); |
events.add(doc, pEventTypes.over , listeners.pointerOver ); |
events.add(doc, pEventTypes.out , listeners.pointerOut ); |
events.add(doc, pEventTypes.up , listeners.pointerUp ); |
events.add(doc, pEventTypes.cancel, listeners.pointerCancel); |
// autoscroll |
events.add(doc, pEventTypes.move, listeners.autoScrollMove); |
} |
else { |
events.add(doc, 'mousedown', listeners.selectorDown); |
events.add(doc, 'mousemove', listeners.pointerMove ); |
events.add(doc, 'mouseup' , listeners.pointerUp ); |
events.add(doc, 'mouseover', listeners.pointerOver ); |
events.add(doc, 'mouseout' , listeners.pointerOut ); |
events.add(doc, 'touchstart' , listeners.selectorDown ); |
events.add(doc, 'touchmove' , listeners.pointerMove ); |
events.add(doc, 'touchend' , listeners.pointerUp ); |
events.add(doc, 'touchcancel', listeners.pointerCancel); |
// autoscroll |
events.add(doc, 'mousemove', listeners.autoScrollMove); |
events.add(doc, 'touchmove', listeners.autoScrollMove); |
} |
events.add(win, 'blur', endAllInteractions); |
try { |
if (win.frameElement) { |
var parentDoc = win.frameElement.ownerDocument, |
parentWindow = parentDoc.defaultView; |
events.add(parentDoc , 'mouseup' , listeners.pointerEnd); |
events.add(parentDoc , 'touchend' , listeners.pointerEnd); |
events.add(parentDoc , 'touchcancel' , listeners.pointerEnd); |
events.add(parentDoc , 'pointerup' , listeners.pointerEnd); |
events.add(parentDoc , 'MSPointerUp' , listeners.pointerEnd); |
events.add(parentWindow, 'blur' , endAllInteractions ); |
} |
} |
catch (error) { |
interact.windowParentError = error; |
} |
// prevent native HTML5 drag on interact.js target elements |
events.add(doc, 'dragstart', function (event) { |
for (var i = 0; i < interactions.length; i++) { |
var interaction = interactions[i]; |
if (interaction.element |
&& (interaction.element === event.target |
|| nodeContains(interaction.element, event.target))) { |
interaction.checkAndPreventDefault(event, interaction.target, interaction.element); |
return; |
} |
} |
}); |
if (events.useAttachEvent) { |
// For IE's lack of Event#preventDefault |
events.add(doc, 'selectstart', function (event) { |
var interaction = interactions[0]; |
if (interaction.currentAction()) { |
interaction.checkAndPreventDefault(event); |
} |
}); |
// For IE's bad dblclick event sequence |
events.add(doc, 'dblclick', doOnInteractions('ie8Dblclick')); |
} |
documents.push(doc); |
} |
listenToDocument(document); |
function indexOf (array, target) { |
for (var i = 0, len = array.length; i < len; i++) { |
if (array[i] === target) { |
return i; |
} |
} |
return -1; |
} |
function contains (array, target) { |
return indexOf(array, target) !== -1; |
} |
function matchesSelector (element, selector, nodeList) { |
if (ie8MatchesSelector) { |
return ie8MatchesSelector(element, selector, nodeList); |
} |
// remove /deep/ from selectors if shadowDOM polyfill is used |
if (window !== realWindow) { |
selector = selector.replace(/\/deep\//g, ' '); |
} |
return element[prefixedMatchesSelector](selector); |
} |
function matchesUpTo (element, selector, limit) { |
while (isElement(element)) { |
if (matchesSelector(element, selector)) { |
return true; |
} |
element = parentElement(element); |
if (element === limit) { |
return matchesSelector(element, selector); |
} |
} |
return false; |
} |
// For IE8's lack of an Element#matchesSelector |
// taken from http://tanalin.com/en/blog/2012/12/matches-selector-ie8/ and modified |
if (!(prefixedMatchesSelector in Element.prototype) || !isFunction(Element.prototype[prefixedMatchesSelector])) { |
ie8MatchesSelector = function (element, selector, elems) { |
elems = elems || element.parentNode.querySelectorAll(selector); |
for (var i = 0, len = elems.length; i < len; i++) { |
if (elems[i] === element) { |
return true; |
} |
} |
return false; |
}; |
} |
// requestAnimationFrame polyfill |
(function() { |
var lastTime = 0, |
vendors = ['ms', 'moz', 'webkit', 'o']; |
for(var x = 0; x < vendors.length && !realWindow.requestAnimationFrame; ++x) { |
reqFrame = realWindow[vendors[x]+'RequestAnimationFrame']; |
cancelFrame = realWindow[vendors[x]+'CancelAnimationFrame'] || realWindow[vendors[x]+'CancelRequestAnimationFrame']; |
} |
if (!reqFrame) { |
reqFrame = function(callback) { |
var currTime = new Date().getTime(), |
timeToCall = Math.max(0, 16 - (currTime - lastTime)), |
id = setTimeout(function() { callback(currTime + timeToCall); }, |
timeToCall); |
lastTime = currTime + timeToCall; |
return id; |
}; |
} |
if (!cancelFrame) { |
cancelFrame = function(id) { |
clearTimeout(id); |
}; |
} |
}()); |
/* global exports: true, module, define */ |
// http://documentcloud.github.io/underscore/docs/underscore.html#section-11 |
if (typeof exports !== 'undefined') { |
if (typeof module !== 'undefined' && module.exports) { |
exports = module.exports = interact; |
} |
exports.interact = interact; |
} |
// AMD |
else if (typeof define === 'function' && define.amd) { |
define('interact', function() { |
return interact; |
}); |
} |
else { |
realWindow.interact = interact; |
} |
} (typeof window === 'undefined'? undefined : window)); |
/base/000_base/node_modules/interactjs/package.json |
---|
@@ -0,0 +1,113 @@ |
{ |
"_args": [ |
[ |
{ |
"raw": "interactjs", |
"scope": null, |
"escapedName": "interactjs", |
"name": "interactjs", |
"rawSpec": "", |
"spec": "latest", |
"type": "tag" |
}, |
"/Users/evacomaroski/Documents/Development/corrade-nucleus-nucleons/base/000_base" |
] |
], |
"_from": "interactjs@latest", |
"_id": "interactjs@1.2.9", |
"_inCache": true, |
"_location": "/interactjs", |
"_nodeVersion": "8.1.2", |
"_npmOperationalInternal": { |
"host": "s3://npm-registry-packages", |
"tmp": "tmp/interactjs-1.2.9.tgz_1498685189282_0.5135741468984634" |
}, |
"_npmUser": { |
"name": "taye", |
"email": "dev@taye.me" |
}, |
"_npmVersion": "4.6.1", |
"_phantomChildren": {}, |
"_requested": { |
"raw": "interactjs", |
"scope": null, |
"escapedName": "interactjs", |
"name": "interactjs", |
"rawSpec": "", |
"spec": "latest", |
"type": "tag" |
}, |
"_requiredBy": [ |
"#USER", |
"/" |
], |
"_resolved": "http://grimore.org:4873/interactjs/-/interactjs-1.2.9.tgz", |
"_shasum": "ae5a3e5bc4b174b7fe2a432df9ef4ef9cbacbdb6", |
"_shrinkwrap": null, |
"_spec": "interactjs", |
"_where": "/Users/evacomaroski/Documents/Development/corrade-nucleus-nucleons/base/000_base", |
"authors": [ |
{ |
"name": "Taye Adeyemi", |
"email": "dev@taye.me", |
"url": "http://taye.me" |
} |
], |
"bugs": { |
"url": "https://github.com/taye/interact.js/issues" |
}, |
"dependencies": {}, |
"description": "Drag and drop, resizing and multi-touch gestures with inertia and snapping for modern browsers (and also IE8+)", |
"devDependencies": {}, |
"directories": {}, |
"dist": { |
"shasum": "ae5a3e5bc4b174b7fe2a432df9ef4ef9cbacbdb6", |
"tarball": "http://grimore.org:4873/interactjs/-/interactjs-1.2.9.tgz" |
}, |
"files": [ |
"dist/", |
"interact.js", |
"LICENSE", |
"interact.d.ts", |
"interact-test.ts" |
], |
"gitHead": "c6aeb28184d0ddbca6f1a6dc97fd7028300a545a", |
"homepage": "http://interactjs.io", |
"keywords": [ |
"interact.js", |
"draggable", |
"droppable", |
"drag", |
"drop", |
"drag and drop", |
"resize", |
"touch", |
"multi-touch", |
"gesture", |
"snap", |
"inertia", |
"grid", |
"autoscroll", |
"SVG" |
], |
"license": "MIT", |
"main": "interact.js", |
"maintainers": [ |
{ |
"name": "taye", |
"email": "dev@taye.me" |
} |
], |
"name": "interactjs", |
"optionalDependencies": {}, |
"readme": "ERROR: No README data found!", |
"repository": { |
"type": "git", |
"url": "git+https://github.com/taye/interact.js.git" |
}, |
"scripts": { |
"build": "npm run write-min-header && cp interact.js dist/ && cd dist && closure-compiler --create_source_map interact.min.js.map interact.js >> interact.min.js && echo '//# sourceMappingURL=interact.min.js.map' >> interact.min.js", |
"write-min-header": "echo -n \"/* interact.js v${npm_package_version} | https://raw.github.com/taye/interact.js/master/LICENSE */\" > dist/interact.min.js" |
}, |
"version": "1.2.9" |
} |