diff --git a/changelog.md b/changelog.md index e71c0f8..2aac04f 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,6 @@ +## 0.6.6 +* Fixed `userSelect` restore on drag drop. + ## 0.6.5 * Removes peer dependencies to let library get installed with latest react. * Adds a fake shim for `requestAnimationFrame` to let code compile in the server. diff --git a/dist/interactable.native.js b/dist/interactable.native.js index b5433b0..1816ef8 100644 --- a/dist/interactable.native.js +++ b/dist/interactable.native.js @@ -1,7 +1,7 @@ /*! * *//* eslint-disable */ /*! - * react-interactable v0.6.5 + * react-interactable v0.6.6 * (c) 2019-present Javier Marquez * Released under the MIT License. */ @@ -880,7 +880,7 @@ animated.y.flattenOffset(); // Restore text selection if (isWeb) { - document.body.userSelect = this.userSelectCache || ''; + document.body.style.userSelect = this.userSelectCache || ''; } } }, { diff --git a/dist/interactable.native.js.map b/dist/interactable.native.js.map index 3417438..e0a88c1 100644 --- a/dist/interactable.native.js.map +++ b/dist/interactable.native.js.map @@ -1 +1 @@ -{"version":3,"file":"interactable.native.js","sources":["../playground/src/react-interactable/Utils.js","../playground/src/react-interactable/Behaviors.js","../playground/src/react-interactable/Animator.js","../playground/src/react-interactable/InteractableView.js","../playground/src/react-interactable/native.js"],"sourcesContent":["export default {\r\n\tcreateArea: function( boundaries ){\r\n\t\treturn {\r\n\t\t\tminPoint: {\r\n\t\t\t\tx: boundaries.left === undefined ? -Infinity : boundaries.left,\r\n\t\t\t\ty: boundaries.top === undefined ? -Infinity : boundaries.top\r\n\t\t\t},\r\n\t\t\tmaxPoint: {\r\n\t\t\t\tx: boundaries.right === undefined ? Infinity : boundaries.right,\r\n\t\t\t\ty: boundaries.bottom === undefined ? Infinity : boundaries.bottom\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\tcreateAreaFromRadius: function( radius, anchor ){\r\n\t\treturn {\r\n\t\t\tminPoint: {x: anchor.x - radius, y: anchor.y - radius},\r\n\t\t\tmaxPoint: {x: anchor.x + radius, y: anchor.y + radius}\r\n\t\t}\r\n\t},\r\n\tisPointInArea: function( {x, y}, area ){\r\n\t\tif( !area ) return true\r\n\r\n\t\tlet { minPoint, maxPoint } = area\r\n\r\n\t\treturn x>=minPoint.x && x <= maxPoint.x && y >= minPoint.y && y <= maxPoint.y\r\n\t},\r\n\tfindClosest: function( origin, points ){\r\n\t\tlet minDistance = Infinity;\r\n\t\tlet closestPoint = null;\r\n\t\tlet distances = []\r\n\t\tpoints.forEach( point => {\r\n\t\t\tlet distance = this.getDistance( point, origin );\r\n\t\t\tdistances.push( distance )\r\n\t\t\tif (distance < minDistance) {\r\n\t\t\t\tminDistance = distance;\r\n\t\t\t\tclosestPoint = point;\r\n\t\t\t}\r\n\t\t})\r\n\t\t// console.log( distances )\r\n\t\treturn closestPoint\r\n\t},\r\n\tgetDistance( point, relative ){\r\n\t\tlet p = {x: point.x === undefined ? Infinity : point.x, y: point.y === undefined ? Infinity : point.y }\r\n\t\tlet r = {x: relative.x === undefined ? Infinity : relative.x, y: relative.y === undefined ? Infinity : relative.y }\r\n\t\tif( p.x === Infinity && p.y === Infinity ) return Infinity\r\n\t\tlet dx = p.x === Infinity ? 0 : Math.abs(r.x - p.x)\r\n\t\tlet dy = p.y === Infinity ? 0 : Math.abs(r.y - p.y)\r\n\t\t\r\n\t\treturn Math.sqrt( dx*dx + dy*dy )\r\n\t},\r\n\tgetDelta( point, origin ){\r\n\t\treturn {\r\n\t\t\tx: point.x - origin.x,\r\n\t\t\ty: point.y - origin.y\r\n\t\t}\r\n\t}\r\n}","import Utils from './Utils'\r\n\r\nfunction def( value, defaultValue ){\r\n\treturn value === undefined ? defaultValue : value\r\n}\r\n\r\nexport default {\r\n\tanchor: {\r\n\t\tcreate: (options, isTemp = false) => (\r\n\t\t\t{ x0: options.x, y0: options.y, priority: 1, isTemp, type: 'anchor' }\r\n\t\t),\r\n\t\tdoFrame: (options, deltaTime, state, coords ) => {\r\n\t\t\t// Velocity = dx / deltaTime\r\n\t\t\tstate.vx = (options.x0 - coords.x) / deltaTime\r\n\t\t\tstate.vy = (options.y0 - coords.y) / deltaTime\r\n\t\t}\r\n\t},\r\n\r\n\tbounce: {\r\n\t\tcreate: (options, isTemp = false) => ({\r\n\t\t\ttype: 'bounce',\r\n\t\t\tbounce: def(options.bounce, .5),\r\n\t\t\tminPoint: options.influence.minPoint,\r\n\t\t\tmaxPoint: options.influence.maxPoint,\r\n\t\t\tpriority: 3,\r\n\t\t\tisTemp\r\n\t\t}),\r\n\t\tdoFrame: ({minPoint, maxPoint, bounce}, deltaTime, state, {x,y}, target ) => {\r\n\t\t\t// Apply limits\r\n\r\n\t\t\tif (minPoint.x > x) target.setTranslationX(minPoint.x);\r\n\t\t\tif (minPoint.y > y) target.setTranslationY(minPoint.y);\r\n\t\t\tif (maxPoint.x < x) target.setTranslationX(maxPoint.x);\r\n\t\t\tif (maxPoint.y < y) target.setTranslationY(maxPoint.y);\r\n\r\n\t\t\tlet { vx, vy } = state\r\n\r\n\t\t\tif (minPoint.x > x && vx < 0) {\r\n\t\t\t\tstate.vx = -vx * bounce\r\n\t\t\t}\r\n\t\t\tif (minPoint.y > y && vy < 0) {\r\n\t\t\t\tstate.vy= -vy * bounce\r\n\t\t\t}\r\n\t\t\tif (maxPoint.x < x && vx > 0) {\r\n\t\t\t\tstate.vx = -vx * bounce\r\n\t\t\t}\r\n\t\t\tif (maxPoint.y < y && vy > 0) {\r\n\t\t\t\tstate.vy = -vy * bounce\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\tfriction: {\r\n\t\tcreate: ( options, isTemp = false ) => ({\r\n\t\t\ttype: 'friction',\r\n\t\t\tdamping: def(options.damping, .7),\r\n\t\t\tinfluence: Utils.createArea( options.influenceArea || {} ),\r\n\t\t\tpriority: 2,\r\n\t\t\tisTemp\r\n\t\t}),\r\n\t\tdoFrame: (options, deltaTime, state, coords) => {\r\n\t\t\tif( !Utils.isPointInArea( coords, options.influence) ) return;\r\n\t\t\t\r\n\t\t\tlet pow = Math.pow(options.damping, 60.0 * deltaTime)\r\n\t\t\tstate.vx = pow * state.vx\r\n\t\t\tstate.vy = pow * state.vy\r\n\t\t}\r\n\t},\r\n\r\n\tgravity: {\r\n\t\tcreate: ( options, isTemp = false ) => ({\r\n\t\t\ttype: 'gravity',\r\n\t\t\tx0: def(options.x, Infinity),\r\n\t\t\ty0: def(options.y, Infinity),\r\n\t\t\tstrength: def(options.strength, 400),\r\n\t\t\tfalloff: def(options.falloff, 40),\r\n\t\t\tdamping: def(options.damping, 0),\r\n\t\t\tinfluence: Utils.createArea(options.influenceArea || {}),\r\n\t\t\tisTemp,\r\n\t\t\tpriority: 1\r\n\t\t}),\r\n\t\tdoFrame: (options, deltaTime, state, coords) => {\r\n\t\t\tif( !Utils.isPointInArea( coords, options.influence) ) return;\r\n\r\n\t\t\tlet dx = options.x0 !== Infinity ? coords.x - options.x0 : 0;\r\n\t\t\tlet dy = options.y0 !== Infinity ? coords.y - options.y0 : 0;\r\n\t\t\tlet dr = Math.sqrt(dx * dx + dy * dy);\r\n\r\n\t\t\tif (!dr) return;\r\n\r\n\t\t\tlet { falloff, strength } = options\r\n\t\t\tlet a = (-strength * dr * Math.exp(-0.5 * (dr * dr) / (falloff * falloff))) / state.mass;\r\n\r\n\t\t\tlet ax = dx / dr * a;\r\n\t\t\tlet ay = dy / dr * a;\r\n\r\n\t\t\tstate.vx += deltaTime * ax\r\n\t\t\tstate.vy += deltaTime * ay\r\n\t\t}\r\n\t},\r\n\r\n\tspring: {\r\n\t\tcreate: ( options, isTemp = false ) => ({\r\n\t\t\ttype: 'spring',\r\n\t\t\tx0: def(options.x, 0),\r\n\t\t\ty0: def(options.y, 0),\r\n\t\t\ttension: def(options.tension, 300),\r\n\t\t\tinfluence: Utils.createArea( options.influenceArea || {} ),\r\n\t\t\tisTemp,\r\n\t\t\tpriority: 1\r\n\t\t}),\r\n\t\tdoFrame: ( options, deltaTime, state, coords) => {\r\n\t\t\tif( !Utils.isPointInArea( coords, options.influence) ) return;\r\n\t\r\n\t\t\tlet dx = coords.x - options.x0;\r\n\t\t\tif( dx ){\r\n\t\t\t\t// time * acceleration\r\n\t\t\t\tstate.vx += deltaTime * ((-1 * options.tension * dx) / state.mass)\r\n\t\t\t}\r\n\t\r\n\t\t\tlet dy = coords.y - options.y0;\r\n\t\t\tif( dy ){\r\n\t\t\t\t// time * acceleration\r\n\t\t\t\tstate.vy += deltaTime * ((-1 * options.tension * dy) / state.mass)\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}","import Behaviors from './Behaviors'\r\n\r\nconst ANIMATOR_PAUSE_CONSECUTIVE_FRAMES = 10;\r\nconst ANIMATOR_PAUSE_ZERO_VELOCITY = 1.0;\r\n\r\nif( typeof requestAnimationFrame === 'undefined' ){\r\n\t// We just don't work without raf (maybe we are in the server)\r\n\t// eslint-disable-next-line no-native-reassign\r\n\trequestAnimationFrame = function(){}\r\n}\r\n\r\nclass PhysicsAnimator {\r\n\tbehaviors = []\r\n\tphysicsObject = {vx: 0, vy: 0, mass: 1}\r\n\tconsecutiveFramesWithNoMovement = 0\r\n\tscreenScale = 1\r\n\tlastFrameTS = 0\r\n\tisRunning = false\r\n\tticking = false\r\n\tisDragging = false\r\n\r\n\tconstructor( View, listener, debug ){\r\n\t\tthis.View = View\r\n\t\tthis.animatorListener = listener\r\n\t\tif( !debug ){\r\n\t\t\tlet nofn = function(){}\r\n\t\t\tthis.debugStart = nofn;\r\n\t\t\tthis.debugEnd = nofn;\r\n\t\t}\r\n\t}\r\n\r\n\tdoFrame( frameTimeMillis ) {\r\n\t\tif( !this.isRunning ) return;\r\n\r\n\t\tif ( this.lastFrameTS ) {\r\n\t\t\tthis.animateFrameWithDeltaTime(\r\n\t\t\t\t(frameTimeMillis - this.lastFrameTS) * 1e-3\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\tthis.lastFrameTS = frameTimeMillis;\r\n\t\tthis.animatorListener.onAnimationFrame();\r\n\t\trequestAnimationFrame( () => this.doFrame( Date.now() ) )\r\n\t}\r\n\r\n\tdebugStart( behavior ){\r\n\t\tif( this.debug !== true && this.debug !== behavior.type ) return;\r\n\t\tthis.debugB = behavior\r\n\t\tthis.debugInitialV = {...this.physicsObject}\r\n\t}\r\n\r\n\tdebugEnd() {\r\n\t\tif (!this.debugB || (this.debug !== true && this.debug !== this.debugB.type)) return;\r\n\t\tconsole.log( `Debug ${this.debugB.type}`, {\r\n\t\t\tdvx: this.physicsObject.vx - this.debugInitialV.vx,\r\n\t\t\tdvy: this.physicsObject.vy - this.debugInitialV.vy,\r\n\t\t})\r\n\t}\r\n\t\r\n\tanimateFrameWithDeltaTime( deltaTime ) {\r\n\t\tif( !deltaTime ) return;\r\n\r\n\t\tlet { physicsObject, behaviors, View } = this\r\n\t\tlet hadMovement = false\r\n\t\tlet coords = View.getTranslation()\r\n\r\n\t\tbehaviors.forEach( behavior => {\r\n\t\t\tthis.debugStart( behavior )\r\n\t\t\tBehaviors[ behavior.type ].doFrame( behavior, deltaTime, physicsObject, coords, View )\r\n\t\t\tthis.debugEnd()\r\n\t\t})\r\n\r\n\t\tlet dx = 0;\r\n\t\tlet {vx,vy} = physicsObject\r\n\t\t\r\n\t\tif ( Math.abs(vx) > ANIMATOR_PAUSE_ZERO_VELOCITY ) {\r\n\t\t\tdx = deltaTime * vx;\r\n\t\t\thadMovement = true;\r\n\t\t}\r\n\r\n\t\tlet dy = 0;\r\n\t\tif ( Math.abs(vy) > ANIMATOR_PAUSE_ZERO_VELOCITY ) {\r\n\t\t\tdy = deltaTime * vy;\r\n\t\t\thadMovement = true;\r\n\t\t}\r\n\t\t\r\n\t\tView.animate( dx, dy )\r\n\r\n\t\tlet cfwnm = hadMovement ? 0 : this.consecutiveFramesWithNoMovement + 1\r\n\t\tthis.consecutiveFramesWithNoMovement = cfwnm\r\n\r\n\t\tif (cfwnm >= ANIMATOR_PAUSE_CONSECUTIVE_FRAMES && !this.isDragging ) {\r\n\t\t\tthis.stopRunning();\r\n\t\t\tthis.animatorListener.onAnimatorPause();\r\n\t\t}\r\n\t}\r\n\r\n\taddBehavior( type, options, isTemp ){\r\n\t\tlet b = Behaviors[ type ]\r\n\t\tif( !b ) return;\r\n\r\n\t\tlet behavior = b.create( options, isTemp )\r\n\t\tlet behaviors = this.behaviors\r\n\t\tlet idx = 0\r\n\r\n\t\twhile (behaviors.length > idx && behaviors[idx].priority <= behavior.priority) {\r\n\t\t\t++idx;\r\n\t\t}\r\n\t\tbehaviors.splice( idx, 0, behavior )\r\n\r\n\t\tthis.ensureRunning()\r\n\t\treturn behavior\r\n\t}\r\n\r\n\tremove( condition ){\r\n\t\tlet behaviors = this.behaviors\r\n\t\tlet i = behaviors.length\r\n\t\twhile( i-- > 0 ){\r\n\t\t\tif( condition(behaviors[i]) ){\r\n\t\t\t\tbehaviors.splice( i, 1 )\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tremoveBehavior( behavior ) {\r\n\t\tthis.remove( target => target === behavior )\r\n\t}\r\n\r\n\tremoveTypeBehaviors( type ){\r\n\t\tthis.remove( target => target.type === type )\r\n\t}\r\n\t\r\n\tremoveTempBehaviors(){\r\n\t\tthis.remove( target => target.isTemp )\r\n\t}\r\n\t\r\n\tgetVelocity(){ \r\n\t\treturn { x: this.physicsObject.vx, y: this.physicsObject.vy }\r\n\t}\r\n\r\n\tensureRunning() {\r\n\t\tthis.isRunning || this.startRunning()\r\n\t}\r\n\r\n\tstartRunning() {\r\n\t\tthis.isRunning = true;\r\n\t\tthis.lastFrameTS = 0;\r\n\t\tthis.consecutiveFramesWithNoMovement = 0;\r\n\t\trequestAnimationFrame( () => this.doFrame( Date.now() ) )\r\n\t}\r\n\r\n\tstopRunning() {\r\n\t\tthis.removeTempBehaviors();\r\n\t\tthis.physicsObject = {vx: 0, vy: 0, mass: this.physicsObject.mass}\r\n\t\tthis.isRunning = false;\r\n\t}\r\n}\r\n\r\nexport default PhysicsAnimator","import React, { Component } from 'react'\nimport PropTypes from 'prop-types'\nimport Animator from './Animator'\nimport Utils from './Utils';\n\nconst propBehaviors = {\n\tfrictionAreas: 'friction',\n\tgravityPoints: 'gravity',\n\tspringPoints: 'spring',\n}\n\nconst isWeb = typeof document !== 'undefined'\n\nexport default function injectDependencies( Animated, PanResponder ){\n\n\treturn class InteractableView extends Component {\n\t\tstatic propTypes = {\n\t\t\tsnapPoints: PropTypes.array,\n\t\t\tfrictionAreas: PropTypes.array,\n\t\t\talertAreas: PropTypes.array,\n\t\t\tgravityPoints: PropTypes.array,\n\t\t\thorizontalOnly: PropTypes.bool,\n\t\t\tverticalOnly: PropTypes.bool,\n\t\t\tdragWithSpring: PropTypes.object,\n\t\t\tdragEnabled: PropTypes.bool,\n\t\t\tanimatedValueX: PropTypes.instanceOf(Animated.Value),\n\t\t\tanimatedValueY: PropTypes.instanceOf(Animated.Value),\n\t\t\tonSnap: PropTypes.func,\n\t\t\tonSnapStart: PropTypes.func,\n\t\t\tonEnd: PropTypes.func,\n\t\t\tonDrag: PropTypes.func,\n\t\t\tboundaries: PropTypes.object,\n\t\t\tinitialPosition: PropTypes.object,\n\t\t\tdragToss: PropTypes.number\n\t\t}\n\n\t\tstatic defaultProps = {\n\t\t\tsnapPoints: [],\n\t\t\tfrictionAreas: [],\n\t\t\talertAreas: [],\n\t\t\tgravityPoints: [],\n\t\t\tboundaries: {},\n\t\t\tinitialPosition: {x: 0, y: 0},\n\t\t\tdragToss: .1,\n\t\t\tdragEnabled: true,\n\t\t\tonSnap: function () { },\n\t\t\tonSnapStart: function () { },\n\t\t\tonStop: function () { },\n\t\t\tonDrag: function () { },\n\t\t\tonAlert: function () { },\n\t\t\tstyle: {}\n\t\t}\n\n\t\tinitialPositionSet = false\n\t\tisDragging = false\n\n\t\tconstructor(props) {\n\t\t\tsuper(props)\n\n\t\t\tlet { x=0, y=0 } = props.initialPosition\n\n\t\t\t// In case animatedValueXY is not given\n\t\t\tthis.animated = new Animated.ValueXY({x, y})\n\n\t\t\t// This guy will apply all the physics\n\t\t\tthis.animator = this.createAnimator( props )\n\n\t\t\t// Cache when the view is inside of an alert area\n\t\t\tthis.insideAlertAreas = {}\n\n\t\t\t// cache calculated areas\n\t\t\tthis.propAreas = {\n\t\t\t\talert: [],\n\t\t\t\tboundaries: false\n\t\t\t}\n\n\t\t\tthis._pr = this.createPanResponder(props)\n\t\t\t\n\t\t\t// Set behaviors and prop defaults\n\t\t\tthis.setPropBehaviours( {}, props )\n\n\t\t\t// Set initial position\n\t\t\tlet animated = this.getAnimated( props )\n\t\t\tanimated.x.setValue( x )\n\t\t\tanimated.y.setValue(y)\n\t\t\tanimated.x._startingValue = x\n\t\t\tanimated.y._startingValue = y\n\t\t\t\n\t\t\t// Save the last animation end position to report good coordinates in the events\n\t\t\tthis.lastEnd = {...this.initialPosition}\n\t\t}\n\n\t\trender() {\n\t\t\tlet { x, y } = this.getAnimated()\n\t\t\tlet style = this.props.style\n\t\t\tlet withPosition = {\n\t\t\t\ttransform: [{ translateX: x }, { translateY: y }].concat( style.transform || [] ),\n\t\t\t\t...style\n\t\t\t}\n\n\t\t\tlet panHandlers = this.props.dragEnabled ? this._pr.panHandlers : {}\n\n\t\t\treturn (\n\t\t\t\t\n\t\t\t\t\t{this.props.children}\n\t\t\t\t\n\t\t\t)\n\t\t}\n\n\t\tgetTranslation(){\n\t\t\tlet {x, y} = this.getAnimated()\n\t\t\treturn {\n\t\t\t\tx: x._value + x._offset,\n\t\t\t\ty: y._value + y._offset\n\t\t\t}\n\t\t}\n\n\t\tsetTranslationX( tx ){\n\t\t\tlet animated = this.props.animatedValueX || this.animated.x\n\t\t\tanimated.setValue( tx - animated._offset )\n\t\t}\n\n\t\tsetTranslationY(ty) {\n\t\t\tlet animated = this.props.animatedValueY || this.animated.y\n\t\t\tanimated.setValue( ty - animated._offset )\n\t\t}\n\n\t\tsetTranslation( tx, ty ){\n\t\t\tthis.setTranslationX( tx )\n\t\t\tthis.setTranslationY( ty )\n\t\t}\n\n\t\tcreateAnimator(){\n\t\t\treturn new Animator( this, {\n\t\t\t\tonAnimatorPause: () => {\n\t\t\t\t\tlet { x, y } = this.getTranslation()\n\t\t\t\t\tthis.lastEnd = {x: Math.round(x), y: Math.round(y)}\n\t\t\t\t\tthis.props.onStop( this.lastEnd )\n\t\t\t\t},\n\t\t\t\tonAnimationFrame: () => {\n\t\t\t\t\tthis.reportAlertEvent( this.getTranslation() )\n\t\t\t\t}\n\t\t\t},\n\t\t\tfalse // Set true or behavior type to output debug info in the console\n\t\t\t)\n\t\t}\n\n\t\tanimate( dx, dy ){\n\t\t\tif(!dx && !dy) return\n\t\t\t// let animated = this.getAnimated()\n\t\t\t// console.log( dx + animated.x._value + animated.x._offset )\n\n\t\t\tlet {x,y} = this.getTranslation()\n\t\t\tthis.setTranslation( x + dx, y + dy ) \n\t\t}\n\n\t\tgetAnimated( props ){\n\t\t\tlet { animatedValueX, animatedValueY } = (props || this.props)\n\n\t\t\treturn {\n\t\t\t\tx: animatedValueX || this.animated.x ,\n\t\t\t\ty: animatedValueY || this.animated.y\n\t\t\t}\n\t\t}\n\n\t\tcreatePanResponder() {\n\t\t\tlet capturer = this.checkResponderCapture.bind(this)\n\t\t\t\n\t\t\treturn PanResponder.create({\n\t\t\t\tonMoveShouldSetResponderCapture: capturer,\n\t\t\t\tonMoveShouldSetPanResponderCapture: capturer,\n\n\t\t\t\tonPanResponderGrant: (e, {x0, y0}) => {\t\n\t\t\t\t\tthis._captured = true;\n\t\t\t\t\tthis.startDrag( {x: x0, y: y0} )\n\t\t\t\t},\n\n\t\t\t\tonPanResponderMove: (e, gesture ) => {\n\t\t\t\t\tthis.onDragging( gesture )\n\t\t\t\t},\n\n\t\t\t\tonPanResponderRelease: () => {\n\t\t\t\t\tthis._captured = false;\n\t\t\t\t\tthis.endDrag()\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\n\t\tcheckResponderCapture( e, gesture ){\n\t\t\treturn this._captured || Math.abs( gesture.dx ) > 5 || Math.abs( gesture.dy ) > 5;\n\t\t}\n\n\t\treportAlertEvent( position ){\n\t\t\tlet inside = this.insideAlertAreas\n\t\t\tlet { onAlert } = this.props\n\n\t\t\tthis.propAreas.alert.forEach( ({ influence, id }) => {\n\t\t\t\tif ( !influence || !id ) return;\n\n\t\t\t\tif ( Utils.isPointInArea( position, influence ) ) {\n\t\t\t\t\tif ( !inside[id] ) {\n\t\t\t\t\t\tonAlert({id, value:\"enter\"});\n\t\t\t\t\t\tinside[id] = 1;\n\t\t\t\t\t}\n\t\t\t\t} else if (inside[id]) {\n\t\t\t\t\tonAlert({ id, value: \"leave\" });\n\t\t\t\t\tinside[id] = 0;\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\n\t\tstartDrag( ev ){\n\t\t\t// Prepare the animated\n\t\t\tlet {x,y} = this.getAnimated()\n\t\t\tlet offset = {x: x._value, y: y._value}\n\t\t\tx.setOffset( offset.x )\n\t\t\ty.setOffset( offset.y )\n\t\t\tx.setValue( 0 )\n\t\t\ty.setValue( 0 )\n\n\t\t\t// Save the offset for triggering events with the right coordinates\n\t\t\tthis.lastEnd = offset\n\t\t\t// console.log( offset )\n\n\t\t\t// Set boundaries to fast access\n\t\t\tthis.dragBoundaries = this.propAreas.boundaries ? this.propAreas.boundaries.influence : {}\n\n\t\t\t// Prepare the animation\n\t\t\tthis.props.onDrag({state: 'start', x: offset.x, y: offset.y})\n\t\t\tthis.dragStartLocation = { x: ev.x, y: ev.y }\n\t\t\tthis.animator.removeTempBehaviors();\n\t\t\tthis.animator.isDragging = true\n\t\t\tthis.animator.vx = 0\n\t\t\tthis.animator.vy = 0\n\t\t\tthis.addTempDragBehavior( this.props.dragWithSpring );\n\n\t\t\t// Stop text selection\n\t\t\tif ( isWeb ) {\n\t\t\t\tlet styles = document.body.style\n\t\t\t\tthis.userSelectCache = styles.userSelect\n\t\t\t\tstyles.userSelect = \"none\"\n\t\t\t}\n\t\t}\n\n\t\tonDragging({dx, dy}){\n\t\t\tif( !this.animator.isDragging ) return false\n\t\t\tif( !this.props.dragEnabled ) return this.endDrag()\n\n\t\t\tlet pos = this.lastEnd\n\t\t\tlet x = dx + pos.x\n\t\t\tlet y = dy + pos.y\n\t\t\t\n\t\t\t// console.log( this.dragBoundaries.minPoint )\n\n\t\t\tlet {minPoint, maxPoint} = this.dragBoundaries\n\t\t\tif( !this.props.verticalOnly ){\n\t\t\t\tif (minPoint) {\n\t\t\t\t\tif (minPoint.x > x) x = minPoint.x\n\t\t\t\t\tif (maxPoint.x < x) x = maxPoint.x\n\t\t\t\t}\n\t\t\t\tthis.dragBehavior.x0 = x\n\t\t\t}\n\n\t\t\tif (!this.props.horizontalOnly) {\n\t\t\t\tif (minPoint) {\n\t\t\t\t\tif (minPoint.y > y) y = minPoint.y\n\t\t\t\t\tif (maxPoint.y < y) y = maxPoint.y\n\t\t\t\t}\n\t\t\t\tthis.dragBehavior.y0 = y\n\t\t\t}\n\n\t\t\t// console.log( this.dragBehavior )\n\t\t}\n\n\t\tendDrag(){\n\t\t\tthis.animator.removeTempBehaviors();\n\t\t\tthis.dragBehavior = null;\n\t\t\tthis.animator.isDragging = false\n\n\t\t\tlet { animator, horizontalOnly, verticalOnly, dragWithSprings } = this\n\n\t\t\tlet velocity = animator.getVelocity();\n\t\t\tif (horizontalOnly) velocity.y = 0;\n\t\t\tif (verticalOnly) velocity.x = 0;\n\t\t\t\n\t\t\tlet toss = (dragWithSprings && dragWithSprings.toss) || this.props.dragToss;\n\t\t\tlet {x,y} = this.getTranslation()\n\t\t\tlet projectedCenter = {\n\t\t\t\tx: x + toss * velocity.x,\n\t\t\t\ty: y + toss * velocity.y\n\t\t\t};\n\n\t\t\t// console.log( 'pc', projectedCenter, velocity)\n\t\t\tlet snapPoint = Utils.findClosest(projectedCenter, this.props.snapPoints);\n\t\t\tlet targetSnapPointId = (snapPoint && snapPoint.id) || \"\";\n\n\t\t\tthis.props.onDrag({ state: 'end', x: x, y: y, targetSnapPointId })\n\n\t\t\tthis.addTempSnapToPointBehavior(snapPoint);\n\t\t\tthis.addTempBoundaries();\n\n\t\t\tlet animated = this.getAnimated()\n\t\t\tanimated.x.flattenOffset()\n\t\t\tanimated.y.flattenOffset()\n\n\t\t\t// Restore text selection\n\t\t\tif ( isWeb ) {\n\t\t\t\tdocument.body.userSelect = this.userSelectCache || ''\n\t\t\t}\n\t\t}\n\n\t\taddTempDragBehavior( drag ) {\n\t\t\tlet pos = this.getTranslation()\n\n\t\t\tif ( !drag || drag.tension === Infinity ) {\n\t\t\t\tthis.dragBehavior = this.animator.addBehavior( 'anchor', pos, true )\n\t\t\t}\n\t\t\telse {\n\t\t\t\tpos.tension = drag.tension || 300\n\t\t\t\tthis.dragBehavior = this.animator.addBehavior( 'spring', pos, true )\n\t\t\t\tif( drag.damping ){\n\t\t\t\t\tthis.animator.addBehavior('friction', drag, true)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\taddTempSnapToPointBehavior( snapPoint ) {\n\t\t\tif (!snapPoint) return;\n\t\t\tlet { snapPoints, onSnap, onSnapStart } = this.props\n\n\t\t\tlet index = snapPoints.indexOf(snapPoint)\n\n\t\t\tonSnap({index, id: snapPoint.id});\n\t\t\tonSnapStart({index, id: snapPoint.id});\n\n\t\t\tlet springOptions = {\n\t\t\t\tdamping: .7,\n\t\t\t\ttension: 300,\n\t\t\t\t...snapPoint\n\t\t\t}\n\n\t\t\tthis.addBehavior( 'spring', springOptions, true )\n\t\t}\n\n\t\tsetVelocity( velocity ) {\n\t\t\tif ( this.dragBehavior ) return;\n\t\t\tthis.animator.physicsObject.vx = velocity.x\n\t\t\tthis.animator.physicsObject.vy = velocity.y\n\t\t\tthis.endDrag();\n\t\t}\n\n\t\tsnapTo( {index} ) {\n\t\t\tlet {snapPoints} = this.props;\n\n\t\t\tif( !snapPoints || index === undefined || index >= snapPoints.length ) return;\n\t\t\t\n\t\t\tthis.animator.removeTempBehaviors();\n\t\t\tthis.dragBehavior = null;\n\t\t\tlet snapPoint = snapPoints[index]\n\n\t\t\tthis.addTempSnapToPointBehavior(snapPoint);\n\t\t\tthis.addTempBoundaries();\n\t\t}\n\n\t\taddTempBoundaries(){\n\t\t\tlet boundaries = this.propAreas.boundaries;\n\t\t\tif( !boundaries ) return;\n\t\t\tthis.animator.addBehavior( 'bounce', boundaries, true );\n\t\t}\n\n\t\tchangePosition( position ) {\n\t\t\tif ( this.dragBehavior ) return;\n\n\t\t\tthis.setTranslation( position.x, position.y )\n\t\t\tthis.endDrag();\n\t\t}\n\n\t\tcomponentDidUpdate( prevProps ){\n\t\t\tthis.setPropBehaviours( prevProps, this.props )\n\t\t}\n\n\t\tsetPropBehaviours( prevProps, props ){\n\t\t\t// spring, gravity, friction\n\t\t\tObject.keys( propBehaviors ).forEach( prop => {\n\t\t\t\tif( prevProps[ prop ] !== props[ prop ] ){\n\t\t\t\t\tthis.animator.removeTypeBehaviors(propBehaviors[prop])\n\t\t\t\t\tthis.addTypeBehaviors( propBehaviors[prop], props[ prop ] )\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tif( prevProps.alertAreas !== props.alertAreas ){\n\t\t\t\tlet alertAreas = []\n\t\t\t\tprops.alertAreas.forEach( area => {\n\t\t\t\t\talertAreas.push({\n\t\t\t\t\t\tid: area.id,\n\t\t\t\t\t\tinfluence: Utils.createArea( area.influenceArea )\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t\tthis.propAreas.alert = alertAreas\n\t\t\t}\n\n\t\t\tif( prevProps.boundaries !== props.boundaries ){\n\t\t\t\tthis.animator.removeBehavior( this.oldBoundariesBehavior )\n\t\t\t\tif( props.boundaries ){\n\t\t\t\t\tlet bounce = {\n\t\t\t\t\t\tbounce: props.boundaries.bounce || 0,\n\t\t\t\t\t\tinfluence: Utils.createArea( props.boundaries )\n\t\t\t\t\t}\n\t\t\t\t\tthis.propAreas.boundaries = bounce\n\t\t\t\t\tthis.oldBoundariesBehavior = this.animator.addBehavior( 'bounce', bounce )\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthis.propAreas.boundaries = false\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (!this.props.dragEnabled && prevProps.dragEnabled && this.dragBehavior ){\n\t\t\t\tthis.endDrag()\n\t\t\t}\n\t\t}\n\n\t\taddTypeBehaviors( type, behaviors, isTemp ){\n\t\t\tbehaviors.forEach( b => this.addBehavior( type, b, isTemp )\t)\n\t\t}\n\n\t\taddBehavior( type, behavior, isTemp ){\n\t\t\tthis.animator.addBehavior( type, behavior, isTemp )\n\t\t\tif( behavior.damping && type !== 'friction' ){\n\t\t\t\tlet b = this.animator.addBehavior('friction', behavior, isTemp )\n\t\t\t\tif( type === 'gravity' && !behavior.influenceArea ){\n\t\t\t\t\tb.influence = Utils.createAreaFromRadius(1.4 * (behavior.falloff || 40), behavior)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import { Animated, PanResponder } from 'react-native'\r\nimport injectDependencies from './InteractableView'\r\n\r\nlet Interactable = injectDependencies(Animated, PanResponder)\r\nexport default { View: Interactable }"],"names":["createArea","boundaries","minPoint","x","left","undefined","Infinity","y","top","maxPoint","right","bottom","createAreaFromRadius","radius","anchor","isPointInArea","area","findClosest","origin","points","minDistance","closestPoint","forEach","point","distance","getDistance","relative","p","r","dx","Math","abs","dy","sqrt","getDelta","def","value","defaultValue","create","options","isTemp","x0","y0","priority","type","doFrame","deltaTime","state","coords","vx","vy","bounce","influence","target","setTranslationX","setTranslationY","friction","damping","Utils","influenceArea","pow","gravity","strength","falloff","dr","a","exp","mass","ax","ay","spring","tension","ANIMATOR_PAUSE_CONSECUTIVE_FRAMES","ANIMATOR_PAUSE_ZERO_VELOCITY","requestAnimationFrame","PhysicsAnimator","View","listener","debug","animatorListener","nofn","debugStart","debugEnd","frameTimeMillis","isRunning","lastFrameTS","animateFrameWithDeltaTime","onAnimationFrame","Date","now","behavior","debugB","debugInitialV","physicsObject","console","log","dvx","dvy","behaviors","hadMovement","getTranslation","Behaviors","animate","cfwnm","consecutiveFramesWithNoMovement","isDragging","stopRunning","onAnimatorPause","b","idx","length","splice","ensureRunning","condition","i","remove","startRunning","removeTempBehaviors","propBehaviors","frictionAreas","gravityPoints","springPoints","isWeb","document","injectDependencies","Animated","PanResponder","props","initialPosition","animated","ValueXY","animator","createAnimator","insideAlertAreas","propAreas","alert","_pr","createPanResponder","setPropBehaviours","getAnimated","setValue","_startingValue","lastEnd","style","withPosition","transform","translateX","translateY","concat","panHandlers","dragEnabled","React","children","_value","_offset","tx","animatedValueX","ty","animatedValueY","Animator","round","onStop","reportAlertEvent","setTranslation","capturer","checkResponderCapture","bind","onMoveShouldSetResponderCapture","onMoveShouldSetPanResponderCapture","onPanResponderGrant","e","_captured","startDrag","onPanResponderMove","gesture","onDragging","onPanResponderRelease","endDrag","position","inside","onAlert","id","ev","offset","setOffset","dragBoundaries","onDrag","dragStartLocation","addTempDragBehavior","dragWithSpring","styles","body","userSelectCache","userSelect","pos","verticalOnly","dragBehavior","horizontalOnly","dragWithSprings","velocity","getVelocity","toss","dragToss","projectedCenter","snapPoint","snapPoints","targetSnapPointId","addTempSnapToPointBehavior","addTempBoundaries","flattenOffset","drag","addBehavior","onSnap","onSnapStart","index","indexOf","springOptions","prevProps","Object","keys","prop","removeTypeBehaviors","addTypeBehaviors","alertAreas","push","removeBehavior","oldBoundariesBehavior","Component","PropTypes","array","bool","object","instanceOf","Value","func","onEnd","number","Interactable"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,cAAe;EACdA,EAAAA,UAAU,EAAE,oBAAUC,UAAV,EAAsB;EACjC,WAAO;EACNC,MAAAA,QAAQ,EAAE;EACTC,QAAAA,CAAC,EAAEF,UAAU,CAACG,IAAX,KAAoBC,SAApB,GAAgC,CAACC,QAAjC,GAA4CL,UAAU,CAACG,IADjD;EAETG,QAAAA,CAAC,EAAEN,UAAU,CAACO,GAAX,KAAmBH,SAAnB,GAA+B,CAACC,QAAhC,GAA2CL,U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O,SAAS,CAACG,MAfJ;EAgBlBvG,IAAAA,eAAe,EAAEoG,SAAS,CAACG,MAhBT;EAiBlB7B,IAAAA,QAAQ,EAAE0B,SAAS,CAACQ;EAjBF,GADpB,2CAqBuB;EACrB/B,IAAAA,UAAU,EAAE,EADS;EAErBtF,IAAAA,aAAa,EAAE,EAFM;EAGrBwG,IAAAA,UAAU,EAAE,EAHS;EAIrBvG,IAAAA,aAAa,EAAE,EAJM;EAKrBvH,IAAAA,UAAU,EAAE,EALS;EAMrB+H,IAAAA,eAAe,EAAE;EAAC7H,MAAAA,CAAC,EAAE,CAAJ;EAAOI,MAAAA,CAAC,EAAE;EAAV,KANI;EAOrBmM,IAAAA,QAAQ,EAAE,EAPW;EAQrBpD,IAAAA,WAAW,EAAE,IARQ;EASrB8D,IAAAA,MAAM,EAAE,kBAAY,EATC;EAUrBC,IAAAA,WAAW,EAAE,uBAAY,EAVJ;EAWrBpD,IAAAA,MAAM,EAAE,kBAAY,EAXC;EAYrByB,IAAAA,MAAM,EAAE,kBAAY,EAZC;EAarBN,IAAAA,OAAO,EAAE,mBAAY,EAbA;EAcrBrC,IAAAA,KAAK,EAAE;EAdc,GArBvB;EAoaA;;EChbD,IAAI8F,YAAY,GAAGjH,kBAAkB,CAACC,oBAAD,EAAWC,wBAAX,CAArC;AACA,eAAe;EAAElD,EAAAA,IAAI,EAAEiK;EAAR,CAAf;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"interactable.native.js","sources":["../playground/src/react-interactable/Utils.js","../playground/src/react-interactable/Behaviors.js","../playground/src/react-interactable/Animator.js","../playground/src/react-interactable/InteractableView.js","../playground/src/react-interactable/native.js"],"sourcesContent":["export default {\r\n\tcreateArea: function( boundaries ){\r\n\t\treturn {\r\n\t\t\tminPoint: {\r\n\t\t\t\tx: boundaries.left === undefined ? -Infinity : boundaries.left,\r\n\t\t\t\ty: boundaries.top === undefined ? -Infinity : boundaries.top\r\n\t\t\t},\r\n\t\t\tmaxPoint: {\r\n\t\t\t\tx: boundaries.right === undefined ? Infinity : boundaries.right,\r\n\t\t\t\ty: boundaries.bottom === undefined ? Infinity : boundaries.bottom\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\tcreateAreaFromRadius: function( radius, anchor ){\r\n\t\treturn {\r\n\t\t\tminPoint: {x: anchor.x - radius, y: anchor.y - radius},\r\n\t\t\tmaxPoint: {x: anchor.x + radius, y: anchor.y + radius}\r\n\t\t}\r\n\t},\r\n\tisPointInArea: function( {x, y}, area ){\r\n\t\tif( !area ) return true\r\n\r\n\t\tlet { minPoint, maxPoint } = area\r\n\r\n\t\treturn x>=minPoint.x && x <= maxPoint.x && y >= minPoint.y && y <= maxPoint.y\r\n\t},\r\n\tfindClosest: function( origin, points ){\r\n\t\tlet minDistance = Infinity;\r\n\t\tlet closestPoint = null;\r\n\t\tlet distances = []\r\n\t\tpoints.forEach( point => {\r\n\t\t\tlet distance = this.getDistance( point, origin );\r\n\t\t\tdistances.push( distance )\r\n\t\t\tif (distance < minDistance) {\r\n\t\t\t\tminDistance = distance;\r\n\t\t\t\tclosestPoint = point;\r\n\t\t\t}\r\n\t\t})\r\n\t\t// console.log( distances )\r\n\t\treturn closestPoint\r\n\t},\r\n\tgetDistance( point, relative ){\r\n\t\tlet p = {x: point.x === undefined ? Infinity : point.x, y: point.y === undefined ? Infinity : point.y }\r\n\t\tlet r = {x: relative.x === undefined ? Infinity : relative.x, y: relative.y === undefined ? Infinity : relative.y }\r\n\t\tif( p.x === Infinity && p.y === Infinity ) return Infinity\r\n\t\tlet dx = p.x === Infinity ? 0 : Math.abs(r.x - p.x)\r\n\t\tlet dy = p.y === Infinity ? 0 : Math.abs(r.y - p.y)\r\n\t\t\r\n\t\treturn Math.sqrt( dx*dx + dy*dy )\r\n\t},\r\n\tgetDelta( point, origin ){\r\n\t\treturn {\r\n\t\t\tx: point.x - origin.x,\r\n\t\t\ty: point.y - origin.y\r\n\t\t}\r\n\t}\r\n}","import Utils from './Utils'\r\n\r\nfunction def( value, defaultValue ){\r\n\treturn value === undefined ? defaultValue : value\r\n}\r\n\r\nexport default {\r\n\tanchor: {\r\n\t\tcreate: (options, isTemp = false) => (\r\n\t\t\t{ x0: options.x, y0: options.y, priority: 1, isTemp, type: 'anchor' }\r\n\t\t),\r\n\t\tdoFrame: (options, deltaTime, state, coords ) => {\r\n\t\t\t// Velocity = dx / deltaTime\r\n\t\t\tstate.vx = (options.x0 - coords.x) / deltaTime\r\n\t\t\tstate.vy = (options.y0 - coords.y) / deltaTime\r\n\t\t}\r\n\t},\r\n\r\n\tbounce: {\r\n\t\tcreate: (options, isTemp = false) => ({\r\n\t\t\ttype: 'bounce',\r\n\t\t\tbounce: def(options.bounce, .5),\r\n\t\t\tminPoint: options.influence.minPoint,\r\n\t\t\tmaxPoint: options.influence.maxPoint,\r\n\t\t\tpriority: 3,\r\n\t\t\tisTemp\r\n\t\t}),\r\n\t\tdoFrame: ({minPoint, maxPoint, bounce}, deltaTime, state, {x,y}, target ) => {\r\n\t\t\t// Apply limits\r\n\r\n\t\t\tif (minPoint.x > x) target.setTranslationX(minPoint.x);\r\n\t\t\tif (minPoint.y > y) target.setTranslationY(minPoint.y);\r\n\t\t\tif (maxPoint.x < x) target.setTranslationX(maxPoint.x);\r\n\t\t\tif (maxPoint.y < y) target.setTranslationY(maxPoint.y);\r\n\r\n\t\t\tlet { vx, vy } = state\r\n\r\n\t\t\tif (minPoint.x > x && vx < 0) {\r\n\t\t\t\tstate.vx = -vx * bounce\r\n\t\t\t}\r\n\t\t\tif (minPoint.y > y && vy < 0) {\r\n\t\t\t\tstate.vy= -vy * bounce\r\n\t\t\t}\r\n\t\t\tif (maxPoint.x < x && vx > 0) {\r\n\t\t\t\tstate.vx = -vx * bounce\r\n\t\t\t}\r\n\t\t\tif (maxPoint.y < y && vy > 0) {\r\n\t\t\t\tstate.vy = -vy * bounce\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\tfriction: {\r\n\t\tcreate: ( options, isTemp = false ) => ({\r\n\t\t\ttype: 'friction',\r\n\t\t\tdamping: def(options.damping, .7),\r\n\t\t\tinfluence: Utils.createArea( options.influenceArea || {} ),\r\n\t\t\tpriority: 2,\r\n\t\t\tisTemp\r\n\t\t}),\r\n\t\tdoFrame: (options, deltaTime, state, coords) => {\r\n\t\t\tif( !Utils.isPointInArea( coords, options.influence) ) return;\r\n\t\t\t\r\n\t\t\tlet pow = Math.pow(options.damping, 60.0 * deltaTime)\r\n\t\t\tstate.vx = pow * state.vx\r\n\t\t\tstate.vy = pow * state.vy\r\n\t\t}\r\n\t},\r\n\r\n\tgravity: {\r\n\t\tcreate: ( options, isTemp = false ) => ({\r\n\t\t\ttype: 'gravity',\r\n\t\t\tx0: def(options.x, Infinity),\r\n\t\t\ty0: def(options.y, Infinity),\r\n\t\t\tstrength: def(options.strength, 400),\r\n\t\t\tfalloff: def(options.falloff, 40),\r\n\t\t\tdamping: def(options.damping, 0),\r\n\t\t\tinfluence: Utils.createArea(options.influenceArea || {}),\r\n\t\t\tisTemp,\r\n\t\t\tpriority: 1\r\n\t\t}),\r\n\t\tdoFrame: (options, deltaTime, state, coords) => {\r\n\t\t\tif( !Utils.isPointInArea( coords, options.influence) ) return;\r\n\r\n\t\t\tlet dx = options.x0 !== Infinity ? coords.x - options.x0 : 0;\r\n\t\t\tlet dy = options.y0 !== Infinity ? coords.y - options.y0 : 0;\r\n\t\t\tlet dr = Math.sqrt(dx * dx + dy * dy);\r\n\r\n\t\t\tif (!dr) return;\r\n\r\n\t\t\tlet { falloff, strength } = options\r\n\t\t\tlet a = (-strength * dr * Math.exp(-0.5 * (dr * dr) / (falloff * falloff))) / state.mass;\r\n\r\n\t\t\tlet ax = dx / dr * a;\r\n\t\t\tlet ay = dy / dr * a;\r\n\r\n\t\t\tstate.vx += deltaTime * ax\r\n\t\t\tstate.vy += deltaTime * ay\r\n\t\t}\r\n\t},\r\n\r\n\tspring: {\r\n\t\tcreate: ( options, isTemp = false ) => ({\r\n\t\t\ttype: 'spring',\r\n\t\t\tx0: def(options.x, 0),\r\n\t\t\ty0: def(options.y, 0),\r\n\t\t\ttension: def(options.tension, 300),\r\n\t\t\tinfluence: Utils.createArea( options.influenceArea || {} ),\r\n\t\t\tisTemp,\r\n\t\t\tpriority: 1\r\n\t\t}),\r\n\t\tdoFrame: ( options, deltaTime, state, coords) => {\r\n\t\t\tif( !Utils.isPointInArea( coords, options.influence) ) return;\r\n\t\r\n\t\t\tlet dx = coords.x - options.x0;\r\n\t\t\tif( dx ){\r\n\t\t\t\t// time * acceleration\r\n\t\t\t\tstate.vx += deltaTime * ((-1 * options.tension * dx) / state.mass)\r\n\t\t\t}\r\n\t\r\n\t\t\tlet dy = coords.y - options.y0;\r\n\t\t\tif( dy ){\r\n\t\t\t\t// time * acceleration\r\n\t\t\t\tstate.vy += deltaTime * ((-1 * options.tension * dy) / state.mass)\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}","import Behaviors from './Behaviors'\r\n\r\nconst ANIMATOR_PAUSE_CONSECUTIVE_FRAMES = 10;\r\nconst ANIMATOR_PAUSE_ZERO_VELOCITY = 1.0;\r\n\r\nif( typeof requestAnimationFrame === 'undefined' ){\r\n\t// We just don't work without raf (maybe we are in the server)\r\n\t// eslint-disable-next-line no-native-reassign\r\n\trequestAnimationFrame = function(){}\r\n}\r\n\r\nclass PhysicsAnimator {\r\n\tbehaviors = []\r\n\tphysicsObject = {vx: 0, vy: 0, mass: 1}\r\n\tconsecutiveFramesWithNoMovement = 0\r\n\tscreenScale = 1\r\n\tlastFrameTS = 0\r\n\tisRunning = false\r\n\tticking = false\r\n\tisDragging = false\r\n\r\n\tconstructor( View, listener, debug ){\r\n\t\tthis.View = View\r\n\t\tthis.animatorListener = listener\r\n\t\tif( !debug ){\r\n\t\t\tlet nofn = function(){}\r\n\t\t\tthis.debugStart = nofn;\r\n\t\t\tthis.debugEnd = nofn;\r\n\t\t}\r\n\t}\r\n\r\n\tdoFrame( frameTimeMillis ) {\r\n\t\tif( !this.isRunning ) return;\r\n\r\n\t\tif ( this.lastFrameTS ) {\r\n\t\t\tthis.animateFrameWithDeltaTime(\r\n\t\t\t\t(frameTimeMillis - this.lastFrameTS) * 1e-3\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\tthis.lastFrameTS = frameTimeMillis;\r\n\t\tthis.animatorListener.onAnimationFrame();\r\n\t\trequestAnimationFrame( () => this.doFrame( Date.now() ) )\r\n\t}\r\n\r\n\tdebugStart( behavior ){\r\n\t\tif( this.debug !== true && this.debug !== behavior.type ) return;\r\n\t\tthis.debugB = behavior\r\n\t\tthis.debugInitialV = {...this.physicsObject}\r\n\t}\r\n\r\n\tdebugEnd() {\r\n\t\tif (!this.debugB || (this.debug !== true && this.debug !== this.debugB.type)) return;\r\n\t\tconsole.log( `Debug ${this.debugB.type}`, {\r\n\t\t\tdvx: this.physicsObject.vx - this.debugInitialV.vx,\r\n\t\t\tdvy: this.physicsObject.vy - this.debugInitialV.vy,\r\n\t\t})\r\n\t}\r\n\t\r\n\tanimateFrameWithDeltaTime( deltaTime ) {\r\n\t\tif( !deltaTime ) return;\r\n\r\n\t\tlet { physicsObject, behaviors, View } = this\r\n\t\tlet hadMovement = false\r\n\t\tlet coords = View.getTranslation()\r\n\r\n\t\tbehaviors.forEach( behavior => {\r\n\t\t\tthis.debugStart( behavior )\r\n\t\t\tBehaviors[ behavior.type ].doFrame( behavior, deltaTime, physicsObject, coords, View )\r\n\t\t\tthis.debugEnd()\r\n\t\t})\r\n\r\n\t\tlet dx = 0;\r\n\t\tlet {vx,vy} = physicsObject\r\n\t\t\r\n\t\tif ( Math.abs(vx) > ANIMATOR_PAUSE_ZERO_VELOCITY ) {\r\n\t\t\tdx = deltaTime * vx;\r\n\t\t\thadMovement = true;\r\n\t\t}\r\n\r\n\t\tlet dy = 0;\r\n\t\tif ( Math.abs(vy) > ANIMATOR_PAUSE_ZERO_VELOCITY ) {\r\n\t\t\tdy = deltaTime * vy;\r\n\t\t\thadMovement = true;\r\n\t\t}\r\n\t\t\r\n\t\tView.animate( dx, dy )\r\n\r\n\t\tlet cfwnm = hadMovement ? 0 : this.consecutiveFramesWithNoMovement + 1\r\n\t\tthis.consecutiveFramesWithNoMovement = cfwnm\r\n\r\n\t\tif (cfwnm >= ANIMATOR_PAUSE_CONSECUTIVE_FRAMES && !this.isDragging ) {\r\n\t\t\tthis.stopRunning();\r\n\t\t\tthis.animatorListener.onAnimatorPause();\r\n\t\t}\r\n\t}\r\n\r\n\taddBehavior( type, options, isTemp ){\r\n\t\tlet b = Behaviors[ type ]\r\n\t\tif( !b ) return;\r\n\r\n\t\tlet behavior = b.create( options, isTemp )\r\n\t\tlet behaviors = this.behaviors\r\n\t\tlet idx = 0\r\n\r\n\t\twhile (behaviors.length > idx && behaviors[idx].priority <= behavior.priority) {\r\n\t\t\t++idx;\r\n\t\t}\r\n\t\tbehaviors.splice( idx, 0, behavior )\r\n\r\n\t\tthis.ensureRunning()\r\n\t\treturn behavior\r\n\t}\r\n\r\n\tremove( condition ){\r\n\t\tlet behaviors = this.behaviors\r\n\t\tlet i = behaviors.length\r\n\t\twhile( i-- > 0 ){\r\n\t\t\tif( condition(behaviors[i]) ){\r\n\t\t\t\tbehaviors.splice( i, 1 )\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tremoveBehavior( behavior ) {\r\n\t\tthis.remove( target => target === behavior )\r\n\t}\r\n\r\n\tremoveTypeBehaviors( type ){\r\n\t\tthis.remove( target => target.type === type )\r\n\t}\r\n\t\r\n\tremoveTempBehaviors(){\r\n\t\tthis.remove( target => target.isTemp )\r\n\t}\r\n\t\r\n\tgetVelocity(){ \r\n\t\treturn { x: this.physicsObject.vx, y: this.physicsObject.vy }\r\n\t}\r\n\r\n\tensureRunning() {\r\n\t\tthis.isRunning || this.startRunning()\r\n\t}\r\n\r\n\tstartRunning() {\r\n\t\tthis.isRunning = true;\r\n\t\tthis.lastFrameTS = 0;\r\n\t\tthis.consecutiveFramesWithNoMovement = 0;\r\n\t\trequestAnimationFrame( () => this.doFrame( Date.now() ) )\r\n\t}\r\n\r\n\tstopRunning() {\r\n\t\tthis.removeTempBehaviors();\r\n\t\tthis.physicsObject = {vx: 0, vy: 0, mass: this.physicsObject.mass}\r\n\t\tthis.isRunning = false;\r\n\t}\r\n}\r\n\r\nexport default PhysicsAnimator","import React, { Component } from 'react'\r\nimport PropTypes from 'prop-types'\r\nimport Animator from './Animator'\r\nimport Utils from './Utils';\r\n\r\nconst propBehaviors = {\r\n\tfrictionAreas: 'friction',\r\n\tgravityPoints: 'gravity',\r\n\tspringPoints: 'spring',\r\n}\r\n\r\nconst isWeb = typeof document !== 'undefined'\r\n\r\nexport default function injectDependencies( Animated, PanResponder ){\r\n\r\n\treturn class InteractableView extends Component {\r\n\t\tstatic propTypes = {\r\n\t\t\tsnapPoints: PropTypes.array,\r\n\t\t\tfrictionAreas: PropTypes.array,\r\n\t\t\talertAreas: PropTypes.array,\r\n\t\t\tgravityPoints: PropTypes.array,\r\n\t\t\thorizontalOnly: PropTypes.bool,\r\n\t\t\tverticalOnly: PropTypes.bool,\r\n\t\t\tdragWithSpring: PropTypes.object,\r\n\t\t\tdragEnabled: PropTypes.bool,\r\n\t\t\tanimatedValueX: PropTypes.instanceOf(Animated.Value),\r\n\t\t\tanimatedValueY: PropTypes.instanceOf(Animated.Value),\r\n\t\t\tonSnap: PropTypes.func,\r\n\t\t\tonSnapStart: PropTypes.func,\r\n\t\t\tonEnd: PropTypes.func,\r\n\t\t\tonDrag: PropTypes.func,\r\n\t\t\tboundaries: PropTypes.object,\r\n\t\t\tinitialPosition: PropTypes.object,\r\n\t\t\tdragToss: PropTypes.number\r\n\t\t}\r\n\r\n\t\tstatic defaultProps = {\r\n\t\t\tsnapPoints: [],\r\n\t\t\tfrictionAreas: [],\r\n\t\t\talertAreas: [],\r\n\t\t\tgravityPoints: [],\r\n\t\t\tboundaries: {},\r\n\t\t\tinitialPosition: {x: 0, y: 0},\r\n\t\t\tdragToss: .1,\r\n\t\t\tdragEnabled: true,\r\n\t\t\tonSnap: function () { },\r\n\t\t\tonSnapStart: function () { },\r\n\t\t\tonStop: function () { },\r\n\t\t\tonDrag: function () { },\r\n\t\t\tonAlert: function () { },\r\n\t\t\tstyle: {}\r\n\t\t}\r\n\r\n\t\tinitialPositionSet = false\r\n\t\tisDragging = false\r\n\r\n\t\tconstructor(props) {\r\n\t\t\tsuper(props)\r\n\r\n\t\t\tlet { x=0, y=0 } = props.initialPosition\r\n\r\n\t\t\t// In case animatedValueXY is not given\r\n\t\t\tthis.animated = new Animated.ValueXY({x, y})\r\n\r\n\t\t\t// This guy will apply all the physics\r\n\t\t\tthis.animator = this.createAnimator( props )\r\n\r\n\t\t\t// Cache when the view is inside of an alert area\r\n\t\t\tthis.insideAlertAreas = {}\r\n\r\n\t\t\t// cache calculated areas\r\n\t\t\tthis.propAreas = {\r\n\t\t\t\talert: [],\r\n\t\t\t\tboundaries: false\r\n\t\t\t}\r\n\r\n\t\t\tthis._pr = this.createPanResponder(props)\r\n\t\t\t\r\n\t\t\t// Set behaviors and prop defaults\r\n\t\t\tthis.setPropBehaviours( {}, props )\r\n\r\n\t\t\t// Set initial position\r\n\t\t\tlet animated = this.getAnimated( props )\r\n\t\t\tanimated.x.setValue( x )\r\n\t\t\tanimated.y.setValue(y)\r\n\t\t\tanimated.x._startingValue = x\r\n\t\t\tanimated.y._startingValue = y\r\n\t\t\t\r\n\t\t\t// Save the last animation end position to report good coordinates in the events\r\n\t\t\tthis.lastEnd = {...this.initialPosition}\r\n\t\t}\r\n\r\n\t\trender() {\r\n\t\t\tlet { x, y } = this.getAnimated()\r\n\t\t\tlet style = this.props.style\r\n\t\t\tlet withPosition = {\r\n\t\t\t\ttransform: [{ translateX: x }, { translateY: y }].concat( style.transform || [] ),\r\n\t\t\t\t...style\r\n\t\t\t}\r\n\r\n\t\t\tlet panHandlers = this.props.dragEnabled ? this._pr.panHandlers : {}\r\n\r\n\t\t\treturn (\r\n\t\t\t\t\r\n\t\t\t\t\t{this.props.children}\r\n\t\t\t\t\r\n\t\t\t)\r\n\t\t}\r\n\r\n\t\tgetTranslation(){\r\n\t\t\tlet {x, y} = this.getAnimated()\r\n\t\t\treturn {\r\n\t\t\t\tx: x._value + x._offset,\r\n\t\t\t\ty: y._value + y._offset\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tsetTranslationX( tx ){\r\n\t\t\tlet animated = this.props.animatedValueX || this.animated.x\r\n\t\t\tanimated.setValue( tx - animated._offset )\r\n\t\t}\r\n\r\n\t\tsetTranslationY(ty) {\r\n\t\t\tlet animated = this.props.animatedValueY || this.animated.y\r\n\t\t\tanimated.setValue( ty - animated._offset )\r\n\t\t}\r\n\r\n\t\tsetTranslation( tx, ty ){\r\n\t\t\tthis.setTranslationX( tx )\r\n\t\t\tthis.setTranslationY( ty )\r\n\t\t}\r\n\r\n\t\tcreateAnimator(){\r\n\t\t\treturn new Animator( this, {\r\n\t\t\t\tonAnimatorPause: () => {\r\n\t\t\t\t\tlet { x, y } = this.getTranslation()\r\n\t\t\t\t\tthis.lastEnd = {x: Math.round(x), y: Math.round(y)}\r\n\t\t\t\t\tthis.props.onStop( this.lastEnd )\r\n\t\t\t\t},\r\n\t\t\t\tonAnimationFrame: () => {\r\n\t\t\t\t\tthis.reportAlertEvent( this.getTranslation() )\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tfalse // Set true or behavior type to output debug info in the console\r\n\t\t\t)\r\n\t\t}\r\n\r\n\t\tanimate( dx, dy ){\r\n\t\t\tif(!dx && !dy) return\r\n\t\t\t// let animated = this.getAnimated()\r\n\t\t\t// console.log( dx + animated.x._value + animated.x._offset )\r\n\r\n\t\t\tlet {x,y} = this.getTranslation()\r\n\t\t\tthis.setTranslation( x + dx, y + dy ) \r\n\t\t}\r\n\r\n\t\tgetAnimated( props ){\r\n\t\t\tlet { animatedValueX, animatedValueY } = (props || this.props)\r\n\r\n\t\t\treturn {\r\n\t\t\t\tx: animatedValueX || this.animated.x ,\r\n\t\t\t\ty: animatedValueY || this.animated.y\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tcreatePanResponder() {\r\n\t\t\tlet capturer = this.checkResponderCapture.bind(this)\r\n\t\t\t\r\n\t\t\treturn PanResponder.create({\r\n\t\t\t\tonMoveShouldSetResponderCapture: capturer,\r\n\t\t\t\tonMoveShouldSetPanResponderCapture: capturer,\r\n\r\n\t\t\t\tonPanResponderGrant: (e, {x0, y0}) => {\t\r\n\t\t\t\t\tthis._captured = true;\r\n\t\t\t\t\tthis.startDrag( {x: x0, y: y0} )\r\n\t\t\t\t},\r\n\r\n\t\t\t\tonPanResponderMove: (e, gesture ) => {\r\n\t\t\t\t\tthis.onDragging( gesture )\r\n\t\t\t\t},\r\n\r\n\t\t\t\tonPanResponderRelease: () => {\r\n\t\t\t\t\tthis._captured = false;\r\n\t\t\t\t\tthis.endDrag()\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t}\r\n\r\n\t\tcheckResponderCapture( e, gesture ){\r\n\t\t\treturn this._captured || Math.abs( gesture.dx ) > 5 || Math.abs( gesture.dy ) > 5;\r\n\t\t}\r\n\r\n\t\treportAlertEvent( position ){\r\n\t\t\tlet inside = this.insideAlertAreas\r\n\t\t\tlet { onAlert } = this.props\r\n\r\n\t\t\tthis.propAreas.alert.forEach( ({ influence, id }) => {\r\n\t\t\t\tif ( !influence || !id ) return;\r\n\r\n\t\t\t\tif ( Utils.isPointInArea( position, influence ) ) {\r\n\t\t\t\t\tif ( !inside[id] ) {\r\n\t\t\t\t\t\tonAlert({id, value:\"enter\"});\r\n\t\t\t\t\t\tinside[id] = 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t} else if (inside[id]) {\r\n\t\t\t\t\tonAlert({ id, value: \"leave\" });\r\n\t\t\t\t\tinside[id] = 0;\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t}\r\n\r\n\t\tstartDrag( ev ){\r\n\t\t\t// Prepare the animated\r\n\t\t\tlet {x,y} = this.getAnimated()\r\n\t\t\tlet offset = {x: x._value, y: y._value}\r\n\t\t\tx.setOffset( offset.x )\r\n\t\t\ty.setOffset( offset.y )\r\n\t\t\tx.setValue( 0 )\r\n\t\t\ty.setValue( 0 )\r\n\r\n\t\t\t// Save the offset for triggering events with the right coordinates\r\n\t\t\tthis.lastEnd = offset\r\n\t\t\t// console.log( offset )\r\n\r\n\t\t\t// Set boundaries to fast access\r\n\t\t\tthis.dragBoundaries = this.propAreas.boundaries ? this.propAreas.boundaries.influence : {}\r\n\r\n\t\t\t// Prepare the animation\r\n\t\t\tthis.props.onDrag({state: 'start', x: offset.x, y: offset.y})\r\n\t\t\tthis.dragStartLocation = { x: ev.x, y: ev.y }\r\n\t\t\tthis.animator.removeTempBehaviors();\r\n\t\t\tthis.animator.isDragging = true\r\n\t\t\tthis.animator.vx = 0\r\n\t\t\tthis.animator.vy = 0\r\n\t\t\tthis.addTempDragBehavior( this.props.dragWithSpring );\r\n\r\n\t\t\t// Stop text selection\r\n\t\t\tif ( isWeb ) {\r\n\t\t\t\tlet styles = document.body.style\r\n\t\t\t\tthis.userSelectCache = styles.userSelect\r\n\t\t\t\tstyles.userSelect = \"none\"\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tonDragging({dx, dy}){\r\n\t\t\tif( !this.animator.isDragging ) return false\r\n\t\t\tif( !this.props.dragEnabled ) return this.endDrag()\r\n\r\n\t\t\tlet pos = this.lastEnd\r\n\t\t\tlet x = dx + pos.x\r\n\t\t\tlet y = dy + pos.y\r\n\t\t\t\r\n\t\t\t// console.log( this.dragBoundaries.minPoint )\r\n\r\n\t\t\tlet {minPoint, maxPoint} = this.dragBoundaries\r\n\t\t\tif( !this.props.verticalOnly ){\r\n\t\t\t\tif (minPoint) {\r\n\t\t\t\t\tif (minPoint.x > x) x = minPoint.x\r\n\t\t\t\t\tif (maxPoint.x < x) x = maxPoint.x\r\n\t\t\t\t}\r\n\t\t\t\tthis.dragBehavior.x0 = x\r\n\t\t\t}\r\n\r\n\t\t\tif (!this.props.horizontalOnly) {\r\n\t\t\t\tif (minPoint) {\r\n\t\t\t\t\tif (minPoint.y > y) y = minPoint.y\r\n\t\t\t\t\tif (maxPoint.y < y) y = maxPoint.y\r\n\t\t\t\t}\r\n\t\t\t\tthis.dragBehavior.y0 = y\r\n\t\t\t}\r\n\r\n\t\t\t// console.log( this.dragBehavior )\r\n\t\t}\r\n\r\n\t\tendDrag(){\r\n\t\t\tthis.animator.removeTempBehaviors();\r\n\t\t\tthis.dragBehavior = null;\r\n\t\t\tthis.animator.isDragging = false\r\n\r\n\t\t\tlet { animator, horizontalOnly, verticalOnly, dragWithSprings } = this\r\n\r\n\t\t\tlet velocity = animator.getVelocity();\r\n\t\t\tif (horizontalOnly) velocity.y = 0;\r\n\t\t\tif (verticalOnly) velocity.x = 0;\r\n\t\t\t\r\n\t\t\tlet toss = (dragWithSprings && dragWithSprings.toss) || this.props.dragToss;\r\n\t\t\tlet {x,y} = this.getTranslation()\r\n\t\t\tlet projectedCenter = {\r\n\t\t\t\tx: x + toss * velocity.x,\r\n\t\t\t\ty: y + toss * velocity.y\r\n\t\t\t};\r\n\r\n\t\t\t// console.log( 'pc', projectedCenter, velocity)\r\n\t\t\tlet snapPoint = Utils.findClosest(projectedCenter, this.props.snapPoints);\r\n\t\t\tlet targetSnapPointId = (snapPoint && snapPoint.id) || \"\";\r\n\r\n\t\t\tthis.props.onDrag({ state: 'end', x: x, y: y, targetSnapPointId })\r\n\r\n\t\t\tthis.addTempSnapToPointBehavior(snapPoint);\r\n\t\t\tthis.addTempBoundaries();\r\n\r\n\t\t\tlet animated = this.getAnimated()\r\n\t\t\tanimated.x.flattenOffset()\r\n\t\t\tanimated.y.flattenOffset()\r\n\r\n\t\t\t// Restore text selection\r\n\t\t\tif ( isWeb ) {\r\n\t\t\t\tdocument.body.style.userSelect = this.userSelectCache || ''\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\taddTempDragBehavior( drag ) {\r\n\t\t\tlet pos = this.getTranslation()\r\n\r\n\t\t\tif ( !drag || drag.tension === Infinity ) {\r\n\t\t\t\tthis.dragBehavior = this.animator.addBehavior( 'anchor', pos, true )\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tpos.tension = drag.tension || 300\r\n\t\t\t\tthis.dragBehavior = this.animator.addBehavior( 'spring', pos, true )\r\n\t\t\t\tif( drag.damping ){\r\n\t\t\t\t\tthis.animator.addBehavior('friction', drag, true)\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\taddTempSnapToPointBehavior( snapPoint ) {\r\n\t\t\tif (!snapPoint) return;\r\n\t\t\tlet { snapPoints, onSnap, onSnapStart } = this.props\r\n\r\n\t\t\tlet index = snapPoints.indexOf(snapPoint)\r\n\r\n\t\t\tonSnap({index, id: snapPoint.id});\r\n\t\t\tonSnapStart({index, id: snapPoint.id});\r\n\r\n\t\t\tlet springOptions = {\r\n\t\t\t\tdamping: .7,\r\n\t\t\t\ttension: 300,\r\n\t\t\t\t...snapPoint\r\n\t\t\t}\r\n\r\n\t\t\tthis.addBehavior( 'spring', springOptions, true )\r\n\t\t}\r\n\r\n\t\tsetVelocity( velocity ) {\r\n\t\t\tif ( this.dragBehavior ) return;\r\n\t\t\tthis.animator.physicsObject.vx = velocity.x\r\n\t\t\tthis.animator.physicsObject.vy = velocity.y\r\n\t\t\tthis.endDrag();\r\n\t\t}\r\n\r\n\t\tsnapTo( {index} ) {\r\n\t\t\tlet {snapPoints} = this.props;\r\n\r\n\t\t\tif( !snapPoints || index === undefined || index >= snapPoints.length ) return;\r\n\t\t\t\r\n\t\t\tthis.animator.removeTempBehaviors();\r\n\t\t\tthis.dragBehavior = null;\r\n\t\t\tlet snapPoint = snapPoints[index]\r\n\r\n\t\t\tthis.addTempSnapToPointBehavior(snapPoint);\r\n\t\t\tthis.addTempBoundaries();\r\n\t\t}\r\n\r\n\t\taddTempBoundaries(){\r\n\t\t\tlet boundaries = this.propAreas.boundaries;\r\n\t\t\tif( !boundaries ) return;\r\n\t\t\tthis.animator.addBehavior( 'bounce', boundaries, true );\r\n\t\t}\r\n\r\n\t\tchangePosition( position ) {\r\n\t\t\tif ( this.dragBehavior ) return;\r\n\r\n\t\t\tthis.setTranslation( position.x, position.y )\r\n\t\t\tthis.endDrag();\r\n\t\t}\r\n\r\n\t\tcomponentDidUpdate( prevProps ){\r\n\t\t\tthis.setPropBehaviours( prevProps, this.props )\r\n\t\t}\r\n\r\n\t\tsetPropBehaviours( prevProps, props ){\r\n\t\t\t// spring, gravity, friction\r\n\t\t\tObject.keys( propBehaviors ).forEach( prop => {\r\n\t\t\t\tif( prevProps[ prop ] !== props[ prop ] ){\r\n\t\t\t\t\tthis.animator.removeTypeBehaviors(propBehaviors[prop])\r\n\t\t\t\t\tthis.addTypeBehaviors( propBehaviors[prop], props[ prop ] )\r\n\t\t\t\t}\r\n\t\t\t})\r\n\r\n\t\t\tif( prevProps.alertAreas !== props.alertAreas ){\r\n\t\t\t\tlet alertAreas = []\r\n\t\t\t\tprops.alertAreas.forEach( area => {\r\n\t\t\t\t\talertAreas.push({\r\n\t\t\t\t\t\tid: area.id,\r\n\t\t\t\t\t\tinfluence: Utils.createArea( area.influenceArea )\r\n\t\t\t\t\t})\r\n\t\t\t\t})\r\n\t\t\t\tthis.propAreas.alert = alertAreas\r\n\t\t\t}\r\n\r\n\t\t\tif( prevProps.boundaries !== props.boundaries ){\r\n\t\t\t\tthis.animator.removeBehavior( this.oldBoundariesBehavior )\r\n\t\t\t\tif( props.boundaries ){\r\n\t\t\t\t\tlet bounce = {\r\n\t\t\t\t\t\tbounce: props.boundaries.bounce || 0,\r\n\t\t\t\t\t\tinfluence: Utils.createArea( props.boundaries )\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.propAreas.boundaries = bounce\r\n\t\t\t\t\tthis.oldBoundariesBehavior = this.animator.addBehavior( 'bounce', bounce )\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tthis.propAreas.boundaries = false\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif (!this.props.dragEnabled && prevProps.dragEnabled && this.dragBehavior ){\r\n\t\t\t\tthis.endDrag()\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\taddTypeBehaviors( type, behaviors, isTemp ){\r\n\t\t\tbehaviors.forEach( b => this.addBehavior( type, b, isTemp )\t)\r\n\t\t}\r\n\r\n\t\taddBehavior( type, behavior, isTemp ){\r\n\t\t\tthis.animator.addBehavior( type, behavior, isTemp )\r\n\t\t\tif( behavior.damping && type !== 'friction' ){\r\n\t\t\t\tlet b = this.animator.addBehavior('friction', behavior, isTemp )\r\n\t\t\t\tif( type === 'gravity' && !behavior.influenceArea ){\r\n\t\t\t\t\tb.influence = Utils.createAreaFromRadius(1.4 * (behavior.falloff || 40), behavior)\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n","import { Animated, PanResponder } from 'react-native'\r\nimport injectDependencies from './InteractableView'\r\n\r\nlet Interactable = injectDependencies(Animated, PanResponder)\r\nexport default { View: Interactable }"],"names":["createArea","boundaries","minPoint","x","left","undefined","Infinity","y","top","maxPoint","right","bottom","createAreaFromRadius","radius","anchor","isPointInArea","area","findClosest","origin","points","minDistance","closestPoint","forEach","point","distance","getDistance","relative","p","r","dx","Math","abs","dy","sqrt","getDelta","def","value","defaultValue","create","options","isTemp","x0","y0","priority","type","doFrame","deltaTime","state","coords","vx","vy","bounce","influence","target","setTranslationX","setTranslationY","friction","damping","Utils","influenceArea","pow","gravity","strength","falloff","dr","a","exp","mass","ax","ay","spring","tension","ANIMATOR_PAUSE_CONSECUTIVE_FRAMES","ANIMATOR_PAUSE_ZERO_VELOCITY","requestAnimationFrame","PhysicsAnimator","View","listener","debug","animatorListener","nofn","debugStart","debugEnd","frameTimeMillis","isRunning","lastFrameTS","animateFrameWithDeltaTime","onAnimationFrame","Date","now","behavior","debugB","debugInitialV","physicsObject","console","log","dvx","dvy","behaviors","hadMovement","getTranslation","Behaviors","animate","cfwnm","consecutiveFramesWithNoMovement","isDragging","stopRunning","onAnimatorPause","b","idx","length","splice","ensureRunning","condition","i","remove","startRunning","removeTempBehaviors","propBehaviors","frictionAreas","gravityPoints","springPoints","isWeb","document","injectDependencies","Animated","PanResponder","props","initialPosition","animated","ValueXY","animator","createAnimator","insideAlertAreas","propAreas","alert","_pr","createPanResponder","setPropBehaviours","getAnimated","setValue","_startingValue","lastEnd","style","withPosition","transform","translateX","translateY","concat","panHandlers","dragEnabled","React","children","_value","_offset","tx","animatedValueX","ty","animatedValueY","Animator","round","onStop","reportAlertEvent","setTranslation","capturer","checkResponderCapture","bind","onMoveShouldSetResponderCapture","onMoveShouldSetPanResponderCapture","onPanResponderGrant","e","_captured","startDrag","onPanResponderMove","gesture","onDragging","onPanResponderRelease","endDrag","position","inside","onAlert","id","ev","offset","setOffset","dragBoundaries","onDrag","dragStartLocation","addTempDragBehavior","dragWithSpring","styles","body","userSelectCache","userSelect","pos","verticalOnly","dragBehavior","horizontalOnly","dragWithSprings","velocity","getVelocity","toss","dragToss","projectedCenter","snapPoint","snapPoints","targetSnapPointId","addTempSnapToPointBehavior","addTempBoundaries","flattenOffset","drag","addBehavior","onSnap","onSnapStart","index","indexOf","springOptions","prevProps","Object","keys","prop","removeTypeBehaviors","addTypeBehaviors","alertAreas","push","removeBehavior","oldBoundariesBehavior","Component","PropTypes","array","bool","object","instanceOf","Value","func","onEnd","number","Interactable"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,cAAe;EACdA,EAAAA,UAAU,EAAE,oBAAUC,UAAV,EAAsB;EACjC,WAAO;EACNC,MAAAA,QAAQ,EAAE;EACTC,QAAAA,CAAC,EAAEF,UAAU,CAACG,IAAX,KAAoBC,SAApB,GAAgC,CAACC,QAAjC,GAA4CL,UAAU,CAACG,IADjD;E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AK,EAAEP,SAAS,CAACM,IAbC;EAclBhD,IAAAA,MAAM,EAAE0C,SAAS,CAACM,IAdA;EAelBzO,IAAAA,UAAU,EAAEmO,SAAS,CAACG,MAfJ;EAgBlBvG,IAAAA,eAAe,EAAEoG,SAAS,CAACG,MAhBT;EAiBlB7B,IAAAA,QAAQ,EAAE0B,SAAS,CAACQ;EAjBF,GADpB,2CAqBuB;EACrB/B,IAAAA,UAAU,EAAE,EADS;EAErBtF,IAAAA,aAAa,EAAE,EAFM;EAGrBwG,IAAAA,UAAU,EAAE,EAHS;EAIrBvG,IAAAA,aAAa,EAAE,EAJM;EAKrBvH,IAAAA,UAAU,EAAE,EALS;EAMrB+H,IAAAA,eAAe,EAAE;EAAC7H,MAAAA,CAAC,EAAE,CAAJ;EAAOI,MAAAA,CAAC,EAAE;EAAV,KANI;EAOrBmM,IAAAA,QAAQ,EAAE,EAPW;EAQrBpD,IAAAA,WAAW,EAAE,IARQ;EASrB8D,IAAAA,MAAM,EAAE,kBAAY,EATC;EAUrBC,IAAAA,WAAW,EAAE,uBAAY,EAVJ;EAWrBpD,IAAAA,MAAM,EAAE,kBAAY,EAXC;EAYrByB,IAAAA,MAAM,EAAE,kBAAY,EAZC;EAarBN,IAAAA,OAAO,EAAE,mBAAY,EAbA;EAcrBrC,IAAAA,KAAK,EAAE;EAdc,GArBvB;EAoaA;;EChbD,IAAI8F,YAAY,GAAGjH,kBAAkB,CAACC,oBAAD,EAAWC,wBAAX,CAArC;AACA,eAAe;EAAElD,EAAAA,IAAI,EAAEiK;EAAR,CAAf;;;;;;;;"} \ No newline at end of file diff --git a/dist/interactable.native.min.js b/dist/interactable.native.min.js index afa54be..a58f0ff 100644 --- a/dist/interactable.native.min.js +++ b/dist/interactable.native.min.js @@ -1,9 +1,9 @@ /*! * *//* eslint-disable */ /*! - * react-interactable v0.6.5 + * react-interactable v0.6.6 * (c) 2019-present Javier Marquez * Released under the MIT License. */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("prop-types"),require("react-native")):"function"==typeof define&&define.amd?define(["react","prop-types","react-native"],t):e.Interactable=t(e.React,e.PropTypes,e.ReactNative)}(this,function(e,t,n){"use strict";var i="default"in e?e.default:e;function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var n=0;n=a.x&&n<=r.x&&i>=a.y&&i<=r.y},findClosest:function(e,t){var n=this,i=1/0,a=null;return t.forEach(function(t){var r=n.getDistance(t,e);r1&&void 0!==arguments[1]&&arguments[1];return{x0:e.x,y0:e.y,priority:1,isTemp:t,type:"anchor"}},doFrame:function(e,t,n,i){n.vx=(e.x0-i.x)/t,n.vy=(e.y0-i.y)/t}},bounce:{create:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{type:"bounce",bounce:l(e.bounce,.5),minPoint:e.influence.minPoint,maxPoint:e.influence.maxPoint,priority:3,isTemp:t}},doFrame:function(e,t,n,i,a){var r=e.minPoint,o=e.maxPoint,s=e.bounce,u=i.x,h=i.y;r.x>u&&a.setTranslationX(r.x),r.y>h&&a.setTranslationY(r.y),o.xu&&c<0&&(n.vx=-c*s),r.y>h&&d<0&&(n.vy=-d*s),o.x0&&(n.vx=-c*s),o.y0&&(n.vy=-d*s)}},friction:{create:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{type:"friction",damping:l(e.damping,.7),influence:v.createArea(e.influenceArea||{}),priority:2,isTemp:t}},doFrame:function(e,t,n,i){if(v.isPointInArea(i,e.influence)){var a=Math.pow(e.damping,60*t);n.vx=a*n.vx,n.vy=a*n.vy}}},gravity:{create:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{type:"gravity",x0:l(e.x,1/0),y0:l(e.y,1/0),strength:l(e.strength,400),falloff:l(e.falloff,40),damping:l(e.damping,0),influence:v.createArea(e.influenceArea||{}),isTemp:t,priority:1}},doFrame:function(e,t,n,i){if(v.isPointInArea(i,e.influence)){var a=e.x0!==1/0?i.x-e.x0:0,r=e.y0!==1/0?i.y-e.y0:0,o=Math.sqrt(a*a+r*r);if(o){var s=e.falloff,u=-e.strength*o*Math.exp(o*o*-.5/(s*s))/n.mass,h=a/o*u,c=r/o*u;n.vx+=t*h,n.vy+=t*c}}}},spring:{create:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{type:"spring",x0:l(e.x,0),y0:l(e.y,0),tension:l(e.tension,300),influence:v.createArea(e.influenceArea||{}),isTemp:t,priority:1}},doFrame:function(e,t,n,i){if(v.isPointInArea(i,e.influence)){var a=i.x-e.x0;a&&(n.vx+=t*(-1*e.tension*a/n.mass));var r=i.y-e.y0;r&&(n.vy+=t*(-1*e.tension*r/n.mass))}}}};"undefined"==typeof requestAnimationFrame&&(requestAnimationFrame=function(){});var p,y,m,g,b=function(){function e(t,n,i){if(a(this,e),s(this,"behaviors",[]),s(this,"physicsObject",{vx:0,vy:0,mass:1}),s(this,"consecutiveFramesWithNoMovement",0),s(this,"screenScale",1),s(this,"lastFrameTS",0),s(this,"isRunning",!1),s(this,"ticking",!1),s(this,"isDragging",!1),this.View=t,this.animatorListener=n,!i){var r=function(){};this.debugStart=r,this.debugEnd=r}}return o(e,[{key:"doFrame",value:function(e){var t=this;this.isRunning&&(this.lastFrameTS&&this.animateFrameWithDeltaTime(.001*(e-this.lastFrameTS)),this.lastFrameTS=e,this.animatorListener.onAnimationFrame(),requestAnimationFrame(function(){return t.doFrame(Date.now())}))}},{key:"debugStart",value:function(e){!0!==this.debug&&this.debug!==e.type||(this.debugB=e,this.debugInitialV=Object.assign({},this.physicsObject))}},{key:"debugEnd",value:function(){!this.debugB||!0!==this.debug&&this.debug!==this.debugB.type||console.log("Debug ".concat(this.debugB.type),{dvx:this.physicsObject.vx-this.debugInitialV.vx,dvy:this.physicsObject.vy-this.debugInitialV.vy})}},{key:"animateFrameWithDeltaTime",value:function(e){var t=this;if(e){var n=this.physicsObject,i=this.behaviors,a=this.View,r=!1,o=a.getTranslation();i.forEach(function(i){t.debugStart(i),f[i.type].doFrame(i,e,n,o,a),t.debugEnd()});var s=0,u=n.vx,h=n.vy;Math.abs(u)>1&&(s=e*u,r=!0);var c=0;Math.abs(h)>1&&(c=e*h,r=!0),a.animate(s,c);var d=r?0:this.consecutiveFramesWithNoMovement+1;this.consecutiveFramesWithNoMovement=d,d>=10&&!this.isDragging&&(this.stopRunning(),this.animatorListener.onAnimatorPause())}}},{key:"addBehavior",value:function(e,t,n){var i=f[e];if(i){for(var a=i.create(t,n),r=this.behaviors,o=0;r.length>o&&r[o].priority<=a.priority;)++o;return r.splice(o,0,a),this.ensureRunning(),a}}},{key:"remove",value:function(e){for(var t=this.behaviors,n=t.length;n-- >0;)e(t[n])&&t.splice(n,1)}},{key:"removeBehavior",value:function(e){this.remove(function(t){return t===e})}},{key:"removeTypeBehaviors",value:function(e){this.remove(function(t){return t.type===e})}},{key:"removeTempBehaviors",value:function(){this.remove(function(e){return e.isTemp})}},{key:"getVelocity",value:function(){return{x:this.physicsObject.vx,y:this.physicsObject.vy}}},{key:"ensureRunning",value:function(){this.isRunning||this.startRunning()}},{key:"startRunning",value:function(){var e=this;this.isRunning=!0,this.lastFrameTS=0,this.consecutiveFramesWithNoMovement=0,requestAnimationFrame(function(){return e.doFrame(Date.now())})}},{key:"stopRunning",value:function(){this.removeTempBehaviors(),this.physicsObject={vx:0,vy:0,mass:this.physicsObject.mass},this.isRunning=!1}}]),e}(),x={frictionAreas:"friction",gravityPoints:"gravity",springPoints:"spring"},P="undefined"!=typeof document;return{View:(p=n.Animated,y=n.PanResponder,g=m=function(t){function n(e){var t,i,r;a(this,n),i=this,t=!(r=h(n).call(this,e))||"object"!=typeof r&&"function"!=typeof r?d(i):r,s(d(d(t)),"initialPositionSet",!1),s(d(d(t)),"isDragging",!1);var o=e.initialPosition,u=o.x,c=void 0===u?0:u,v=o.y,l=void 0===v?0:v;t.animated=new p.ValueXY({x:c,y:l}),t.animator=t.createAnimator(e),t.insideAlertAreas={},t.propAreas={alert:[],boundaries:!1},t._pr=t.createPanResponder(e),t.setPropBehaviours({},e);var f=t.getAnimated(e);return f.x.setValue(c),f.y.setValue(l),f.x._startingValue=c,f.y._startingValue=l,t.lastEnd=Object.assign({},t.initialPosition),t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&c(e,t)}(n,e.Component),o(n,[{key:"render",value:function(){var e=this.getAnimated(),t=e.x,n=e.y,a=this.props.style,r=Object.assign({transform:[{translateX:t},{translateY:n}].concat(a.transform||[])},a),o=this.props.dragEnabled?this._pr.panHandlers:{};return i.createElement(p.View,u({style:r},o),this.props.children)}},{key:"getTranslation",value:function(){var e=this.getAnimated(),t=e.x,n=e.y;return{x:t._value+t._offset,y:n._value+n._offset}}},{key:"setTranslationX",value:function(e){var t=this.props.animatedValueX||this.animated.x;t.setValue(e-t._offset)}},{key:"setTranslationY",value:function(e){var t=this.props.animatedValueY||this.animated.y;t.setValue(e-t._offset)}},{key:"setTranslation",value:function(e,t){this.setTranslationX(e),this.setTranslationY(t)}},{key:"createAnimator",value:function(){var e=this;return new b(this,{onAnimatorPause:function(){var t=e.getTranslation(),n=t.x,i=t.y;e.lastEnd={x:Math.round(n),y:Math.round(i)},e.props.onStop(e.lastEnd)},onAnimationFrame:function(){e.reportAlertEvent(e.getTranslation())}},!1)}},{key:"animate",value:function(e,t){if(e||t){var n=this.getTranslation(),i=n.x,a=n.y;this.setTranslation(i+e,a+t)}}},{key:"getAnimated",value:function(e){var t=e||this.props,n=t.animatedValueX,i=t.animatedValueY;return{x:n||this.animated.x,y:i||this.animated.y}}},{key:"createPanResponder",value:function(){var e=this,t=this.checkResponderCapture.bind(this);return y.create({onMoveShouldSetResponderCapture:t,onMoveShouldSetPanResponderCapture:t,onPanResponderGrant:function(t,n){var i=n.x0,a=n.y0;e._captured=!0,e.startDrag({x:i,y:a})},onPanResponderMove:function(t,n){e.onDragging(n)},onPanResponderRelease:function(){e._captured=!1,e.endDrag()}})}},{key:"checkResponderCapture",value:function(e,t){return this._captured||Math.abs(t.dx)>5||Math.abs(t.dy)>5}},{key:"reportAlertEvent",value:function(e){var t=this.insideAlertAreas,n=this.props.onAlert;this.propAreas.alert.forEach(function(i){var a=i.influence,r=i.id;a&&r&&(v.isPointInArea(e,a)?t[r]||(n({id:r,value:"enter"}),t[r]=1):t[r]&&(n({id:r,value:"leave"}),t[r]=0))})}},{key:"startDrag",value:function(e){var t=this.getAnimated(),n=t.x,i=t.y,a={x:n._value,y:i._value};if(n.setOffset(a.x),i.setOffset(a.y),n.setValue(0),i.setValue(0),this.lastEnd=a,this.dragBoundaries=this.propAreas.boundaries?this.propAreas.boundaries.influence:{},this.props.onDrag({state:"start",x:a.x,y:a.y}),this.dragStartLocation={x:e.x,y:e.y},this.animator.removeTempBehaviors(),this.animator.isDragging=!0,this.animator.vx=0,this.animator.vy=0,this.addTempDragBehavior(this.props.dragWithSpring),P){var r=document.body.style;this.userSelectCache=r.userSelect,r.userSelect="none"}}},{key:"onDragging",value:function(e){var t=e.dx,n=e.dy;if(!this.animator.isDragging)return!1;if(!this.props.dragEnabled)return this.endDrag();var i=this.lastEnd,a=t+i.x,r=n+i.y,o=this.dragBoundaries,s=o.minPoint,u=o.maxPoint;this.props.verticalOnly||(s&&(s.x>a&&(a=s.x),u.xr&&(r=s.y),u.y=n.length)){this.animator.removeTempBehaviors(),this.dragBehavior=null;var i=n[t];this.addTempSnapToPointBehavior(i),this.addTempBoundaries()}}},{key:"addTempBoundaries",value:function(){var e=this.propAreas.boundaries;e&&this.animator.addBehavior("bounce",e,!0)}},{key:"changePosition",value:function(e){this.dragBehavior||(this.setTranslation(e.x,e.y),this.endDrag())}},{key:"componentDidUpdate",value:function(e){this.setPropBehaviours(e,this.props)}},{key:"setPropBehaviours",value:function(e,t){var n=this;if(Object.keys(x).forEach(function(i){e[i]!==t[i]&&(n.animator.removeTypeBehaviors(x[i]),n.addTypeBehaviors(x[i],t[i]))}),e.alertAreas!==t.alertAreas){var i=[];t.alertAreas.forEach(function(e){i.push({id:e.id,influence:v.createArea(e.influenceArea)})}),this.propAreas.alert=i}if(e.boundaries!==t.boundaries)if(this.animator.removeBehavior(this.oldBoundariesBehavior),t.boundaries){var a={bounce:t.boundaries.bounce||0,influence:v.createArea(t.boundaries)};this.propAreas.boundaries=a,this.oldBoundariesBehavior=this.animator.addBehavior("bounce",a)}else this.propAreas.boundaries=!1;!this.props.dragEnabled&&e.dragEnabled&&this.dragBehavior&&this.endDrag()}},{key:"addTypeBehaviors",value:function(e,t,n){var i=this;t.forEach(function(t){return i.addBehavior(e,t,n)})}},{key:"addBehavior",value:function(e,t,n){if(this.animator.addBehavior(e,t,n),t.damping&&"friction"!==e){var i=this.animator.addBehavior("friction",t,n);"gravity"!==e||t.influenceArea||(i.influence=v.createAreaFromRadius(1.4*(t.falloff||40),t))}}}]),n}(),s(m,"propTypes",{snapPoints:t.array,frictionAreas:t.array,alertAreas:t.array,gravityPoints:t.array,horizontalOnly:t.bool,verticalOnly:t.bool,dragWithSpring:t.object,dragEnabled:t.bool,animatedValueX:t.instanceOf(p.Value),animatedValueY:t.instanceOf(p.Value),onSnap:t.func,onSnapStart:t.func,onEnd:t.func,onDrag:t.func,boundaries:t.object,initialPosition:t.object,dragToss:t.number}),s(m,"defaultProps",{snapPoints:[],frictionAreas:[],alertAreas:[],gravityPoints:[],boundaries:{},initialPosition:{x:0,y:0},dragToss:.1,dragEnabled:!0,onSnap:function(){},onSnapStart:function(){},onStop:function(){},onDrag:function(){},onAlert:function(){},style:{}}),g)}}); +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("prop-types"),require("react-native")):"function"==typeof define&&define.amd?define(["react","prop-types","react-native"],t):e.Interactable=t(e.React,e.PropTypes,e.ReactNative)}(this,function(e,t,n){"use strict";var i="default"in e?e.default:e;function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var n=0;n=a.x&&n<=r.x&&i>=a.y&&i<=r.y},findClosest:function(e,t){var n=this,i=1/0,a=null;return t.forEach(function(t){var r=n.getDistance(t,e);r1&&void 0!==arguments[1]&&arguments[1];return{x0:e.x,y0:e.y,priority:1,isTemp:t,type:"anchor"}},doFrame:function(e,t,n,i){n.vx=(e.x0-i.x)/t,n.vy=(e.y0-i.y)/t}},bounce:{create:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{type:"bounce",bounce:l(e.bounce,.5),minPoint:e.influence.minPoint,maxPoint:e.influence.maxPoint,priority:3,isTemp:t}},doFrame:function(e,t,n,i,a){var r=e.minPoint,o=e.maxPoint,s=e.bounce,u=i.x,h=i.y;r.x>u&&a.setTranslationX(r.x),r.y>h&&a.setTranslationY(r.y),o.xu&&c<0&&(n.vx=-c*s),r.y>h&&d<0&&(n.vy=-d*s),o.x0&&(n.vx=-c*s),o.y0&&(n.vy=-d*s)}},friction:{create:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{type:"friction",damping:l(e.damping,.7),influence:v.createArea(e.influenceArea||{}),priority:2,isTemp:t}},doFrame:function(e,t,n,i){if(v.isPointInArea(i,e.influence)){var a=Math.pow(e.damping,60*t);n.vx=a*n.vx,n.vy=a*n.vy}}},gravity:{create:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{type:"gravity",x0:l(e.x,1/0),y0:l(e.y,1/0),strength:l(e.strength,400),falloff:l(e.falloff,40),damping:l(e.damping,0),influence:v.createArea(e.influenceArea||{}),isTemp:t,priority:1}},doFrame:function(e,t,n,i){if(v.isPointInArea(i,e.influence)){var a=e.x0!==1/0?i.x-e.x0:0,r=e.y0!==1/0?i.y-e.y0:0,o=Math.sqrt(a*a+r*r);if(o){var s=e.falloff,u=-e.strength*o*Math.exp(o*o*-.5/(s*s))/n.mass,h=a/o*u,c=r/o*u;n.vx+=t*h,n.vy+=t*c}}}},spring:{create:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{type:"spring",x0:l(e.x,0),y0:l(e.y,0),tension:l(e.tension,300),influence:v.createArea(e.influenceArea||{}),isTemp:t,priority:1}},doFrame:function(e,t,n,i){if(v.isPointInArea(i,e.influence)){var a=i.x-e.x0;a&&(n.vx+=t*(-1*e.tension*a/n.mass));var r=i.y-e.y0;r&&(n.vy+=t*(-1*e.tension*r/n.mass))}}}};"undefined"==typeof requestAnimationFrame&&(requestAnimationFrame=function(){});var p,y,m,g,b=function(){function e(t,n,i){if(a(this,e),s(this,"behaviors",[]),s(this,"physicsObject",{vx:0,vy:0,mass:1}),s(this,"consecutiveFramesWithNoMovement",0),s(this,"screenScale",1),s(this,"lastFrameTS",0),s(this,"isRunning",!1),s(this,"ticking",!1),s(this,"isDragging",!1),this.View=t,this.animatorListener=n,!i){var r=function(){};this.debugStart=r,this.debugEnd=r}}return o(e,[{key:"doFrame",value:function(e){var t=this;this.isRunning&&(this.lastFrameTS&&this.animateFrameWithDeltaTime(.001*(e-this.lastFrameTS)),this.lastFrameTS=e,this.animatorListener.onAnimationFrame(),requestAnimationFrame(function(){return t.doFrame(Date.now())}))}},{key:"debugStart",value:function(e){!0!==this.debug&&this.debug!==e.type||(this.debugB=e,this.debugInitialV=Object.assign({},this.physicsObject))}},{key:"debugEnd",value:function(){!this.debugB||!0!==this.debug&&this.debug!==this.debugB.type||console.log("Debug ".concat(this.debugB.type),{dvx:this.physicsObject.vx-this.debugInitialV.vx,dvy:this.physicsObject.vy-this.debugInitialV.vy})}},{key:"animateFrameWithDeltaTime",value:function(e){var t=this;if(e){var n=this.physicsObject,i=this.behaviors,a=this.View,r=!1,o=a.getTranslation();i.forEach(function(i){t.debugStart(i),f[i.type].doFrame(i,e,n,o,a),t.debugEnd()});var s=0,u=n.vx,h=n.vy;Math.abs(u)>1&&(s=e*u,r=!0);var c=0;Math.abs(h)>1&&(c=e*h,r=!0),a.animate(s,c);var d=r?0:this.consecutiveFramesWithNoMovement+1;this.consecutiveFramesWithNoMovement=d,d>=10&&!this.isDragging&&(this.stopRunning(),this.animatorListener.onAnimatorPause())}}},{key:"addBehavior",value:function(e,t,n){var i=f[e];if(i){for(var a=i.create(t,n),r=this.behaviors,o=0;r.length>o&&r[o].priority<=a.priority;)++o;return r.splice(o,0,a),this.ensureRunning(),a}}},{key:"remove",value:function(e){for(var t=this.behaviors,n=t.length;n-- >0;)e(t[n])&&t.splice(n,1)}},{key:"removeBehavior",value:function(e){this.remove(function(t){return t===e})}},{key:"removeTypeBehaviors",value:function(e){this.remove(function(t){return t.type===e})}},{key:"removeTempBehaviors",value:function(){this.remove(function(e){return e.isTemp})}},{key:"getVelocity",value:function(){return{x:this.physicsObject.vx,y:this.physicsObject.vy}}},{key:"ensureRunning",value:function(){this.isRunning||this.startRunning()}},{key:"startRunning",value:function(){var e=this;this.isRunning=!0,this.lastFrameTS=0,this.consecutiveFramesWithNoMovement=0,requestAnimationFrame(function(){return e.doFrame(Date.now())})}},{key:"stopRunning",value:function(){this.removeTempBehaviors(),this.physicsObject={vx:0,vy:0,mass:this.physicsObject.mass},this.isRunning=!1}}]),e}(),x={frictionAreas:"friction",gravityPoints:"gravity",springPoints:"spring"},P="undefined"!=typeof document;return{View:(p=n.Animated,y=n.PanResponder,g=m=function(t){function n(e){var t,i,r;a(this,n),i=this,t=!(r=h(n).call(this,e))||"object"!=typeof r&&"function"!=typeof r?d(i):r,s(d(d(t)),"initialPositionSet",!1),s(d(d(t)),"isDragging",!1);var o=e.initialPosition,u=o.x,c=void 0===u?0:u,v=o.y,l=void 0===v?0:v;t.animated=new p.ValueXY({x:c,y:l}),t.animator=t.createAnimator(e),t.insideAlertAreas={},t.propAreas={alert:[],boundaries:!1},t._pr=t.createPanResponder(e),t.setPropBehaviours({},e);var f=t.getAnimated(e);return f.x.setValue(c),f.y.setValue(l),f.x._startingValue=c,f.y._startingValue=l,t.lastEnd=Object.assign({},t.initialPosition),t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&c(e,t)}(n,e.Component),o(n,[{key:"render",value:function(){var e=this.getAnimated(),t=e.x,n=e.y,a=this.props.style,r=Object.assign({transform:[{translateX:t},{translateY:n}].concat(a.transform||[])},a),o=this.props.dragEnabled?this._pr.panHandlers:{};return i.createElement(p.View,u({style:r},o),this.props.children)}},{key:"getTranslation",value:function(){var e=this.getAnimated(),t=e.x,n=e.y;return{x:t._value+t._offset,y:n._value+n._offset}}},{key:"setTranslationX",value:function(e){var t=this.props.animatedValueX||this.animated.x;t.setValue(e-t._offset)}},{key:"setTranslationY",value:function(e){var t=this.props.animatedValueY||this.animated.y;t.setValue(e-t._offset)}},{key:"setTranslation",value:function(e,t){this.setTranslationX(e),this.setTranslationY(t)}},{key:"createAnimator",value:function(){var e=this;return new b(this,{onAnimatorPause:function(){var t=e.getTranslation(),n=t.x,i=t.y;e.lastEnd={x:Math.round(n),y:Math.round(i)},e.props.onStop(e.lastEnd)},onAnimationFrame:function(){e.reportAlertEvent(e.getTranslation())}},!1)}},{key:"animate",value:function(e,t){if(e||t){var n=this.getTranslation(),i=n.x,a=n.y;this.setTranslation(i+e,a+t)}}},{key:"getAnimated",value:function(e){var t=e||this.props,n=t.animatedValueX,i=t.animatedValueY;return{x:n||this.animated.x,y:i||this.animated.y}}},{key:"createPanResponder",value:function(){var e=this,t=this.checkResponderCapture.bind(this);return y.create({onMoveShouldSetResponderCapture:t,onMoveShouldSetPanResponderCapture:t,onPanResponderGrant:function(t,n){var i=n.x0,a=n.y0;e._captured=!0,e.startDrag({x:i,y:a})},onPanResponderMove:function(t,n){e.onDragging(n)},onPanResponderRelease:function(){e._captured=!1,e.endDrag()}})}},{key:"checkResponderCapture",value:function(e,t){return this._captured||Math.abs(t.dx)>5||Math.abs(t.dy)>5}},{key:"reportAlertEvent",value:function(e){var t=this.insideAlertAreas,n=this.props.onAlert;this.propAreas.alert.forEach(function(i){var a=i.influence,r=i.id;a&&r&&(v.isPointInArea(e,a)?t[r]||(n({id:r,value:"enter"}),t[r]=1):t[r]&&(n({id:r,value:"leave"}),t[r]=0))})}},{key:"startDrag",value:function(e){var t=this.getAnimated(),n=t.x,i=t.y,a={x:n._value,y:i._value};if(n.setOffset(a.x),i.setOffset(a.y),n.setValue(0),i.setValue(0),this.lastEnd=a,this.dragBoundaries=this.propAreas.boundaries?this.propAreas.boundaries.influence:{},this.props.onDrag({state:"start",x:a.x,y:a.y}),this.dragStartLocation={x:e.x,y:e.y},this.animator.removeTempBehaviors(),this.animator.isDragging=!0,this.animator.vx=0,this.animator.vy=0,this.addTempDragBehavior(this.props.dragWithSpring),P){var r=document.body.style;this.userSelectCache=r.userSelect,r.userSelect="none"}}},{key:"onDragging",value:function(e){var t=e.dx,n=e.dy;if(!this.animator.isDragging)return!1;if(!this.props.dragEnabled)return this.endDrag();var i=this.lastEnd,a=t+i.x,r=n+i.y,o=this.dragBoundaries,s=o.minPoint,u=o.maxPoint;this.props.verticalOnly||(s&&(s.x>a&&(a=s.x),u.xr&&(r=s.y),u.y=n.length)){this.animator.removeTempBehaviors(),this.dragBehavior=null;var i=n[t];this.addTempSnapToPointBehavior(i),this.addTempBoundaries()}}},{key:"addTempBoundaries",value:function(){var e=this.propAreas.boundaries;e&&this.animator.addBehavior("bounce",e,!0)}},{key:"changePosition",value:function(e){this.dragBehavior||(this.setTranslation(e.x,e.y),this.endDrag())}},{key:"componentDidUpdate",value:function(e){this.setPropBehaviours(e,this.props)}},{key:"setPropBehaviours",value:function(e,t){var n=this;if(Object.keys(x).forEach(function(i){e[i]!==t[i]&&(n.animator.removeTypeBehaviors(x[i]),n.addTypeBehaviors(x[i],t[i]))}),e.alertAreas!==t.alertAreas){var i=[];t.alertAreas.forEach(function(e){i.push({id:e.id,influence:v.createArea(e.influenceArea)})}),this.propAreas.alert=i}if(e.boundaries!==t.boundaries)if(this.animator.removeBehavior(this.oldBoundariesBehavior),t.boundaries){var a={bounce:t.boundaries.bounce||0,influence:v.createArea(t.boundaries)};this.propAreas.boundaries=a,this.oldBoundariesBehavior=this.animator.addBehavior("bounce",a)}else this.propAreas.boundaries=!1;!this.props.dragEnabled&&e.dragEnabled&&this.dragBehavior&&this.endDrag()}},{key:"addTypeBehaviors",value:function(e,t,n){var i=this;t.forEach(function(t){return i.addBehavior(e,t,n)})}},{key:"addBehavior",value:function(e,t,n){if(this.animator.addBehavior(e,t,n),t.damping&&"friction"!==e){var i=this.animator.addBehavior("friction",t,n);"gravity"!==e||t.influenceArea||(i.influence=v.createAreaFromRadius(1.4*(t.falloff||40),t))}}}]),n}(),s(m,"propTypes",{snapPoints:t.array,frictionAreas:t.array,alertAreas:t.array,gravityPoints:t.array,horizontalOnly:t.bool,verticalOnly:t.bool,dragWithSpring:t.object,dragEnabled:t.bool,animatedValueX:t.instanceOf(p.Value),animatedValueY:t.instanceOf(p.Value),onSnap:t.func,onSnapStart:t.func,onEnd:t.func,onDrag:t.func,boundaries:t.object,initialPosition:t.object,dragToss:t.number}),s(m,"defaultProps",{snapPoints:[],frictionAreas:[],alertAreas:[],gravityPoints:[],boundaries:{},initialPosition:{x:0,y:0},dragToss:.1,dragEnabled:!0,onSnap:function(){},onSnapStart:function(){},onStop:function(){},onDrag:function(){},onAlert:function(){},style:{}}),g)}}); //# sourceMappingURL=interactable.native.min.js.map diff --git a/dist/interactable.native.min.js.map b/dist/interactable.native.min.js.map index 3123645..3d3d2d7 100644 --- a/dist/interactable.native.min.js.map +++ b/dist/interactable.native.min.js.map @@ -1 +1 @@ -{"version":3,"file":"interactable.native.min.js","sources":["../playground/src/react-interactable/Utils.js","../playground/src/react-interactable/Behaviors.js","../playground/src/react-interactable/Animator.js","../playground/src/react-interactable/InteractableView.js","../playground/src/react-interactable/native.js"],"sourcesContent":["export default {\r\n\tcreateArea: function( boundaries ){\r\n\t\treturn {\r\n\t\t\tminPoint: {\r\n\t\t\t\tx: boundaries.left === undefined ? -Infinity : boundaries.left,\r\n\t\t\t\ty: boundaries.top === undefined ? -Infinity : boundaries.top\r\n\t\t\t},\r\n\t\t\tmaxPoint: {\r\n\t\t\t\tx: boundaries.right === undefined ? Infinity : boundaries.right,\r\n\t\t\t\ty: boundaries.bottom === undefined ? Infinity : boundaries.bottom\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\tcreateAreaFromRadius: function( radius, anchor ){\r\n\t\treturn {\r\n\t\t\tminPoint: {x: anchor.x - radius, y: anchor.y - radius},\r\n\t\t\tmaxPoint: {x: anchor.x + radius, y: anchor.y + radius}\r\n\t\t}\r\n\t},\r\n\tisPointInArea: function( {x, y}, area ){\r\n\t\tif( !area ) return true\r\n\r\n\t\tlet { minPoint, maxPoint } = area\r\n\r\n\t\treturn x>=minPoint.x && x <= maxPoint.x && y >= minPoint.y && y <= maxPoint.y\r\n\t},\r\n\tfindClosest: function( origin, points ){\r\n\t\tlet minDistance = Infinity;\r\n\t\tlet closestPoint = null;\r\n\t\tlet distances = []\r\n\t\tpoints.forEach( point => {\r\n\t\t\tlet distance = this.getDistance( point, origin );\r\n\t\t\tdistances.push( distance )\r\n\t\t\tif (distance < minDistance) {\r\n\t\t\t\tminDistance = distance;\r\n\t\t\t\tclosestPoint = point;\r\n\t\t\t}\r\n\t\t})\r\n\t\t// console.log( distances )\r\n\t\treturn closestPoint\r\n\t},\r\n\tgetDistance( point, relative ){\r\n\t\tlet p = {x: point.x === undefined ? Infinity : point.x, y: point.y === undefined ? Infinity : point.y }\r\n\t\tlet r = {x: relative.x === undefined ? Infinity : relative.x, y: relative.y === undefined ? Infinity : relative.y }\r\n\t\tif( p.x === Infinity && p.y === Infinity ) return Infinity\r\n\t\tlet dx = p.x === Infinity ? 0 : Math.abs(r.x - p.x)\r\n\t\tlet dy = p.y === Infinity ? 0 : Math.abs(r.y - p.y)\r\n\t\t\r\n\t\treturn Math.sqrt( dx*dx + dy*dy )\r\n\t},\r\n\tgetDelta( point, origin ){\r\n\t\treturn {\r\n\t\t\tx: point.x - origin.x,\r\n\t\t\ty: point.y - origin.y\r\n\t\t}\r\n\t}\r\n}","import Utils from './Utils'\r\n\r\nfunction def( value, defaultValue ){\r\n\treturn value === undefined ? defaultValue : value\r\n}\r\n\r\nexport default {\r\n\tanchor: {\r\n\t\tcreate: (options, isTemp = false) => (\r\n\t\t\t{ x0: options.x, y0: options.y, priority: 1, isTemp, type: 'anchor' }\r\n\t\t),\r\n\t\tdoFrame: (options, deltaTime, state, coords ) => {\r\n\t\t\t// Velocity = dx / deltaTime\r\n\t\t\tstate.vx = (options.x0 - coords.x) / deltaTime\r\n\t\t\tstate.vy = (options.y0 - coords.y) / deltaTime\r\n\t\t}\r\n\t},\r\n\r\n\tbounce: {\r\n\t\tcreate: (options, isTemp = false) => ({\r\n\t\t\ttype: 'bounce',\r\n\t\t\tbounce: def(options.bounce, .5),\r\n\t\t\tminPoint: options.influence.minPoint,\r\n\t\t\tmaxPoint: options.influence.maxPoint,\r\n\t\t\tpriority: 3,\r\n\t\t\tisTemp\r\n\t\t}),\r\n\t\tdoFrame: ({minPoint, maxPoint, bounce}, deltaTime, state, {x,y}, target ) => {\r\n\t\t\t// Apply limits\r\n\r\n\t\t\tif (minPoint.x > x) target.setTranslationX(minPoint.x);\r\n\t\t\tif (minPoint.y > y) target.setTranslationY(minPoint.y);\r\n\t\t\tif (maxPoint.x < x) target.setTranslationX(maxPoint.x);\r\n\t\t\tif (maxPoint.y < y) target.setTranslationY(maxPoint.y);\r\n\r\n\t\t\tlet { vx, vy } = state\r\n\r\n\t\t\tif (minPoint.x > x && vx < 0) {\r\n\t\t\t\tstate.vx = -vx * bounce\r\n\t\t\t}\r\n\t\t\tif (minPoint.y > y && vy < 0) {\r\n\t\t\t\tstate.vy= -vy * bounce\r\n\t\t\t}\r\n\t\t\tif (maxPoint.x < x && vx > 0) {\r\n\t\t\t\tstate.vx = -vx * bounce\r\n\t\t\t}\r\n\t\t\tif (maxPoint.y < y && vy > 0) {\r\n\t\t\t\tstate.vy = -vy * bounce\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\tfriction: {\r\n\t\tcreate: ( options, isTemp = false ) => ({\r\n\t\t\ttype: 'friction',\r\n\t\t\tdamping: def(options.damping, .7),\r\n\t\t\tinfluence: Utils.createArea( options.influenceArea || {} ),\r\n\t\t\tpriority: 2,\r\n\t\t\tisTemp\r\n\t\t}),\r\n\t\tdoFrame: (options, deltaTime, state, coords) => {\r\n\t\t\tif( !Utils.isPointInArea( coords, options.influence) ) return;\r\n\t\t\t\r\n\t\t\tlet pow = Math.pow(options.damping, 60.0 * deltaTime)\r\n\t\t\tstate.vx = pow * state.vx\r\n\t\t\tstate.vy = pow * state.vy\r\n\t\t}\r\n\t},\r\n\r\n\tgravity: {\r\n\t\tcreate: ( options, isTemp = false ) => ({\r\n\t\t\ttype: 'gravity',\r\n\t\t\tx0: def(options.x, Infinity),\r\n\t\t\ty0: def(options.y, Infinity),\r\n\t\t\tstrength: def(options.strength, 400),\r\n\t\t\tfalloff: def(options.falloff, 40),\r\n\t\t\tdamping: def(options.damping, 0),\r\n\t\t\tinfluence: Utils.createArea(options.influenceArea || {}),\r\n\t\t\tisTemp,\r\n\t\t\tpriority: 1\r\n\t\t}),\r\n\t\tdoFrame: (options, deltaTime, state, coords) => {\r\n\t\t\tif( !Utils.isPointInArea( coords, options.influence) ) return;\r\n\r\n\t\t\tlet dx = options.x0 !== Infinity ? coords.x - options.x0 : 0;\r\n\t\t\tlet dy = options.y0 !== Infinity ? coords.y - options.y0 : 0;\r\n\t\t\tlet dr = Math.sqrt(dx * dx + dy * dy);\r\n\r\n\t\t\tif (!dr) return;\r\n\r\n\t\t\tlet { falloff, strength } = options\r\n\t\t\tlet a = (-strength * dr * Math.exp(-0.5 * (dr * dr) / (falloff * falloff))) / state.mass;\r\n\r\n\t\t\tlet ax = dx / dr * a;\r\n\t\t\tlet ay = dy / dr * a;\r\n\r\n\t\t\tstate.vx += deltaTime * ax\r\n\t\t\tstate.vy += deltaTime * ay\r\n\t\t}\r\n\t},\r\n\r\n\tspring: {\r\n\t\tcreate: ( options, isTemp = false ) => ({\r\n\t\t\ttype: 'spring',\r\n\t\t\tx0: def(options.x, 0),\r\n\t\t\ty0: def(options.y, 0),\r\n\t\t\ttension: def(options.tension, 300),\r\n\t\t\tinfluence: Utils.createArea( options.influenceArea || {} ),\r\n\t\t\tisTemp,\r\n\t\t\tpriority: 1\r\n\t\t}),\r\n\t\tdoFrame: ( options, deltaTime, state, coords) => {\r\n\t\t\tif( !Utils.isPointInArea( coords, options.influence) ) return;\r\n\t\r\n\t\t\tlet dx = coords.x - options.x0;\r\n\t\t\tif( dx ){\r\n\t\t\t\t// time * acceleration\r\n\t\t\t\tstate.vx += deltaTime * ((-1 * options.tension * dx) / state.mass)\r\n\t\t\t}\r\n\t\r\n\t\t\tlet dy = coords.y - options.y0;\r\n\t\t\tif( dy ){\r\n\t\t\t\t// time * acceleration\r\n\t\t\t\tstate.vy += deltaTime * ((-1 * options.tension * dy) / state.mass)\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}","import Behaviors from './Behaviors'\r\n\r\nconst ANIMATOR_PAUSE_CONSECUTIVE_FRAMES = 10;\r\nconst ANIMATOR_PAUSE_ZERO_VELOCITY = 1.0;\r\n\r\nif( typeof requestAnimationFrame === 'undefined' ){\r\n\t// We just don't work without raf (maybe we are in the server)\r\n\t// eslint-disable-next-line no-native-reassign\r\n\trequestAnimationFrame = function(){}\r\n}\r\n\r\nclass PhysicsAnimator {\r\n\tbehaviors = []\r\n\tphysicsObject = {vx: 0, vy: 0, mass: 1}\r\n\tconsecutiveFramesWithNoMovement = 0\r\n\tscreenScale = 1\r\n\tlastFrameTS = 0\r\n\tisRunning = false\r\n\tticking = false\r\n\tisDragging = false\r\n\r\n\tconstructor( View, listener, debug ){\r\n\t\tthis.View = View\r\n\t\tthis.animatorListener = listener\r\n\t\tif( !debug ){\r\n\t\t\tlet nofn = function(){}\r\n\t\t\tthis.debugStart = nofn;\r\n\t\t\tthis.debugEnd = nofn;\r\n\t\t}\r\n\t}\r\n\r\n\tdoFrame( frameTimeMillis ) {\r\n\t\tif( !this.isRunning ) return;\r\n\r\n\t\tif ( this.lastFrameTS ) {\r\n\t\t\tthis.animateFrameWithDeltaTime(\r\n\t\t\t\t(frameTimeMillis - this.lastFrameTS) * 1e-3\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\tthis.lastFrameTS = frameTimeMillis;\r\n\t\tthis.animatorListener.onAnimationFrame();\r\n\t\trequestAnimationFrame( () => this.doFrame( Date.now() ) )\r\n\t}\r\n\r\n\tdebugStart( behavior ){\r\n\t\tif( this.debug !== true && this.debug !== behavior.type ) return;\r\n\t\tthis.debugB = behavior\r\n\t\tthis.debugInitialV = {...this.physicsObject}\r\n\t}\r\n\r\n\tdebugEnd() {\r\n\t\tif (!this.debugB || (this.debug !== true && this.debug !== this.debugB.type)) return;\r\n\t\tconsole.log( `Debug ${this.debugB.type}`, {\r\n\t\t\tdvx: this.physicsObject.vx - this.debugInitialV.vx,\r\n\t\t\tdvy: this.physicsObject.vy - this.debugInitialV.vy,\r\n\t\t})\r\n\t}\r\n\t\r\n\tanimateFrameWithDeltaTime( deltaTime ) {\r\n\t\tif( !deltaTime ) return;\r\n\r\n\t\tlet { physicsObject, behaviors, View } = this\r\n\t\tlet hadMovement = false\r\n\t\tlet coords = View.getTranslation()\r\n\r\n\t\tbehaviors.forEach( behavior => {\r\n\t\t\tthis.debugStart( behavior )\r\n\t\t\tBehaviors[ behavior.type ].doFrame( behavior, deltaTime, physicsObject, coords, View )\r\n\t\t\tthis.debugEnd()\r\n\t\t})\r\n\r\n\t\tlet dx = 0;\r\n\t\tlet {vx,vy} = physicsObject\r\n\t\t\r\n\t\tif ( Math.abs(vx) > ANIMATOR_PAUSE_ZERO_VELOCITY ) {\r\n\t\t\tdx = deltaTime * vx;\r\n\t\t\thadMovement = true;\r\n\t\t}\r\n\r\n\t\tlet dy = 0;\r\n\t\tif ( Math.abs(vy) > ANIMATOR_PAUSE_ZERO_VELOCITY ) {\r\n\t\t\tdy = deltaTime * vy;\r\n\t\t\thadMovement = true;\r\n\t\t}\r\n\t\t\r\n\t\tView.animate( dx, dy )\r\n\r\n\t\tlet cfwnm = hadMovement ? 0 : this.consecutiveFramesWithNoMovement + 1\r\n\t\tthis.consecutiveFramesWithNoMovement = cfwnm\r\n\r\n\t\tif (cfwnm >= ANIMATOR_PAUSE_CONSECUTIVE_FRAMES && !this.isDragging ) {\r\n\t\t\tthis.stopRunning();\r\n\t\t\tthis.animatorListener.onAnimatorPause();\r\n\t\t}\r\n\t}\r\n\r\n\taddBehavior( type, options, isTemp ){\r\n\t\tlet b = Behaviors[ type ]\r\n\t\tif( !b ) return;\r\n\r\n\t\tlet behavior = b.create( options, isTemp )\r\n\t\tlet behaviors = this.behaviors\r\n\t\tlet idx = 0\r\n\r\n\t\twhile (behaviors.length > idx && behaviors[idx].priority <= behavior.priority) {\r\n\t\t\t++idx;\r\n\t\t}\r\n\t\tbehaviors.splice( idx, 0, behavior )\r\n\r\n\t\tthis.ensureRunning()\r\n\t\treturn behavior\r\n\t}\r\n\r\n\tremove( condition ){\r\n\t\tlet behaviors = this.behaviors\r\n\t\tlet i = behaviors.length\r\n\t\twhile( i-- > 0 ){\r\n\t\t\tif( condition(behaviors[i]) ){\r\n\t\t\t\tbehaviors.splice( i, 1 )\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tremoveBehavior( behavior ) {\r\n\t\tthis.remove( target => target === behavior )\r\n\t}\r\n\r\n\tremoveTypeBehaviors( type ){\r\n\t\tthis.remove( target => target.type === type )\r\n\t}\r\n\t\r\n\tremoveTempBehaviors(){\r\n\t\tthis.remove( target => target.isTemp )\r\n\t}\r\n\t\r\n\tgetVelocity(){ \r\n\t\treturn { x: this.physicsObject.vx, y: this.physicsObject.vy }\r\n\t}\r\n\r\n\tensureRunning() {\r\n\t\tthis.isRunning || this.startRunning()\r\n\t}\r\n\r\n\tstartRunning() {\r\n\t\tthis.isRunning = true;\r\n\t\tthis.lastFrameTS = 0;\r\n\t\tthis.consecutiveFramesWithNoMovement = 0;\r\n\t\trequestAnimationFrame( () => this.doFrame( Date.now() ) )\r\n\t}\r\n\r\n\tstopRunning() {\r\n\t\tthis.removeTempBehaviors();\r\n\t\tthis.physicsObject = {vx: 0, vy: 0, mass: this.physicsObject.mass}\r\n\t\tthis.isRunning = false;\r\n\t}\r\n}\r\n\r\nexport default PhysicsAnimator","import React, { Component } from 'react'\nimport PropTypes from 'prop-types'\nimport Animator from './Animator'\nimport Utils from './Utils';\n\nconst propBehaviors = {\n\tfrictionAreas: 'friction',\n\tgravityPoints: 'gravity',\n\tspringPoints: 'spring',\n}\n\nconst isWeb = typeof document !== 'undefined'\n\nexport default function injectDependencies( Animated, PanResponder ){\n\n\treturn class InteractableView extends Component {\n\t\tstatic propTypes = {\n\t\t\tsnapPoints: PropTypes.array,\n\t\t\tfrictionAreas: PropTypes.array,\n\t\t\talertAreas: PropTypes.array,\n\t\t\tgravityPoints: PropTypes.array,\n\t\t\thorizontalOnly: PropTypes.bool,\n\t\t\tverticalOnly: PropTypes.bool,\n\t\t\tdragWithSpring: PropTypes.object,\n\t\t\tdragEnabled: PropTypes.bool,\n\t\t\tanimatedValueX: PropTypes.instanceOf(Animated.Value),\n\t\t\tanimatedValueY: PropTypes.instanceOf(Animated.Value),\n\t\t\tonSnap: PropTypes.func,\n\t\t\tonSnapStart: PropTypes.func,\n\t\t\tonEnd: PropTypes.func,\n\t\t\tonDrag: PropTypes.func,\n\t\t\tboundaries: PropTypes.object,\n\t\t\tinitialPosition: PropTypes.object,\n\t\t\tdragToss: PropTypes.number\n\t\t}\n\n\t\tstatic defaultProps = {\n\t\t\tsnapPoints: [],\n\t\t\tfrictionAreas: [],\n\t\t\talertAreas: [],\n\t\t\tgravityPoints: [],\n\t\t\tboundaries: {},\n\t\t\tinitialPosition: {x: 0, y: 0},\n\t\t\tdragToss: .1,\n\t\t\tdragEnabled: true,\n\t\t\tonSnap: function () { },\n\t\t\tonSnapStart: function () { },\n\t\t\tonStop: function () { },\n\t\t\tonDrag: function () { },\n\t\t\tonAlert: function () { },\n\t\t\tstyle: {}\n\t\t}\n\n\t\tinitialPositionSet = false\n\t\tisDragging = false\n\n\t\tconstructor(props) {\n\t\t\tsuper(props)\n\n\t\t\tlet { x=0, y=0 } = props.initialPosition\n\n\t\t\t// In case animatedValueXY is not given\n\t\t\tthis.animated = new Animated.ValueXY({x, y})\n\n\t\t\t// This guy will apply all the physics\n\t\t\tthis.animator = this.createAnimator( props )\n\n\t\t\t// Cache when the view is inside of an alert area\n\t\t\tthis.insideAlertAreas = {}\n\n\t\t\t// cache calculated areas\n\t\t\tthis.propAreas = {\n\t\t\t\talert: [],\n\t\t\t\tboundaries: false\n\t\t\t}\n\n\t\t\tthis._pr = this.createPanResponder(props)\n\t\t\t\n\t\t\t// Set behaviors and prop defaults\n\t\t\tthis.setPropBehaviours( {}, props )\n\n\t\t\t// Set initial position\n\t\t\tlet animated = this.getAnimated( props )\n\t\t\tanimated.x.setValue( x )\n\t\t\tanimated.y.setValue(y)\n\t\t\tanimated.x._startingValue = x\n\t\t\tanimated.y._startingValue = y\n\t\t\t\n\t\t\t// Save the last animation end position to report good coordinates in the events\n\t\t\tthis.lastEnd = {...this.initialPosition}\n\t\t}\n\n\t\trender() {\n\t\t\tlet { x, y } = this.getAnimated()\n\t\t\tlet style = this.props.style\n\t\t\tlet withPosition = {\n\t\t\t\ttransform: [{ translateX: x }, { translateY: y }].concat( style.transform || [] ),\n\t\t\t\t...style\n\t\t\t}\n\n\t\t\tlet panHandlers = this.props.dragEnabled ? this._pr.panHandlers : {}\n\n\t\t\treturn (\n\t\t\t\t\n\t\t\t\t\t{this.props.children}\n\t\t\t\t\n\t\t\t)\n\t\t}\n\n\t\tgetTranslation(){\n\t\t\tlet {x, y} = this.getAnimated()\n\t\t\treturn {\n\t\t\t\tx: x._value + x._offset,\n\t\t\t\ty: y._value + y._offset\n\t\t\t}\n\t\t}\n\n\t\tsetTranslationX( tx ){\n\t\t\tlet animated = this.props.animatedValueX || this.animated.x\n\t\t\tanimated.setValue( tx - animated._offset )\n\t\t}\n\n\t\tsetTranslationY(ty) {\n\t\t\tlet animated = this.props.animatedValueY || this.animated.y\n\t\t\tanimated.setValue( ty - animated._offset )\n\t\t}\n\n\t\tsetTranslation( tx, ty ){\n\t\t\tthis.setTranslationX( tx )\n\t\t\tthis.setTranslationY( ty )\n\t\t}\n\n\t\tcreateAnimator(){\n\t\t\treturn new Animator( this, {\n\t\t\t\tonAnimatorPause: () => {\n\t\t\t\t\tlet { x, y } = this.getTranslation()\n\t\t\t\t\tthis.lastEnd = {x: Math.round(x), y: Math.round(y)}\n\t\t\t\t\tthis.props.onStop( this.lastEnd )\n\t\t\t\t},\n\t\t\t\tonAnimationFrame: () => {\n\t\t\t\t\tthis.reportAlertEvent( this.getTranslation() )\n\t\t\t\t}\n\t\t\t},\n\t\t\tfalse // Set true or behavior type to output debug info in the console\n\t\t\t)\n\t\t}\n\n\t\tanimate( dx, dy ){\n\t\t\tif(!dx && !dy) return\n\t\t\t// let animated = this.getAnimated()\n\t\t\t// console.log( dx + animated.x._value + animated.x._offset )\n\n\t\t\tlet {x,y} = this.getTranslation()\n\t\t\tthis.setTranslation( x + dx, y + dy ) \n\t\t}\n\n\t\tgetAnimated( props ){\n\t\t\tlet { animatedValueX, animatedValueY } = (props || this.props)\n\n\t\t\treturn {\n\t\t\t\tx: animatedValueX || this.animated.x ,\n\t\t\t\ty: animatedValueY || this.animated.y\n\t\t\t}\n\t\t}\n\n\t\tcreatePanResponder() {\n\t\t\tlet capturer = this.checkResponderCapture.bind(this)\n\t\t\t\n\t\t\treturn PanResponder.create({\n\t\t\t\tonMoveShouldSetResponderCapture: capturer,\n\t\t\t\tonMoveShouldSetPanResponderCapture: capturer,\n\n\t\t\t\tonPanResponderGrant: (e, {x0, y0}) => {\t\n\t\t\t\t\tthis._captured = true;\n\t\t\t\t\tthis.startDrag( {x: x0, y: y0} )\n\t\t\t\t},\n\n\t\t\t\tonPanResponderMove: (e, gesture ) => {\n\t\t\t\t\tthis.onDragging( gesture )\n\t\t\t\t},\n\n\t\t\t\tonPanResponderRelease: () => {\n\t\t\t\t\tthis._captured = false;\n\t\t\t\t\tthis.endDrag()\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\n\t\tcheckResponderCapture( e, gesture ){\n\t\t\treturn this._captured || Math.abs( gesture.dx ) > 5 || Math.abs( gesture.dy ) > 5;\n\t\t}\n\n\t\treportAlertEvent( position ){\n\t\t\tlet inside = this.insideAlertAreas\n\t\t\tlet { onAlert } = this.props\n\n\t\t\tthis.propAreas.alert.forEach( ({ influence, id }) => {\n\t\t\t\tif ( !influence || !id ) return;\n\n\t\t\t\tif ( Utils.isPointInArea( position, influence ) ) {\n\t\t\t\t\tif ( !inside[id] ) {\n\t\t\t\t\t\tonAlert({id, value:\"enter\"});\n\t\t\t\t\t\tinside[id] = 1;\n\t\t\t\t\t}\n\t\t\t\t} else if (inside[id]) {\n\t\t\t\t\tonAlert({ id, value: \"leave\" });\n\t\t\t\t\tinside[id] = 0;\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\n\t\tstartDrag( ev ){\n\t\t\t// Prepare the animated\n\t\t\tlet {x,y} = this.getAnimated()\n\t\t\tlet offset = {x: x._value, y: y._value}\n\t\t\tx.setOffset( offset.x )\n\t\t\ty.setOffset( offset.y )\n\t\t\tx.setValue( 0 )\n\t\t\ty.setValue( 0 )\n\n\t\t\t// Save the offset for triggering events with the right coordinates\n\t\t\tthis.lastEnd = offset\n\t\t\t// console.log( offset )\n\n\t\t\t// Set boundaries to fast access\n\t\t\tthis.dragBoundaries = this.propAreas.boundaries ? this.propAreas.boundaries.influence : {}\n\n\t\t\t// Prepare the animation\n\t\t\tthis.props.onDrag({state: 'start', x: offset.x, y: offset.y})\n\t\t\tthis.dragStartLocation = { x: ev.x, y: ev.y }\n\t\t\tthis.animator.removeTempBehaviors();\n\t\t\tthis.animator.isDragging = true\n\t\t\tthis.animator.vx = 0\n\t\t\tthis.animator.vy = 0\n\t\t\tthis.addTempDragBehavior( this.props.dragWithSpring );\n\n\t\t\t// Stop text selection\n\t\t\tif ( isWeb ) {\n\t\t\t\tlet styles = document.body.style\n\t\t\t\tthis.userSelectCache = styles.userSelect\n\t\t\t\tstyles.userSelect = \"none\"\n\t\t\t}\n\t\t}\n\n\t\tonDragging({dx, dy}){\n\t\t\tif( !this.animator.isDragging ) return false\n\t\t\tif( !this.props.dragEnabled ) return this.endDrag()\n\n\t\t\tlet pos = this.lastEnd\n\t\t\tlet x = dx + pos.x\n\t\t\tlet y = dy + pos.y\n\t\t\t\n\t\t\t// console.log( this.dragBoundaries.minPoint )\n\n\t\t\tlet {minPoint, maxPoint} = this.dragBoundaries\n\t\t\tif( !this.props.verticalOnly ){\n\t\t\t\tif (minPoint) {\n\t\t\t\t\tif (minPoint.x > x) x = minPoint.x\n\t\t\t\t\tif (maxPoint.x < x) x = maxPoint.x\n\t\t\t\t}\n\t\t\t\tthis.dragBehavior.x0 = x\n\t\t\t}\n\n\t\t\tif (!this.props.horizontalOnly) {\n\t\t\t\tif (minPoint) {\n\t\t\t\t\tif (minPoint.y > y) y = minPoint.y\n\t\t\t\t\tif (maxPoint.y < y) y = maxPoint.y\n\t\t\t\t}\n\t\t\t\tthis.dragBehavior.y0 = y\n\t\t\t}\n\n\t\t\t// console.log( this.dragBehavior )\n\t\t}\n\n\t\tendDrag(){\n\t\t\tthis.animator.removeTempBehaviors();\n\t\t\tthis.dragBehavior = null;\n\t\t\tthis.animator.isDragging = false\n\n\t\t\tlet { animator, horizontalOnly, verticalOnly, dragWithSprings } = this\n\n\t\t\tlet velocity = animator.getVelocity();\n\t\t\tif (horizontalOnly) velocity.y = 0;\n\t\t\tif (verticalOnly) velocity.x = 0;\n\t\t\t\n\t\t\tlet toss = (dragWithSprings && dragWithSprings.toss) || this.props.dragToss;\n\t\t\tlet {x,y} = this.getTranslation()\n\t\t\tlet projectedCenter = {\n\t\t\t\tx: x + toss * velocity.x,\n\t\t\t\ty: y + toss * velocity.y\n\t\t\t};\n\n\t\t\t// console.log( 'pc', projectedCenter, velocity)\n\t\t\tlet snapPoint = Utils.findClosest(projectedCenter, this.props.snapPoints);\n\t\t\tlet targetSnapPointId = (snapPoint && snapPoint.id) || \"\";\n\n\t\t\tthis.props.onDrag({ state: 'end', x: x, y: y, targetSnapPointId })\n\n\t\t\tthis.addTempSnapToPointBehavior(snapPoint);\n\t\t\tthis.addTempBoundaries();\n\n\t\t\tlet animated = this.getAnimated()\n\t\t\tanimated.x.flattenOffset()\n\t\t\tanimated.y.flattenOffset()\n\n\t\t\t// Restore text selection\n\t\t\tif ( isWeb ) {\n\t\t\t\tdocument.body.userSelect = this.userSelectCache || ''\n\t\t\t}\n\t\t}\n\n\t\taddTempDragBehavior( drag ) {\n\t\t\tlet pos = this.getTranslation()\n\n\t\t\tif ( !drag || drag.tension === Infinity ) {\n\t\t\t\tthis.dragBehavior = this.animator.addBehavior( 'anchor', pos, true )\n\t\t\t}\n\t\t\telse {\n\t\t\t\tpos.tension = drag.tension || 300\n\t\t\t\tthis.dragBehavior = this.animator.addBehavior( 'spring', pos, true )\n\t\t\t\tif( drag.damping ){\n\t\t\t\t\tthis.animator.addBehavior('friction', drag, true)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\taddTempSnapToPointBehavior( snapPoint ) {\n\t\t\tif (!snapPoint) return;\n\t\t\tlet { snapPoints, onSnap, onSnapStart } = this.props\n\n\t\t\tlet index = snapPoints.indexOf(snapPoint)\n\n\t\t\tonSnap({index, id: snapPoint.id});\n\t\t\tonSnapStart({index, id: snapPoint.id});\n\n\t\t\tlet springOptions = {\n\t\t\t\tdamping: .7,\n\t\t\t\ttension: 300,\n\t\t\t\t...snapPoint\n\t\t\t}\n\n\t\t\tthis.addBehavior( 'spring', springOptions, true )\n\t\t}\n\n\t\tsetVelocity( velocity ) {\n\t\t\tif ( this.dragBehavior ) return;\n\t\t\tthis.animator.physicsObject.vx = velocity.x\n\t\t\tthis.animator.physicsObject.vy = velocity.y\n\t\t\tthis.endDrag();\n\t\t}\n\n\t\tsnapTo( {index} ) {\n\t\t\tlet {snapPoints} = this.props;\n\n\t\t\tif( !snapPoints || index === undefined || index >= snapPoints.length ) return;\n\t\t\t\n\t\t\tthis.animator.removeTempBehaviors();\n\t\t\tthis.dragBehavior = null;\n\t\t\tlet snapPoint = snapPoints[index]\n\n\t\t\tthis.addTempSnapToPointBehavior(snapPoint);\n\t\t\tthis.addTempBoundaries();\n\t\t}\n\n\t\taddTempBoundaries(){\n\t\t\tlet boundaries = this.propAreas.boundaries;\n\t\t\tif( !boundaries ) return;\n\t\t\tthis.animator.addBehavior( 'bounce', boundaries, true );\n\t\t}\n\n\t\tchangePosition( position ) {\n\t\t\tif ( this.dragBehavior ) return;\n\n\t\t\tthis.setTranslation( position.x, position.y )\n\t\t\tthis.endDrag();\n\t\t}\n\n\t\tcomponentDidUpdate( prevProps ){\n\t\t\tthis.setPropBehaviours( prevProps, this.props )\n\t\t}\n\n\t\tsetPropBehaviours( prevProps, props ){\n\t\t\t// spring, gravity, friction\n\t\t\tObject.keys( propBehaviors ).forEach( prop => {\n\t\t\t\tif( prevProps[ prop ] !== props[ prop ] ){\n\t\t\t\t\tthis.animator.removeTypeBehaviors(propBehaviors[prop])\n\t\t\t\t\tthis.addTypeBehaviors( propBehaviors[prop], props[ prop ] )\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tif( prevProps.alertAreas !== props.alertAreas ){\n\t\t\t\tlet alertAreas = []\n\t\t\t\tprops.alertAreas.forEach( area => {\n\t\t\t\t\talertAreas.push({\n\t\t\t\t\t\tid: area.id,\n\t\t\t\t\t\tinfluence: Utils.createArea( area.influenceArea )\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t\tthis.propAreas.alert = alertAreas\n\t\t\t}\n\n\t\t\tif( prevProps.boundaries !== props.boundaries ){\n\t\t\t\tthis.animator.removeBehavior( this.oldBoundariesBehavior )\n\t\t\t\tif( props.boundaries ){\n\t\t\t\t\tlet bounce = {\n\t\t\t\t\t\tbounce: props.boundaries.bounce || 0,\n\t\t\t\t\t\tinfluence: Utils.createArea( props.boundaries )\n\t\t\t\t\t}\n\t\t\t\t\tthis.propAreas.boundaries = bounce\n\t\t\t\t\tthis.oldBoundariesBehavior = this.animator.addBehavior( 'bounce', bounce )\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthis.propAreas.boundaries = false\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (!this.props.dragEnabled && prevProps.dragEnabled && this.dragBehavior ){\n\t\t\t\tthis.endDrag()\n\t\t\t}\n\t\t}\n\n\t\taddTypeBehaviors( type, behaviors, isTemp ){\n\t\t\tbehaviors.forEach( b => this.addBehavior( type, b, isTemp )\t)\n\t\t}\n\n\t\taddBehavior( type, behavior, isTemp ){\n\t\t\tthis.animator.addBehavior( type, behavior, isTemp )\n\t\t\tif( behavior.damping && type !== 'friction' ){\n\t\t\t\tlet b = this.animator.addBehavior('friction', behavior, isTemp )\n\t\t\t\tif( type === 'gravity' && !behavior.influenceArea ){\n\t\t\t\t\tb.influence = Utils.createAreaFromRadius(1.4 * (behavior.falloff || 40), behavior)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import { Animated, PanResponder } from 'react-native'\r\nimport injectDependencies from './InteractableView'\r\n\r\nlet Interactable = injectDependencies(Animated, PanResponder)\r\nexport default { View: Interactable }"],"names":["createArea","boundaries","minPoint","x","undefined","left","Infinity","y","top","maxPoint","right","bottom","createAreaFromRadius","radius","anchor","isPointInArea","area","findClosest","origin","points","minDistance","closestPoint","forEach","point","distance","_this","getDistance","relative","p","r","dx","Math","abs","dy","sqrt","getDelta","def","value","defaultValue","create","options","isTemp","x0","y0","priority","type","doFrame","deltaTime","state","coords","vx","vy","bounce","influence","target","setTranslationX","setTranslationY","friction","damping","Utils","influenceArea","pow","gravity","strength","falloff","dr","a","exp","mass","ax","ay","spring","tension","requestAnimationFrame","Animated","PanResponder","PhysicsAnimator","View","listener","debug","animatorListener","nofn","debugStart","debugEnd","frameTimeMillis","this","isRunning","lastFrameTS","animateFrameWithDeltaTime","onAnimationFrame","Date","now","behavior","debugB","debugInitialV","physicsObject","console","log","dvx","dvy","behaviors","hadMovement","getTranslation","_this2","Behaviors","animate","cfwnm","consecutiveFramesWithNoMovement","isDragging","stopRunning","onAnimatorPause","b","idx","length","splice","ensureRunning","condition","i","remove","startRunning","_this3","removeTempBehaviors","propBehaviors","frictionAreas","gravityPoints","springPoints","isWeb","document","props","initialPosition","animated","ValueXY","animator","createAnimator","insideAlertAreas","propAreas","alert","_pr","createPanResponder","setPropBehaviours","getAnimated","setValue","_startingValue","lastEnd","Component","style","withPosition","transform","translateX","translateY","concat","panHandlers","dragEnabled","React","children","_value","_offset","tx","animatedValueX","ty","animatedValueY","Animator","round","onStop","reportAlertEvent","setTranslation","capturer","checkResponderCapture","bind","onMoveShouldSetResponderCapture","onMoveShouldSetPanResponderCapture","onPanResponderGrant","e","_captured","startDrag","onPanResponderMove","gesture","onDragging","onPanResponderRelease","endDrag","position","inside","onAlert","id","ev","offset","setOffset","dragBoundaries","onDrag","dragStartLocation","addTempDragBehavior","dragWithSpring","styles","body","userSelectCache","userSelect","pos","verticalOnly","dragBehavior","horizontalOnly","dragWithSprings","velocity","getVelocity","toss","dragToss","projectedCenter","snapPoint","snapPoints","targetSnapPointId","addTempSnapToPointBehavior","addTempBoundaries","flattenOffset","drag","addBehavior","onSnap","onSnapStart","index","indexOf","springOptions","prevProps","Object","keys","prop","_this4","removeTypeBehaviors","addTypeBehaviors","alertAreas","push","removeBehavior","oldBoundariesBehavior","_this5","PropTypes","array","bool","object","instanceOf","Value","func","onEnd","number"],"mappings":";;;;;;;i3CAAe,CACdA,WAAY,SAAUC,SACd,CACNC,SAAU,CACTC,OAAuBC,IAApBH,EAAWI,MAAsBC,EAAAA,EAAWL,EAAWI,KAC1DE,OAAsBH,IAAnBH,EAAWO,KAAqB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C,MACtB5G,cAAe2G,EAAUC,MACzBjC,eAAgBgC,EAAUE,KAC1BpC,aAAckC,EAAUE,KACxB1C,eAAgBwC,EAAUG,OAC1BlF,YAAa+E,EAAUE,KACvB3E,eAAgByE,EAAUI,WAAWjK,EAASkK,OAC9C5E,eAAgBuE,EAAUI,WAAWjK,EAASkK,OAC9CtB,OAAQiB,EAAUM,KAClBtB,YAAagB,EAAUM,KACvBC,MAAOP,EAAUM,KACjBjD,OAAQ2C,EAAUM,KAClB5O,WAAYsO,EAAUG,OACtBzG,gBAAiBsG,EAAUG,OAC3B9B,SAAU2B,EAAUQ,4BAGC,CACrBhC,WAAY,GACZpF,cAAe,GACfuG,WAAY,GACZtG,cAAe,GACf3H,WAAY,GACZgI,gBAAiB,CAAC9H,EAAG,EAAGI,EAAG,GAC3BqM,SAAU,GACVpD,aAAa,EACb8D,OAAQ,aACRC,YAAa,aACbpD,OAAQ,aACRyB,OAAQ,aACRN,QAAS,aACTrC,MAAO"} \ No newline at end of file +{"version":3,"file":"interactable.native.min.js","sources":["../playground/src/react-interactable/Utils.js","../playground/src/react-interactable/Behaviors.js","../playground/src/react-interactable/Animator.js","../playground/src/react-interactable/InteractableView.js","../playground/src/react-interactable/native.js"],"sourcesContent":["export default {\r\n\tcreateArea: function( boundaries ){\r\n\t\treturn {\r\n\t\t\tminPoint: {\r\n\t\t\t\tx: boundaries.left === undefined ? -Infinity : boundaries.left,\r\n\t\t\t\ty: boundaries.top === undefined ? -Infinity : boundaries.top\r\n\t\t\t},\r\n\t\t\tmaxPoint: {\r\n\t\t\t\tx: boundaries.right === undefined ? Infinity : boundaries.right,\r\n\t\t\t\ty: boundaries.bottom === undefined ? Infinity : boundaries.bottom\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\tcreateAreaFromRadius: function( radius, anchor ){\r\n\t\treturn {\r\n\t\t\tminPoint: {x: anchor.x - radius, y: anchor.y - radius},\r\n\t\t\tmaxPoint: {x: anchor.x + radius, y: anchor.y + radius}\r\n\t\t}\r\n\t},\r\n\tisPointInArea: function( {x, y}, area ){\r\n\t\tif( !area ) return true\r\n\r\n\t\tlet { minPoint, maxPoint } = area\r\n\r\n\t\treturn x>=minPoint.x && x <= maxPoint.x && y >= minPoint.y && y <= maxPoint.y\r\n\t},\r\n\tfindClosest: function( origin, points ){\r\n\t\tlet minDistance = Infinity;\r\n\t\tlet closestPoint = null;\r\n\t\tlet distances = []\r\n\t\tpoints.forEach( point => {\r\n\t\t\tlet distance = this.getDistance( point, origin );\r\n\t\t\tdistances.push( distance )\r\n\t\t\tif (distance < minDistance) {\r\n\t\t\t\tminDistance = distance;\r\n\t\t\t\tclosestPoint = point;\r\n\t\t\t}\r\n\t\t})\r\n\t\t// console.log( distances )\r\n\t\treturn closestPoint\r\n\t},\r\n\tgetDistance( point, relative ){\r\n\t\tlet p = {x: point.x === undefined ? Infinity : point.x, y: point.y === undefined ? Infinity : point.y }\r\n\t\tlet r = {x: relative.x === undefined ? Infinity : relative.x, y: relative.y === undefined ? Infinity : relative.y }\r\n\t\tif( p.x === Infinity && p.y === Infinity ) return Infinity\r\n\t\tlet dx = p.x === Infinity ? 0 : Math.abs(r.x - p.x)\r\n\t\tlet dy = p.y === Infinity ? 0 : Math.abs(r.y - p.y)\r\n\t\t\r\n\t\treturn Math.sqrt( dx*dx + dy*dy )\r\n\t},\r\n\tgetDelta( point, origin ){\r\n\t\treturn {\r\n\t\t\tx: point.x - origin.x,\r\n\t\t\ty: point.y - origin.y\r\n\t\t}\r\n\t}\r\n}","import Utils from './Utils'\r\n\r\nfunction def( value, defaultValue ){\r\n\treturn value === undefined ? defaultValue : value\r\n}\r\n\r\nexport default {\r\n\tanchor: {\r\n\t\tcreate: (options, isTemp = false) => (\r\n\t\t\t{ x0: options.x, y0: options.y, priority: 1, isTemp, type: 'anchor' }\r\n\t\t),\r\n\t\tdoFrame: (options, deltaTime, state, coords ) => {\r\n\t\t\t// Velocity = dx / deltaTime\r\n\t\t\tstate.vx = (options.x0 - coords.x) / deltaTime\r\n\t\t\tstate.vy = (options.y0 - coords.y) / deltaTime\r\n\t\t}\r\n\t},\r\n\r\n\tbounce: {\r\n\t\tcreate: (options, isTemp = false) => ({\r\n\t\t\ttype: 'bounce',\r\n\t\t\tbounce: def(options.bounce, .5),\r\n\t\t\tminPoint: options.influence.minPoint,\r\n\t\t\tmaxPoint: options.influence.maxPoint,\r\n\t\t\tpriority: 3,\r\n\t\t\tisTemp\r\n\t\t}),\r\n\t\tdoFrame: ({minPoint, maxPoint, bounce}, deltaTime, state, {x,y}, target ) => {\r\n\t\t\t// Apply limits\r\n\r\n\t\t\tif (minPoint.x > x) target.setTranslationX(minPoint.x);\r\n\t\t\tif (minPoint.y > y) target.setTranslationY(minPoint.y);\r\n\t\t\tif (maxPoint.x < x) target.setTranslationX(maxPoint.x);\r\n\t\t\tif (maxPoint.y < y) target.setTranslationY(maxPoint.y);\r\n\r\n\t\t\tlet { vx, vy } = state\r\n\r\n\t\t\tif (minPoint.x > x && vx < 0) {\r\n\t\t\t\tstate.vx = -vx * bounce\r\n\t\t\t}\r\n\t\t\tif (minPoint.y > y && vy < 0) {\r\n\t\t\t\tstate.vy= -vy * bounce\r\n\t\t\t}\r\n\t\t\tif (maxPoint.x < x && vx > 0) {\r\n\t\t\t\tstate.vx = -vx * bounce\r\n\t\t\t}\r\n\t\t\tif (maxPoint.y < y && vy > 0) {\r\n\t\t\t\tstate.vy = -vy * bounce\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\tfriction: {\r\n\t\tcreate: ( options, isTemp = false ) => ({\r\n\t\t\ttype: 'friction',\r\n\t\t\tdamping: def(options.damping, .7),\r\n\t\t\tinfluence: Utils.createArea( options.influenceArea || {} ),\r\n\t\t\tpriority: 2,\r\n\t\t\tisTemp\r\n\t\t}),\r\n\t\tdoFrame: (options, deltaTime, state, coords) => {\r\n\t\t\tif( !Utils.isPointInArea( coords, options.influence) ) return;\r\n\t\t\t\r\n\t\t\tlet pow = Math.pow(options.damping, 60.0 * deltaTime)\r\n\t\t\tstate.vx = pow * state.vx\r\n\t\t\tstate.vy = pow * state.vy\r\n\t\t}\r\n\t},\r\n\r\n\tgravity: {\r\n\t\tcreate: ( options, isTemp = false ) => ({\r\n\t\t\ttype: 'gravity',\r\n\t\t\tx0: def(options.x, Infinity),\r\n\t\t\ty0: def(options.y, Infinity),\r\n\t\t\tstrength: def(options.strength, 400),\r\n\t\t\tfalloff: def(options.falloff, 40),\r\n\t\t\tdamping: def(options.damping, 0),\r\n\t\t\tinfluence: Utils.createArea(options.influenceArea || {}),\r\n\t\t\tisTemp,\r\n\t\t\tpriority: 1\r\n\t\t}),\r\n\t\tdoFrame: (options, deltaTime, state, coords) => {\r\n\t\t\tif( !Utils.isPointInArea( coords, options.influence) ) return;\r\n\r\n\t\t\tlet dx = options.x0 !== Infinity ? coords.x - options.x0 : 0;\r\n\t\t\tlet dy = options.y0 !== Infinity ? coords.y - options.y0 : 0;\r\n\t\t\tlet dr = Math.sqrt(dx * dx + dy * dy);\r\n\r\n\t\t\tif (!dr) return;\r\n\r\n\t\t\tlet { falloff, strength } = options\r\n\t\t\tlet a = (-strength * dr * Math.exp(-0.5 * (dr * dr) / (falloff * falloff))) / state.mass;\r\n\r\n\t\t\tlet ax = dx / dr * a;\r\n\t\t\tlet ay = dy / dr * a;\r\n\r\n\t\t\tstate.vx += deltaTime * ax\r\n\t\t\tstate.vy += deltaTime * ay\r\n\t\t}\r\n\t},\r\n\r\n\tspring: {\r\n\t\tcreate: ( options, isTemp = false ) => ({\r\n\t\t\ttype: 'spring',\r\n\t\t\tx0: def(options.x, 0),\r\n\t\t\ty0: def(options.y, 0),\r\n\t\t\ttension: def(options.tension, 300),\r\n\t\t\tinfluence: Utils.createArea( options.influenceArea || {} ),\r\n\t\t\tisTemp,\r\n\t\t\tpriority: 1\r\n\t\t}),\r\n\t\tdoFrame: ( options, deltaTime, state, coords) => {\r\n\t\t\tif( !Utils.isPointInArea( coords, options.influence) ) return;\r\n\t\r\n\t\t\tlet dx = coords.x - options.x0;\r\n\t\t\tif( dx ){\r\n\t\t\t\t// time * acceleration\r\n\t\t\t\tstate.vx += deltaTime * ((-1 * options.tension * dx) / state.mass)\r\n\t\t\t}\r\n\t\r\n\t\t\tlet dy = coords.y - options.y0;\r\n\t\t\tif( dy ){\r\n\t\t\t\t// time * acceleration\r\n\t\t\t\tstate.vy += deltaTime * ((-1 * options.tension * dy) / state.mass)\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}","import Behaviors from './Behaviors'\r\n\r\nconst ANIMATOR_PAUSE_CONSECUTIVE_FRAMES = 10;\r\nconst ANIMATOR_PAUSE_ZERO_VELOCITY = 1.0;\r\n\r\nif( typeof requestAnimationFrame === 'undefined' ){\r\n\t// We just don't work without raf (maybe we are in the server)\r\n\t// eslint-disable-next-line no-native-reassign\r\n\trequestAnimationFrame = function(){}\r\n}\r\n\r\nclass PhysicsAnimator {\r\n\tbehaviors = []\r\n\tphysicsObject = {vx: 0, vy: 0, mass: 1}\r\n\tconsecutiveFramesWithNoMovement = 0\r\n\tscreenScale = 1\r\n\tlastFrameTS = 0\r\n\tisRunning = false\r\n\tticking = false\r\n\tisDragging = false\r\n\r\n\tconstructor( View, listener, debug ){\r\n\t\tthis.View = View\r\n\t\tthis.animatorListener = listener\r\n\t\tif( !debug ){\r\n\t\t\tlet nofn = function(){}\r\n\t\t\tthis.debugStart = nofn;\r\n\t\t\tthis.debugEnd = nofn;\r\n\t\t}\r\n\t}\r\n\r\n\tdoFrame( frameTimeMillis ) {\r\n\t\tif( !this.isRunning ) return;\r\n\r\n\t\tif ( this.lastFrameTS ) {\r\n\t\t\tthis.animateFrameWithDeltaTime(\r\n\t\t\t\t(frameTimeMillis - this.lastFrameTS) * 1e-3\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\tthis.lastFrameTS = frameTimeMillis;\r\n\t\tthis.animatorListener.onAnimationFrame();\r\n\t\trequestAnimationFrame( () => this.doFrame( Date.now() ) )\r\n\t}\r\n\r\n\tdebugStart( behavior ){\r\n\t\tif( this.debug !== true && this.debug !== behavior.type ) return;\r\n\t\tthis.debugB = behavior\r\n\t\tthis.debugInitialV = {...this.physicsObject}\r\n\t}\r\n\r\n\tdebugEnd() {\r\n\t\tif (!this.debugB || (this.debug !== true && this.debug !== this.debugB.type)) return;\r\n\t\tconsole.log( `Debug ${this.debugB.type}`, {\r\n\t\t\tdvx: this.physicsObject.vx - this.debugInitialV.vx,\r\n\t\t\tdvy: this.physicsObject.vy - this.debugInitialV.vy,\r\n\t\t})\r\n\t}\r\n\t\r\n\tanimateFrameWithDeltaTime( deltaTime ) {\r\n\t\tif( !deltaTime ) return;\r\n\r\n\t\tlet { physicsObject, behaviors, View } = this\r\n\t\tlet hadMovement = false\r\n\t\tlet coords = View.getTranslation()\r\n\r\n\t\tbehaviors.forEach( behavior => {\r\n\t\t\tthis.debugStart( behavior )\r\n\t\t\tBehaviors[ behavior.type ].doFrame( behavior, deltaTime, physicsObject, coords, View )\r\n\t\t\tthis.debugEnd()\r\n\t\t})\r\n\r\n\t\tlet dx = 0;\r\n\t\tlet {vx,vy} = physicsObject\r\n\t\t\r\n\t\tif ( Math.abs(vx) > ANIMATOR_PAUSE_ZERO_VELOCITY ) {\r\n\t\t\tdx = deltaTime * vx;\r\n\t\t\thadMovement = true;\r\n\t\t}\r\n\r\n\t\tlet dy = 0;\r\n\t\tif ( Math.abs(vy) > ANIMATOR_PAUSE_ZERO_VELOCITY ) {\r\n\t\t\tdy = deltaTime * vy;\r\n\t\t\thadMovement = true;\r\n\t\t}\r\n\t\t\r\n\t\tView.animate( dx, dy )\r\n\r\n\t\tlet cfwnm = hadMovement ? 0 : this.consecutiveFramesWithNoMovement + 1\r\n\t\tthis.consecutiveFramesWithNoMovement = cfwnm\r\n\r\n\t\tif (cfwnm >= ANIMATOR_PAUSE_CONSECUTIVE_FRAMES && !this.isDragging ) {\r\n\t\t\tthis.stopRunning();\r\n\t\t\tthis.animatorListener.onAnimatorPause();\r\n\t\t}\r\n\t}\r\n\r\n\taddBehavior( type, options, isTemp ){\r\n\t\tlet b = Behaviors[ type ]\r\n\t\tif( !b ) return;\r\n\r\n\t\tlet behavior = b.create( options, isTemp )\r\n\t\tlet behaviors = this.behaviors\r\n\t\tlet idx = 0\r\n\r\n\t\twhile (behaviors.length > idx && behaviors[idx].priority <= behavior.priority) {\r\n\t\t\t++idx;\r\n\t\t}\r\n\t\tbehaviors.splice( idx, 0, behavior )\r\n\r\n\t\tthis.ensureRunning()\r\n\t\treturn behavior\r\n\t}\r\n\r\n\tremove( condition ){\r\n\t\tlet behaviors = this.behaviors\r\n\t\tlet i = behaviors.length\r\n\t\twhile( i-- > 0 ){\r\n\t\t\tif( condition(behaviors[i]) ){\r\n\t\t\t\tbehaviors.splice( i, 1 )\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tremoveBehavior( behavior ) {\r\n\t\tthis.remove( target => target === behavior )\r\n\t}\r\n\r\n\tremoveTypeBehaviors( type ){\r\n\t\tthis.remove( target => target.type === type )\r\n\t}\r\n\t\r\n\tremoveTempBehaviors(){\r\n\t\tthis.remove( target => target.isTemp )\r\n\t}\r\n\t\r\n\tgetVelocity(){ \r\n\t\treturn { x: this.physicsObject.vx, y: this.physicsObject.vy }\r\n\t}\r\n\r\n\tensureRunning() {\r\n\t\tthis.isRunning || this.startRunning()\r\n\t}\r\n\r\n\tstartRunning() {\r\n\t\tthis.isRunning = true;\r\n\t\tthis.lastFrameTS = 0;\r\n\t\tthis.consecutiveFramesWithNoMovement = 0;\r\n\t\trequestAnimationFrame( () => this.doFrame( Date.now() ) )\r\n\t}\r\n\r\n\tstopRunning() {\r\n\t\tthis.removeTempBehaviors();\r\n\t\tthis.physicsObject = {vx: 0, vy: 0, mass: this.physicsObject.mass}\r\n\t\tthis.isRunning = false;\r\n\t}\r\n}\r\n\r\nexport default PhysicsAnimator","import React, { Component } from 'react'\r\nimport PropTypes from 'prop-types'\r\nimport Animator from './Animator'\r\nimport Utils from './Utils';\r\n\r\nconst propBehaviors = {\r\n\tfrictionAreas: 'friction',\r\n\tgravityPoints: 'gravity',\r\n\tspringPoints: 'spring',\r\n}\r\n\r\nconst isWeb = typeof document !== 'undefined'\r\n\r\nexport default function injectDependencies( Animated, PanResponder ){\r\n\r\n\treturn class InteractableView extends Component {\r\n\t\tstatic propTypes = {\r\n\t\t\tsnapPoints: PropTypes.array,\r\n\t\t\tfrictionAreas: PropTypes.array,\r\n\t\t\talertAreas: PropTypes.array,\r\n\t\t\tgravityPoints: PropTypes.array,\r\n\t\t\thorizontalOnly: PropTypes.bool,\r\n\t\t\tverticalOnly: PropTypes.bool,\r\n\t\t\tdragWithSpring: PropTypes.object,\r\n\t\t\tdragEnabled: PropTypes.bool,\r\n\t\t\tanimatedValueX: PropTypes.instanceOf(Animated.Value),\r\n\t\t\tanimatedValueY: PropTypes.instanceOf(Animated.Value),\r\n\t\t\tonSnap: PropTypes.func,\r\n\t\t\tonSnapStart: PropTypes.func,\r\n\t\t\tonEnd: PropTypes.func,\r\n\t\t\tonDrag: PropTypes.func,\r\n\t\t\tboundaries: PropTypes.object,\r\n\t\t\tinitialPosition: PropTypes.object,\r\n\t\t\tdragToss: PropTypes.number\r\n\t\t}\r\n\r\n\t\tstatic defaultProps = {\r\n\t\t\tsnapPoints: [],\r\n\t\t\tfrictionAreas: [],\r\n\t\t\talertAreas: [],\r\n\t\t\tgravityPoints: [],\r\n\t\t\tboundaries: {},\r\n\t\t\tinitialPosition: {x: 0, y: 0},\r\n\t\t\tdragToss: .1,\r\n\t\t\tdragEnabled: true,\r\n\t\t\tonSnap: function () { },\r\n\t\t\tonSnapStart: function () { },\r\n\t\t\tonStop: function () { },\r\n\t\t\tonDrag: function () { },\r\n\t\t\tonAlert: function () { },\r\n\t\t\tstyle: {}\r\n\t\t}\r\n\r\n\t\tinitialPositionSet = false\r\n\t\tisDragging = false\r\n\r\n\t\tconstructor(props) {\r\n\t\t\tsuper(props)\r\n\r\n\t\t\tlet { x=0, y=0 } = props.initialPosition\r\n\r\n\t\t\t// In case animatedValueXY is not given\r\n\t\t\tthis.animated = new Animated.ValueXY({x, y})\r\n\r\n\t\t\t// This guy will apply all the physics\r\n\t\t\tthis.animator = this.createAnimator( props )\r\n\r\n\t\t\t// Cache when the view is inside of an alert area\r\n\t\t\tthis.insideAlertAreas = {}\r\n\r\n\t\t\t// cache calculated areas\r\n\t\t\tthis.propAreas = {\r\n\t\t\t\talert: [],\r\n\t\t\t\tboundaries: false\r\n\t\t\t}\r\n\r\n\t\t\tthis._pr = this.createPanResponder(props)\r\n\t\t\t\r\n\t\t\t// Set behaviors and prop defaults\r\n\t\t\tthis.setPropBehaviours( {}, props )\r\n\r\n\t\t\t// Set initial position\r\n\t\t\tlet animated = this.getAnimated( props )\r\n\t\t\tanimated.x.setValue( x )\r\n\t\t\tanimated.y.setValue(y)\r\n\t\t\tanimated.x._startingValue = x\r\n\t\t\tanimated.y._startingValue = y\r\n\t\t\t\r\n\t\t\t// Save the last animation end position to report good coordinates in the events\r\n\t\t\tthis.lastEnd = {...this.initialPosition}\r\n\t\t}\r\n\r\n\t\trender() {\r\n\t\t\tlet { x, y } = this.getAnimated()\r\n\t\t\tlet style = this.props.style\r\n\t\t\tlet withPosition = {\r\n\t\t\t\ttransform: [{ translateX: x }, { translateY: y }].concat( style.transform || [] ),\r\n\t\t\t\t...style\r\n\t\t\t}\r\n\r\n\t\t\tlet panHandlers = this.props.dragEnabled ? this._pr.panHandlers : {}\r\n\r\n\t\t\treturn (\r\n\t\t\t\t\r\n\t\t\t\t\t{this.props.children}\r\n\t\t\t\t\r\n\t\t\t)\r\n\t\t}\r\n\r\n\t\tgetTranslation(){\r\n\t\t\tlet {x, y} = this.getAnimated()\r\n\t\t\treturn {\r\n\t\t\t\tx: x._value + x._offset,\r\n\t\t\t\ty: y._value + y._offset\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tsetTranslationX( tx ){\r\n\t\t\tlet animated = this.props.animatedValueX || this.animated.x\r\n\t\t\tanimated.setValue( tx - animated._offset )\r\n\t\t}\r\n\r\n\t\tsetTranslationY(ty) {\r\n\t\t\tlet animated = this.props.animatedValueY || this.animated.y\r\n\t\t\tanimated.setValue( ty - animated._offset )\r\n\t\t}\r\n\r\n\t\tsetTranslation( tx, ty ){\r\n\t\t\tthis.setTranslationX( tx )\r\n\t\t\tthis.setTranslationY( ty )\r\n\t\t}\r\n\r\n\t\tcreateAnimator(){\r\n\t\t\treturn new Animator( this, {\r\n\t\t\t\tonAnimatorPause: () => {\r\n\t\t\t\t\tlet { x, y } = this.getTranslation()\r\n\t\t\t\t\tthis.lastEnd = {x: Math.round(x), y: Math.round(y)}\r\n\t\t\t\t\tthis.props.onStop( this.lastEnd )\r\n\t\t\t\t},\r\n\t\t\t\tonAnimationFrame: () => {\r\n\t\t\t\t\tthis.reportAlertEvent( this.getTranslation() )\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tfalse // Set true or behavior type to output debug info in the console\r\n\t\t\t)\r\n\t\t}\r\n\r\n\t\tanimate( dx, dy ){\r\n\t\t\tif(!dx && !dy) return\r\n\t\t\t// let animated = this.getAnimated()\r\n\t\t\t// console.log( dx + animated.x._value + animated.x._offset )\r\n\r\n\t\t\tlet {x,y} = this.getTranslation()\r\n\t\t\tthis.setTranslation( x + dx, y + dy ) \r\n\t\t}\r\n\r\n\t\tgetAnimated( props ){\r\n\t\t\tlet { animatedValueX, animatedValueY } = (props || this.props)\r\n\r\n\t\t\treturn {\r\n\t\t\t\tx: animatedValueX || this.animated.x ,\r\n\t\t\t\ty: animatedValueY || this.animated.y\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tcreatePanResponder() {\r\n\t\t\tlet capturer = this.checkResponderCapture.bind(this)\r\n\t\t\t\r\n\t\t\treturn PanResponder.create({\r\n\t\t\t\tonMoveShouldSetResponderCapture: capturer,\r\n\t\t\t\tonMoveShouldSetPanResponderCapture: capturer,\r\n\r\n\t\t\t\tonPanResponderGrant: (e, {x0, y0}) => {\t\r\n\t\t\t\t\tthis._captured = true;\r\n\t\t\t\t\tthis.startDrag( {x: x0, y: y0} )\r\n\t\t\t\t},\r\n\r\n\t\t\t\tonPanResponderMove: (e, gesture ) => {\r\n\t\t\t\t\tthis.onDragging( gesture )\r\n\t\t\t\t},\r\n\r\n\t\t\t\tonPanResponderRelease: () => {\r\n\t\t\t\t\tthis._captured = false;\r\n\t\t\t\t\tthis.endDrag()\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t}\r\n\r\n\t\tcheckResponderCapture( e, gesture ){\r\n\t\t\treturn this._captured || Math.abs( gesture.dx ) > 5 || Math.abs( gesture.dy ) > 5;\r\n\t\t}\r\n\r\n\t\treportAlertEvent( position ){\r\n\t\t\tlet inside = this.insideAlertAreas\r\n\t\t\tlet { onAlert } = this.props\r\n\r\n\t\t\tthis.propAreas.alert.forEach( ({ influence, id }) => {\r\n\t\t\t\tif ( !influence || !id ) return;\r\n\r\n\t\t\t\tif ( Utils.isPointInArea( position, influence ) ) {\r\n\t\t\t\t\tif ( !inside[id] ) {\r\n\t\t\t\t\t\tonAlert({id, value:\"enter\"});\r\n\t\t\t\t\t\tinside[id] = 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t} else if (inside[id]) {\r\n\t\t\t\t\tonAlert({ id, value: \"leave\" });\r\n\t\t\t\t\tinside[id] = 0;\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t}\r\n\r\n\t\tstartDrag( ev ){\r\n\t\t\t// Prepare the animated\r\n\t\t\tlet {x,y} = this.getAnimated()\r\n\t\t\tlet offset = {x: x._value, y: y._value}\r\n\t\t\tx.setOffset( offset.x )\r\n\t\t\ty.setOffset( offset.y )\r\n\t\t\tx.setValue( 0 )\r\n\t\t\ty.setValue( 0 )\r\n\r\n\t\t\t// Save the offset for triggering events with the right coordinates\r\n\t\t\tthis.lastEnd = offset\r\n\t\t\t// console.log( offset )\r\n\r\n\t\t\t// Set boundaries to fast access\r\n\t\t\tthis.dragBoundaries = this.propAreas.boundaries ? this.propAreas.boundaries.influence : {}\r\n\r\n\t\t\t// Prepare the animation\r\n\t\t\tthis.props.onDrag({state: 'start', x: offset.x, y: offset.y})\r\n\t\t\tthis.dragStartLocation = { x: ev.x, y: ev.y }\r\n\t\t\tthis.animator.removeTempBehaviors();\r\n\t\t\tthis.animator.isDragging = true\r\n\t\t\tthis.animator.vx = 0\r\n\t\t\tthis.animator.vy = 0\r\n\t\t\tthis.addTempDragBehavior( this.props.dragWithSpring );\r\n\r\n\t\t\t// Stop text selection\r\n\t\t\tif ( isWeb ) {\r\n\t\t\t\tlet styles = document.body.style\r\n\t\t\t\tthis.userSelectCache = styles.userSelect\r\n\t\t\t\tstyles.userSelect = \"none\"\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tonDragging({dx, dy}){\r\n\t\t\tif( !this.animator.isDragging ) return false\r\n\t\t\tif( !this.props.dragEnabled ) return this.endDrag()\r\n\r\n\t\t\tlet pos = this.lastEnd\r\n\t\t\tlet x = dx + pos.x\r\n\t\t\tlet y = dy + pos.y\r\n\t\t\t\r\n\t\t\t// console.log( this.dragBoundaries.minPoint )\r\n\r\n\t\t\tlet {minPoint, maxPoint} = this.dragBoundaries\r\n\t\t\tif( !this.props.verticalOnly ){\r\n\t\t\t\tif (minPoint) {\r\n\t\t\t\t\tif (minPoint.x > x) x = minPoint.x\r\n\t\t\t\t\tif (maxPoint.x < x) x = maxPoint.x\r\n\t\t\t\t}\r\n\t\t\t\tthis.dragBehavior.x0 = x\r\n\t\t\t}\r\n\r\n\t\t\tif (!this.props.horizontalOnly) {\r\n\t\t\t\tif (minPoint) {\r\n\t\t\t\t\tif (minPoint.y > y) y = minPoint.y\r\n\t\t\t\t\tif (maxPoint.y < y) y = maxPoint.y\r\n\t\t\t\t}\r\n\t\t\t\tthis.dragBehavior.y0 = y\r\n\t\t\t}\r\n\r\n\t\t\t// console.log( this.dragBehavior )\r\n\t\t}\r\n\r\n\t\tendDrag(){\r\n\t\t\tthis.animator.removeTempBehaviors();\r\n\t\t\tthis.dragBehavior = null;\r\n\t\t\tthis.animator.isDragging = false\r\n\r\n\t\t\tlet { animator, horizontalOnly, verticalOnly, dragWithSprings } = this\r\n\r\n\t\t\tlet velocity = animator.getVelocity();\r\n\t\t\tif (horizontalOnly) velocity.y = 0;\r\n\t\t\tif (verticalOnly) velocity.x = 0;\r\n\t\t\t\r\n\t\t\tlet toss = (dragWithSprings && dragWithSprings.toss) || this.props.dragToss;\r\n\t\t\tlet {x,y} = this.getTranslation()\r\n\t\t\tlet projectedCenter = {\r\n\t\t\t\tx: x + toss * velocity.x,\r\n\t\t\t\ty: y + toss * velocity.y\r\n\t\t\t};\r\n\r\n\t\t\t// console.log( 'pc', projectedCenter, velocity)\r\n\t\t\tlet snapPoint = Utils.findClosest(projectedCenter, this.props.snapPoints);\r\n\t\t\tlet targetSnapPointId = (snapPoint && snapPoint.id) || \"\";\r\n\r\n\t\t\tthis.props.onDrag({ state: 'end', x: x, y: y, targetSnapPointId })\r\n\r\n\t\t\tthis.addTempSnapToPointBehavior(snapPoint);\r\n\t\t\tthis.addTempBoundaries();\r\n\r\n\t\t\tlet animated = this.getAnimated()\r\n\t\t\tanimated.x.flattenOffset()\r\n\t\t\tanimated.y.flattenOffset()\r\n\r\n\t\t\t// Restore text selection\r\n\t\t\tif ( isWeb ) {\r\n\t\t\t\tdocument.body.style.userSelect = this.userSelectCache || ''\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\taddTempDragBehavior( drag ) {\r\n\t\t\tlet pos = this.getTranslation()\r\n\r\n\t\t\tif ( !drag || drag.tension === Infinity ) {\r\n\t\t\t\tthis.dragBehavior = this.animator.addBehavior( 'anchor', pos, true )\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tpos.tension = drag.tension || 300\r\n\t\t\t\tthis.dragBehavior = this.animator.addBehavior( 'spring', pos, true )\r\n\t\t\t\tif( drag.damping ){\r\n\t\t\t\t\tthis.animator.addBehavior('friction', drag, true)\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\taddTempSnapToPointBehavior( snapPoint ) {\r\n\t\t\tif (!snapPoint) return;\r\n\t\t\tlet { snapPoints, onSnap, onSnapStart } = this.props\r\n\r\n\t\t\tlet index = snapPoints.indexOf(snapPoint)\r\n\r\n\t\t\tonSnap({index, id: snapPoint.id});\r\n\t\t\tonSnapStart({index, id: snapPoint.id});\r\n\r\n\t\t\tlet springOptions = {\r\n\t\t\t\tdamping: .7,\r\n\t\t\t\ttension: 300,\r\n\t\t\t\t...snapPoint\r\n\t\t\t}\r\n\r\n\t\t\tthis.addBehavior( 'spring', springOptions, true )\r\n\t\t}\r\n\r\n\t\tsetVelocity( velocity ) {\r\n\t\t\tif ( this.dragBehavior ) return;\r\n\t\t\tthis.animator.physicsObject.vx = velocity.x\r\n\t\t\tthis.animator.physicsObject.vy = velocity.y\r\n\t\t\tthis.endDrag();\r\n\t\t}\r\n\r\n\t\tsnapTo( {index} ) {\r\n\t\t\tlet {snapPoints} = this.props;\r\n\r\n\t\t\tif( !snapPoints || index === undefined || index >= snapPoints.length ) return;\r\n\t\t\t\r\n\t\t\tthis.animator.removeTempBehaviors();\r\n\t\t\tthis.dragBehavior = null;\r\n\t\t\tlet snapPoint = snapPoints[index]\r\n\r\n\t\t\tthis.addTempSnapToPointBehavior(snapPoint);\r\n\t\t\tthis.addTempBoundaries();\r\n\t\t}\r\n\r\n\t\taddTempBoundaries(){\r\n\t\t\tlet boundaries = this.propAreas.boundaries;\r\n\t\t\tif( !boundaries ) return;\r\n\t\t\tthis.animator.addBehavior( 'bounce', boundaries, true );\r\n\t\t}\r\n\r\n\t\tchangePosition( position ) {\r\n\t\t\tif ( this.dragBehavior ) return;\r\n\r\n\t\t\tthis.setTranslation( position.x, position.y )\r\n\t\t\tthis.endDrag();\r\n\t\t}\r\n\r\n\t\tcomponentDidUpdate( prevProps ){\r\n\t\t\tthis.setPropBehaviours( prevProps, this.props )\r\n\t\t}\r\n\r\n\t\tsetPropBehaviours( prevProps, props ){\r\n\t\t\t// spring, gravity, friction\r\n\t\t\tObject.keys( propBehaviors ).forEach( prop => {\r\n\t\t\t\tif( prevProps[ prop ] !== props[ prop ] ){\r\n\t\t\t\t\tthis.animator.removeTypeBehaviors(propBehaviors[prop])\r\n\t\t\t\t\tthis.addTypeBehaviors( propBehaviors[prop], props[ prop ] )\r\n\t\t\t\t}\r\n\t\t\t})\r\n\r\n\t\t\tif( prevProps.alertAreas !== props.alertAreas ){\r\n\t\t\t\tlet alertAreas = []\r\n\t\t\t\tprops.alertAreas.forEach( area => {\r\n\t\t\t\t\talertAreas.push({\r\n\t\t\t\t\t\tid: area.id,\r\n\t\t\t\t\t\tinfluence: Utils.createArea( area.influenceArea )\r\n\t\t\t\t\t})\r\n\t\t\t\t})\r\n\t\t\t\tthis.propAreas.alert = alertAreas\r\n\t\t\t}\r\n\r\n\t\t\tif( prevProps.boundaries !== props.boundaries ){\r\n\t\t\t\tthis.animator.removeBehavior( this.oldBoundariesBehavior )\r\n\t\t\t\tif( props.boundaries ){\r\n\t\t\t\t\tlet bounce = {\r\n\t\t\t\t\t\tbounce: props.boundaries.bounce || 0,\r\n\t\t\t\t\t\tinfluence: Utils.createArea( props.boundaries )\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.propAreas.boundaries = bounce\r\n\t\t\t\t\tthis.oldBoundariesBehavior = this.animator.addBehavior( 'bounce', bounce )\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tthis.propAreas.boundaries = false\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif (!this.props.dragEnabled && prevProps.dragEnabled && this.dragBehavior ){\r\n\t\t\t\tthis.endDrag()\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\taddTypeBehaviors( type, behaviors, isTemp ){\r\n\t\t\tbehaviors.forEach( b => this.addBehavior( type, b, isTemp )\t)\r\n\t\t}\r\n\r\n\t\taddBehavior( type, behavior, isTemp ){\r\n\t\t\tthis.animator.addBehavior( type, behavior, isTemp )\r\n\t\t\tif( behavior.damping && type !== 'friction' ){\r\n\t\t\t\tlet b = this.animator.addBehavior('friction', behavior, isTemp )\r\n\t\t\t\tif( type === 'gravity' && !behavior.influenceArea ){\r\n\t\t\t\t\tb.influence = Utils.createAreaFromRadius(1.4 * (behavior.falloff || 40), behavior)\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n","import { Animated, PanResponder } from 'react-native'\r\nimport injectDependencies from './InteractableView'\r\n\r\nlet Interactable = injectDependencies(Animated, PanResponder)\r\nexport default { View: Interactable }"],"names":["createArea","boundaries","minPoint","x","undefined","left","Infinity","y","top","maxPoint","right","bottom","createAreaFromRadius","radius","anchor","isPointInArea","area","findClosest","origin","points","minDistance","closestPoint","forEach","point","distance","_this","getDistance","relative","p","r","dx","Math","abs","dy","sqrt","getDelta","def","value","defaultValue","create","options","isTemp","x0","y0","priority","type","doFrame","deltaTime","state","coords","vx","vy","bounce","influence","target","setTranslationX","setTranslationY","friction","damping","Utils","influenceArea","pow","gravity","strength","falloff","dr","a","exp","mass","ax","ay","spring","tension","requestAnimationFrame","Animated","PanResponder","PhysicsAnimator","View","listener","debug","animatorListener","nofn","debugStart","debugEnd","frameTimeMillis","this","isRunning","lastFrameTS","animateFrameWithDeltaTime","onAnimationFrame","Date","now","behavior","debugB","debugInitialV","physicsObject","console","log","dvx","dvy","behaviors","hadMovement","getTranslation","_this2","Behaviors","animate","cfwnm","consecutiveFramesWithNoMovement","isDragging","stopRunning","onAnimatorPause","b","idx","length","splice","ensureRunning","condition","i","remove","startRunning","_this3","removeTempBehaviors","propBehaviors","frictionAreas","gravityPoints","springPoints","isWeb","document","props","initialPosition","animated","ValueXY","animator","createAnimator","insideAlertAreas","propAreas","alert","_pr","createPanResponder","setPropBehaviours","getAnimated","setValue","_startingValue","lastEnd","Component","style","withPosition","transform","translateX","translateY","concat","panHandlers","dragEnabled","React","children","_value","_offset","tx","animatedValueX","ty","animatedValueY","Animator","round","onStop","reportAlertEvent","setTranslation","capturer","checkResponderCapture","bind","onMoveShouldSetResponderCapture","onMoveShouldSetPanResponderCapture","onPanResponderGrant","e","_captured","startDrag","onPanResponderMove","gesture","onDragging","onPanResponderRelease","endDrag","position","inside","onAlert","id","ev","offset","setOffset","dragBoundaries","onDrag","dragStartLocation","addTempDragBehavior","dragWithSpring","styles","body","userSelectCache","userSelect","pos","verticalOnly","dragBehavior","horizontalOnly","dragWithSprings","velocity","getVelocity","toss","dragToss","projectedCenter","snapPoint","snapPoints","targetSnapPointId","addTempSnapToPointBehavior","addTempBoundaries","flattenOffset","drag","addBehavior","onSnap","onSnapStart","index","indexOf","springOptions","prevProps","Object","keys","prop","_this4","removeTypeBehaviors","addTypeBehaviors","alertAreas","push","removeBehavior","oldBoundariesBehavior","_this5","PropTypes","array","bool","object","instanceOf","Value","func","onEnd","number"],"mappings":";;;;;;;i3CAAe,CACdA,WAAY,SAAUC,SACd,CACNC,SAAU,CACTC,OAAuBC,IAApBH,EAAWI,MAAsBC,EAAAA,EAAWL,EAAWI,KAC1DE,OAAsBH,IAAnBH,EAAWO,KAAqBF,EAAAA,EAAWL,EAAWO,KAE1DC,SAAU,CACTN,OAAwBC,IAArBH,EAAWS,MAAsBJ,EAAAA,EAAWL,EAAWS,MAC1DH,OAAyBH,IAAtBH,EAAWU,OAAuBL,EAAAA,EAAWL,EAAWU,UAI9DC,qBAAsB,SAAUC,EAAQC,SAChC,CACNZ,SAAU,CAACC,EAAGW,EAAOX,EAAIU,EAAQN,EAAGO,EAAOP,EAAIM,GAC/CJ,SAAU,CAACN,EAAGW,EAAOX,EAAIU,EAAQN,EAAGO,EAAOP,EAAIM,KAGjDE,cAAe,WAAkBC,OAAPb,IAAAA,EAAGI,IAAAA,MACvBS,EAAO,OAAO,MAEbd,EAAuBc,EAAvBd,SAAUO,EAAaO,EAAbP,gBAETN,GAAGD,EAASC,GAAKA,GAAKM,EAASN,GAAKI,GAAKL,EA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,SAAU,GACVpD,aAAa,EACb8D,OAAQ,aACRC,YAAa,aACbpD,OAAQ,aACRyB,OAAQ,aACRN,QAAS,aACTrC,MAAO"} \ No newline at end of file diff --git a/dist/interactable.noNative.js b/dist/interactable.noNative.js index 1b1c8d2..7e6194d 100644 --- a/dist/interactable.noNative.js +++ b/dist/interactable.noNative.js @@ -1,7 +1,7 @@ /*! * *//* eslint-disable */ /*! - * react-interactable v0.6.5 + * react-interactable v0.6.6 * (c) 2019-present Javier Marquez * Released under the MIT License. */ @@ -882,7 +882,7 @@ animated.y.flattenOffset(); // Restore text selection if (isWeb) { - document.body.userSelect = this.userSelectCache || ''; + document.body.style.userSelect = this.userSelectCache || ''; } } }, { diff --git a/dist/interactable.noNative.js.map b/dist/interactable.noNative.js.map index 29c09a3..618e447 100644 --- a/dist/interactable.noNative.js.map +++ b/dist/interactable.noNative.js.map @@ -1 +1 @@ -{"version":3,"file":"interactable.noNative.js","sources":["../playground/src/react-interactable/Utils.js","../playground/src/react-interactable/Behaviors.js","../playground/src/react-interactable/Animator.js","../playground/src/react-interactable/InteractableView.js","../playground/src/react-interactable/AnimatedView.js","../playground/src/react-interactable/noNative.js"],"sourcesContent":["export default {\r\n\tcreateArea: function( boundaries ){\r\n\t\treturn {\r\n\t\t\tminPoint: {\r\n\t\t\t\tx: boundaries.left === undefined ? -Infinity : boundaries.left,\r\n\t\t\t\ty: boundaries.top === undefined ? -Infinity : boundaries.top\r\n\t\t\t},\r\n\t\t\tmaxPoint: {\r\n\t\t\t\tx: boundaries.right === undefined ? Infinity : boundaries.right,\r\n\t\t\t\ty: boundaries.bottom === undefined ? Infinity : boundaries.bottom\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\tcreateAreaFromRadius: function( radius, anchor ){\r\n\t\treturn {\r\n\t\t\tminPoint: {x: anchor.x - radius, y: anchor.y - radius},\r\n\t\t\tmaxPoint: {x: anchor.x + radius, y: anchor.y + radius}\r\n\t\t}\r\n\t},\r\n\tisPointInArea: function( {x, y}, area ){\r\n\t\tif( !area ) return true\r\n\r\n\t\tlet { minPoint, maxPoint } = area\r\n\r\n\t\treturn x>=minPoint.x && x <= maxPoint.x && y >= minPoint.y && y <= maxPoint.y\r\n\t},\r\n\tfindClosest: function( origin, points ){\r\n\t\tlet minDistance = Infinity;\r\n\t\tlet closestPoint = null;\r\n\t\tlet distances = []\r\n\t\tpoints.forEach( point => {\r\n\t\t\tlet distance = this.getDistance( point, origin );\r\n\t\t\tdistances.push( distance )\r\n\t\t\tif (distance < minDistance) {\r\n\t\t\t\tminDistance = distance;\r\n\t\t\t\tclosestPoint = point;\r\n\t\t\t}\r\n\t\t})\r\n\t\t// console.log( distances )\r\n\t\treturn closestPoint\r\n\t},\r\n\tgetDistance( point, relative ){\r\n\t\tlet p = {x: point.x === undefined ? Infinity : point.x, y: point.y === undefined ? Infinity : point.y }\r\n\t\tlet r = {x: relative.x === undefined ? Infinity : relative.x, y: relative.y === undefined ? Infinity : relative.y }\r\n\t\tif( p.x === Infinity && p.y === Infinity ) return Infinity\r\n\t\tlet dx = p.x === Infinity ? 0 : Math.abs(r.x - p.x)\r\n\t\tlet dy = p.y === Infinity ? 0 : Math.abs(r.y - p.y)\r\n\t\t\r\n\t\treturn Math.sqrt( dx*dx + dy*dy )\r\n\t},\r\n\tgetDelta( point, origin ){\r\n\t\treturn {\r\n\t\t\tx: point.x - origin.x,\r\n\t\t\ty: point.y - origin.y\r\n\t\t}\r\n\t}\r\n}","import Utils from './Utils'\r\n\r\nfunction def( value, defaultValue ){\r\n\treturn value === undefined ? defaultValue : value\r\n}\r\n\r\nexport default {\r\n\tanchor: {\r\n\t\tcreate: (options, isTemp = false) => (\r\n\t\t\t{ x0: options.x, y0: options.y, priority: 1, isTemp, type: 'anchor' }\r\n\t\t),\r\n\t\tdoFrame: (options, deltaTime, state, coords ) => {\r\n\t\t\t// Velocity = dx / deltaTime\r\n\t\t\tstate.vx = (options.x0 - coords.x) / deltaTime\r\n\t\t\tstate.vy = (options.y0 - coords.y) / deltaTime\r\n\t\t}\r\n\t},\r\n\r\n\tbounce: {\r\n\t\tcreate: (options, isTemp = false) => ({\r\n\t\t\ttype: 'bounce',\r\n\t\t\tbounce: def(options.bounce, .5),\r\n\t\t\tminPoint: options.influence.minPoint,\r\n\t\t\tmaxPoint: options.influence.maxPoint,\r\n\t\t\tpriority: 3,\r\n\t\t\tisTemp\r\n\t\t}),\r\n\t\tdoFrame: ({minPoint, maxPoint, bounce}, deltaTime, state, {x,y}, target ) => {\r\n\t\t\t// Apply limits\r\n\r\n\t\t\tif (minPoint.x > x) target.setTranslationX(minPoint.x);\r\n\t\t\tif (minPoint.y > y) target.setTranslationY(minPoint.y);\r\n\t\t\tif (maxPoint.x < x) target.setTranslationX(maxPoint.x);\r\n\t\t\tif (maxPoint.y < y) target.setTranslationY(maxPoint.y);\r\n\r\n\t\t\tlet { vx, vy } = state\r\n\r\n\t\t\tif (minPoint.x > x && vx < 0) {\r\n\t\t\t\tstate.vx = -vx * bounce\r\n\t\t\t}\r\n\t\t\tif (minPoint.y > y && vy < 0) {\r\n\t\t\t\tstate.vy= -vy * bounce\r\n\t\t\t}\r\n\t\t\tif (maxPoint.x < x && vx > 0) {\r\n\t\t\t\tstate.vx = -vx * bounce\r\n\t\t\t}\r\n\t\t\tif (maxPoint.y < y && vy > 0) {\r\n\t\t\t\tstate.vy = -vy * bounce\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\tfriction: {\r\n\t\tcreate: ( options, isTemp = false ) => ({\r\n\t\t\ttype: 'friction',\r\n\t\t\tdamping: def(options.damping, .7),\r\n\t\t\tinfluence: Utils.createArea( options.influenceArea || {} ),\r\n\t\t\tpriority: 2,\r\n\t\t\tisTemp\r\n\t\t}),\r\n\t\tdoFrame: (options, deltaTime, state, coords) => {\r\n\t\t\tif( !Utils.isPointInArea( coords, options.influence) ) return;\r\n\t\t\t\r\n\t\t\tlet pow = Math.pow(options.damping, 60.0 * deltaTime)\r\n\t\t\tstate.vx = pow * state.vx\r\n\t\t\tstate.vy = pow * state.vy\r\n\t\t}\r\n\t},\r\n\r\n\tgravity: {\r\n\t\tcreate: ( options, isTemp = false ) => ({\r\n\t\t\ttype: 'gravity',\r\n\t\t\tx0: def(options.x, Infinity),\r\n\t\t\ty0: def(options.y, Infinity),\r\n\t\t\tstrength: def(options.strength, 400),\r\n\t\t\tfalloff: def(options.falloff, 40),\r\n\t\t\tdamping: def(options.damping, 0),\r\n\t\t\tinfluence: Utils.createArea(options.influenceArea || {}),\r\n\t\t\tisTemp,\r\n\t\t\tpriority: 1\r\n\t\t}),\r\n\t\tdoFrame: (options, deltaTime, state, coords) => {\r\n\t\t\tif( !Utils.isPointInArea( coords, options.influence) ) return;\r\n\r\n\t\t\tlet dx = options.x0 !== Infinity ? coords.x - options.x0 : 0;\r\n\t\t\tlet dy = options.y0 !== Infinity ? coords.y - options.y0 : 0;\r\n\t\t\tlet dr = Math.sqrt(dx * dx + dy * dy);\r\n\r\n\t\t\tif (!dr) return;\r\n\r\n\t\t\tlet { falloff, strength } = options\r\n\t\t\tlet a = (-strength * dr * Math.exp(-0.5 * (dr * dr) / (falloff * falloff))) / state.mass;\r\n\r\n\t\t\tlet ax = dx / dr * a;\r\n\t\t\tlet ay = dy / dr * a;\r\n\r\n\t\t\tstate.vx += deltaTime * ax\r\n\t\t\tstate.vy += deltaTime * ay\r\n\t\t}\r\n\t},\r\n\r\n\tspring: {\r\n\t\tcreate: ( options, isTemp = false ) => ({\r\n\t\t\ttype: 'spring',\r\n\t\t\tx0: def(options.x, 0),\r\n\t\t\ty0: def(options.y, 0),\r\n\t\t\ttension: def(options.tension, 300),\r\n\t\t\tinfluence: Utils.createArea( options.influenceArea || {} ),\r\n\t\t\tisTemp,\r\n\t\t\tpriority: 1\r\n\t\t}),\r\n\t\tdoFrame: ( options, deltaTime, state, coords) => {\r\n\t\t\tif( !Utils.isPointInArea( coords, options.influence) ) return;\r\n\t\r\n\t\t\tlet dx = coords.x - options.x0;\r\n\t\t\tif( dx ){\r\n\t\t\t\t// time * acceleration\r\n\t\t\t\tstate.vx += deltaTime * ((-1 * options.tension * dx) / state.mass)\r\n\t\t\t}\r\n\t\r\n\t\t\tlet dy = coords.y - options.y0;\r\n\t\t\tif( dy ){\r\n\t\t\t\t// time * acceleration\r\n\t\t\t\tstate.vy += deltaTime * ((-1 * options.tension * dy) / state.mass)\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}","import Behaviors from './Behaviors'\r\n\r\nconst ANIMATOR_PAUSE_CONSECUTIVE_FRAMES = 10;\r\nconst ANIMATOR_PAUSE_ZERO_VELOCITY = 1.0;\r\n\r\nif( typeof requestAnimationFrame === 'undefined' ){\r\n\t// We just don't work without raf (maybe we are in the server)\r\n\t// eslint-disable-next-line no-native-reassign\r\n\trequestAnimationFrame = function(){}\r\n}\r\n\r\nclass PhysicsAnimator {\r\n\tbehaviors = []\r\n\tphysicsObject = {vx: 0, vy: 0, mass: 1}\r\n\tconsecutiveFramesWithNoMovement = 0\r\n\tscreenScale = 1\r\n\tlastFrameTS = 0\r\n\tisRunning = false\r\n\tticking = false\r\n\tisDragging = false\r\n\r\n\tconstructor( View, listener, debug ){\r\n\t\tthis.View = View\r\n\t\tthis.animatorListener = listener\r\n\t\tif( !debug ){\r\n\t\t\tlet nofn = function(){}\r\n\t\t\tthis.debugStart = nofn;\r\n\t\t\tthis.debugEnd = nofn;\r\n\t\t}\r\n\t}\r\n\r\n\tdoFrame( frameTimeMillis ) {\r\n\t\tif( !this.isRunning ) return;\r\n\r\n\t\tif ( this.lastFrameTS ) {\r\n\t\t\tthis.animateFrameWithDeltaTime(\r\n\t\t\t\t(frameTimeMillis - this.lastFrameTS) * 1e-3\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\tthis.lastFrameTS = frameTimeMillis;\r\n\t\tthis.animatorListener.onAnimationFrame();\r\n\t\trequestAnimationFrame( () => this.doFrame( Date.now() ) )\r\n\t}\r\n\r\n\tdebugStart( behavior ){\r\n\t\tif( this.debug !== true && this.debug !== behavior.type ) return;\r\n\t\tthis.debugB = behavior\r\n\t\tthis.debugInitialV = {...this.physicsObject}\r\n\t}\r\n\r\n\tdebugEnd() {\r\n\t\tif (!this.debugB || (this.debug !== true && this.debug !== this.debugB.type)) return;\r\n\t\tconsole.log( `Debug ${this.debugB.type}`, {\r\n\t\t\tdvx: this.physicsObject.vx - this.debugInitialV.vx,\r\n\t\t\tdvy: this.physicsObject.vy - this.debugInitialV.vy,\r\n\t\t})\r\n\t}\r\n\t\r\n\tanimateFrameWithDeltaTime( deltaTime ) {\r\n\t\tif( !deltaTime ) return;\r\n\r\n\t\tlet { physicsObject, behaviors, View } = this\r\n\t\tlet hadMovement = false\r\n\t\tlet coords = View.getTranslation()\r\n\r\n\t\tbehaviors.forEach( behavior => {\r\n\t\t\tthis.debugStart( behavior )\r\n\t\t\tBehaviors[ behavior.type ].doFrame( behavior, deltaTime, physicsObject, coords, View )\r\n\t\t\tthis.debugEnd()\r\n\t\t})\r\n\r\n\t\tlet dx = 0;\r\n\t\tlet {vx,vy} = physicsObject\r\n\t\t\r\n\t\tif ( Math.abs(vx) > ANIMATOR_PAUSE_ZERO_VELOCITY ) {\r\n\t\t\tdx = deltaTime * vx;\r\n\t\t\thadMovement = true;\r\n\t\t}\r\n\r\n\t\tlet dy = 0;\r\n\t\tif ( Math.abs(vy) > ANIMATOR_PAUSE_ZERO_VELOCITY ) {\r\n\t\t\tdy = deltaTime * vy;\r\n\t\t\thadMovement = true;\r\n\t\t}\r\n\t\t\r\n\t\tView.animate( dx, dy )\r\n\r\n\t\tlet cfwnm = hadMovement ? 0 : this.consecutiveFramesWithNoMovement + 1\r\n\t\tthis.consecutiveFramesWithNoMovement = cfwnm\r\n\r\n\t\tif (cfwnm >= ANIMATOR_PAUSE_CONSECUTIVE_FRAMES && !this.isDragging ) {\r\n\t\t\tthis.stopRunning();\r\n\t\t\tthis.animatorListener.onAnimatorPause();\r\n\t\t}\r\n\t}\r\n\r\n\taddBehavior( type, options, isTemp ){\r\n\t\tlet b = Behaviors[ type ]\r\n\t\tif( !b ) return;\r\n\r\n\t\tlet behavior = b.create( options, isTemp )\r\n\t\tlet behaviors = this.behaviors\r\n\t\tlet idx = 0\r\n\r\n\t\twhile (behaviors.length > idx && behaviors[idx].priority <= behavior.priority) {\r\n\t\t\t++idx;\r\n\t\t}\r\n\t\tbehaviors.splice( idx, 0, behavior )\r\n\r\n\t\tthis.ensureRunning()\r\n\t\treturn behavior\r\n\t}\r\n\r\n\tremove( condition ){\r\n\t\tlet behaviors = this.behaviors\r\n\t\tlet i = behaviors.length\r\n\t\twhile( i-- > 0 ){\r\n\t\t\tif( condition(behaviors[i]) ){\r\n\t\t\t\tbehaviors.splice( i, 1 )\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tremoveBehavior( behavior ) {\r\n\t\tthis.remove( target => target === behavior )\r\n\t}\r\n\r\n\tremoveTypeBehaviors( type ){\r\n\t\tthis.remove( target => target.type === type )\r\n\t}\r\n\t\r\n\tremoveTempBehaviors(){\r\n\t\tthis.remove( target => target.isTemp )\r\n\t}\r\n\t\r\n\tgetVelocity(){ \r\n\t\treturn { x: this.physicsObject.vx, y: this.physicsObject.vy }\r\n\t}\r\n\r\n\tensureRunning() {\r\n\t\tthis.isRunning || this.startRunning()\r\n\t}\r\n\r\n\tstartRunning() {\r\n\t\tthis.isRunning = true;\r\n\t\tthis.lastFrameTS = 0;\r\n\t\tthis.consecutiveFramesWithNoMovement = 0;\r\n\t\trequestAnimationFrame( () => this.doFrame( Date.now() ) )\r\n\t}\r\n\r\n\tstopRunning() {\r\n\t\tthis.removeTempBehaviors();\r\n\t\tthis.physicsObject = {vx: 0, vy: 0, mass: this.physicsObject.mass}\r\n\t\tthis.isRunning = false;\r\n\t}\r\n}\r\n\r\nexport default PhysicsAnimator","import React, { Component } from 'react'\nimport PropTypes from 'prop-types'\nimport Animator from './Animator'\nimport Utils from './Utils';\n\nconst propBehaviors = {\n\tfrictionAreas: 'friction',\n\tgravityPoints: 'gravity',\n\tspringPoints: 'spring',\n}\n\nconst isWeb = typeof document !== 'undefined'\n\nexport default function injectDependencies( Animated, PanResponder ){\n\n\treturn class InteractableView extends Component {\n\t\tstatic propTypes = {\n\t\t\tsnapPoints: PropTypes.array,\n\t\t\tfrictionAreas: PropTypes.array,\n\t\t\talertAreas: PropTypes.array,\n\t\t\tgravityPoints: PropTypes.array,\n\t\t\thorizontalOnly: PropTypes.bool,\n\t\t\tverticalOnly: PropTypes.bool,\n\t\t\tdragWithSpring: PropTypes.object,\n\t\t\tdragEnabled: PropTypes.bool,\n\t\t\tanimatedValueX: PropTypes.instanceOf(Animated.Value),\n\t\t\tanimatedValueY: PropTypes.instanceOf(Animated.Value),\n\t\t\tonSnap: PropTypes.func,\n\t\t\tonSnapStart: PropTypes.func,\n\t\t\tonEnd: PropTypes.func,\n\t\t\tonDrag: PropTypes.func,\n\t\t\tboundaries: PropTypes.object,\n\t\t\tinitialPosition: PropTypes.object,\n\t\t\tdragToss: PropTypes.number\n\t\t}\n\n\t\tstatic defaultProps = {\n\t\t\tsnapPoints: [],\n\t\t\tfrictionAreas: [],\n\t\t\talertAreas: [],\n\t\t\tgravityPoints: [],\n\t\t\tboundaries: {},\n\t\t\tinitialPosition: {x: 0, y: 0},\n\t\t\tdragToss: .1,\n\t\t\tdragEnabled: true,\n\t\t\tonSnap: function () { },\n\t\t\tonSnapStart: function () { },\n\t\t\tonStop: function () { },\n\t\t\tonDrag: function () { },\n\t\t\tonAlert: function () { },\n\t\t\tstyle: {}\n\t\t}\n\n\t\tinitialPositionSet = false\n\t\tisDragging = false\n\n\t\tconstructor(props) {\n\t\t\tsuper(props)\n\n\t\t\tlet { x=0, y=0 } = props.initialPosition\n\n\t\t\t// In case animatedValueXY is not given\n\t\t\tthis.animated = new Animated.ValueXY({x, y})\n\n\t\t\t// This guy will apply all the physics\n\t\t\tthis.animator = this.createAnimator( props )\n\n\t\t\t// Cache when the view is inside of an alert area\n\t\t\tthis.insideAlertAreas = {}\n\n\t\t\t// cache calculated areas\n\t\t\tthis.propAreas = {\n\t\t\t\talert: [],\n\t\t\t\tboundaries: false\n\t\t\t}\n\n\t\t\tthis._pr = this.createPanResponder(props)\n\t\t\t\n\t\t\t// Set behaviors and prop defaults\n\t\t\tthis.setPropBehaviours( {}, props )\n\n\t\t\t// Set initial position\n\t\t\tlet animated = this.getAnimated( props )\n\t\t\tanimated.x.setValue( x )\n\t\t\tanimated.y.setValue(y)\n\t\t\tanimated.x._startingValue = x\n\t\t\tanimated.y._startingValue = y\n\t\t\t\n\t\t\t// Save the last animation end position to report good coordinates in the events\n\t\t\tthis.lastEnd = {...this.initialPosition}\n\t\t}\n\n\t\trender() {\n\t\t\tlet { x, y } = this.getAnimated()\n\t\t\tlet style = this.props.style\n\t\t\tlet withPosition = {\n\t\t\t\ttransform: [{ translateX: x }, { translateY: y }].concat( style.transform || [] ),\n\t\t\t\t...style\n\t\t\t}\n\n\t\t\tlet panHandlers = this.props.dragEnabled ? this._pr.panHandlers : {}\n\n\t\t\treturn (\n\t\t\t\t\n\t\t\t\t\t{this.props.children}\n\t\t\t\t\n\t\t\t)\n\t\t}\n\n\t\tgetTranslation(){\n\t\t\tlet {x, y} = this.getAnimated()\n\t\t\treturn {\n\t\t\t\tx: x._value + x._offset,\n\t\t\t\ty: y._value + y._offset\n\t\t\t}\n\t\t}\n\n\t\tsetTranslationX( tx ){\n\t\t\tlet animated = this.props.animatedValueX || this.animated.x\n\t\t\tanimated.setValue( tx - animated._offset )\n\t\t}\n\n\t\tsetTranslationY(ty) {\n\t\t\tlet animated = this.props.animatedValueY || this.animated.y\n\t\t\tanimated.setValue( ty - animated._offset )\n\t\t}\n\n\t\tsetTranslation( tx, ty ){\n\t\t\tthis.setTranslationX( tx )\n\t\t\tthis.setTranslationY( ty )\n\t\t}\n\n\t\tcreateAnimator(){\n\t\t\treturn new Animator( this, {\n\t\t\t\tonAnimatorPause: () => {\n\t\t\t\t\tlet { x, y } = this.getTranslation()\n\t\t\t\t\tthis.lastEnd = {x: Math.round(x), y: Math.round(y)}\n\t\t\t\t\tthis.props.onStop( this.lastEnd )\n\t\t\t\t},\n\t\t\t\tonAnimationFrame: () => {\n\t\t\t\t\tthis.reportAlertEvent( this.getTranslation() )\n\t\t\t\t}\n\t\t\t},\n\t\t\tfalse // Set true or behavior type to output debug info in the console\n\t\t\t)\n\t\t}\n\n\t\tanimate( dx, dy ){\n\t\t\tif(!dx && !dy) return\n\t\t\t// let animated = this.getAnimated()\n\t\t\t// console.log( dx + animated.x._value + animated.x._offset )\n\n\t\t\tlet {x,y} = this.getTranslation()\n\t\t\tthis.setTranslation( x + dx, y + dy ) \n\t\t}\n\n\t\tgetAnimated( props ){\n\t\t\tlet { animatedValueX, animatedValueY } = (props || this.props)\n\n\t\t\treturn {\n\t\t\t\tx: animatedValueX || this.animated.x ,\n\t\t\t\ty: animatedValueY || this.animated.y\n\t\t\t}\n\t\t}\n\n\t\tcreatePanResponder() {\n\t\t\tlet capturer = this.checkResponderCapture.bind(this)\n\t\t\t\n\t\t\treturn PanResponder.create({\n\t\t\t\tonMoveShouldSetResponderCapture: capturer,\n\t\t\t\tonMoveShouldSetPanResponderCapture: capturer,\n\n\t\t\t\tonPanResponderGrant: (e, {x0, y0}) => {\t\n\t\t\t\t\tthis._captured = true;\n\t\t\t\t\tthis.startDrag( {x: x0, y: y0} )\n\t\t\t\t},\n\n\t\t\t\tonPanResponderMove: (e, gesture ) => {\n\t\t\t\t\tthis.onDragging( gesture )\n\t\t\t\t},\n\n\t\t\t\tonPanResponderRelease: () => {\n\t\t\t\t\tthis._captured = false;\n\t\t\t\t\tthis.endDrag()\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\n\t\tcheckResponderCapture( e, gesture ){\n\t\t\treturn this._captured || Math.abs( gesture.dx ) > 5 || Math.abs( gesture.dy ) > 5;\n\t\t}\n\n\t\treportAlertEvent( position ){\n\t\t\tlet inside = this.insideAlertAreas\n\t\t\tlet { onAlert } = this.props\n\n\t\t\tthis.propAreas.alert.forEach( ({ influence, id }) => {\n\t\t\t\tif ( !influence || !id ) return;\n\n\t\t\t\tif ( Utils.isPointInArea( position, influence ) ) {\n\t\t\t\t\tif ( !inside[id] ) {\n\t\t\t\t\t\tonAlert({id, value:\"enter\"});\n\t\t\t\t\t\tinside[id] = 1;\n\t\t\t\t\t}\n\t\t\t\t} else if (inside[id]) {\n\t\t\t\t\tonAlert({ id, value: \"leave\" });\n\t\t\t\t\tinside[id] = 0;\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\n\t\tstartDrag( ev ){\n\t\t\t// Prepare the animated\n\t\t\tlet {x,y} = this.getAnimated()\n\t\t\tlet offset = {x: x._value, y: y._value}\n\t\t\tx.setOffset( offset.x )\n\t\t\ty.setOffset( offset.y )\n\t\t\tx.setValue( 0 )\n\t\t\ty.setValue( 0 )\n\n\t\t\t// Save the offset for triggering events with the right coordinates\n\t\t\tthis.lastEnd = offset\n\t\t\t// console.log( offset )\n\n\t\t\t// Set boundaries to fast access\n\t\t\tthis.dragBoundaries = this.propAreas.boundaries ? this.propAreas.boundaries.influence : {}\n\n\t\t\t// Prepare the animation\n\t\t\tthis.props.onDrag({state: 'start', x: offset.x, y: offset.y})\n\t\t\tthis.dragStartLocation = { x: ev.x, y: ev.y }\n\t\t\tthis.animator.removeTempBehaviors();\n\t\t\tthis.animator.isDragging = true\n\t\t\tthis.animator.vx = 0\n\t\t\tthis.animator.vy = 0\n\t\t\tthis.addTempDragBehavior( this.props.dragWithSpring );\n\n\t\t\t// Stop text selection\n\t\t\tif ( isWeb ) {\n\t\t\t\tlet styles = document.body.style\n\t\t\t\tthis.userSelectCache = styles.userSelect\n\t\t\t\tstyles.userSelect = \"none\"\n\t\t\t}\n\t\t}\n\n\t\tonDragging({dx, dy}){\n\t\t\tif( !this.animator.isDragging ) return false\n\t\t\tif( !this.props.dragEnabled ) return this.endDrag()\n\n\t\t\tlet pos = this.lastEnd\n\t\t\tlet x = dx + pos.x\n\t\t\tlet y = dy + pos.y\n\t\t\t\n\t\t\t// console.log( this.dragBoundaries.minPoint )\n\n\t\t\tlet {minPoint, maxPoint} = this.dragBoundaries\n\t\t\tif( !this.props.verticalOnly ){\n\t\t\t\tif (minPoint) {\n\t\t\t\t\tif (minPoint.x > x) x = minPoint.x\n\t\t\t\t\tif (maxPoint.x < x) x = maxPoint.x\n\t\t\t\t}\n\t\t\t\tthis.dragBehavior.x0 = x\n\t\t\t}\n\n\t\t\tif (!this.props.horizontalOnly) {\n\t\t\t\tif (minPoint) {\n\t\t\t\t\tif (minPoint.y > y) y = minPoint.y\n\t\t\t\t\tif (maxPoint.y < y) y = maxPoint.y\n\t\t\t\t}\n\t\t\t\tthis.dragBehavior.y0 = y\n\t\t\t}\n\n\t\t\t// console.log( this.dragBehavior )\n\t\t}\n\n\t\tendDrag(){\n\t\t\tthis.animator.removeTempBehaviors();\n\t\t\tthis.dragBehavior = null;\n\t\t\tthis.animator.isDragging = false\n\n\t\t\tlet { animator, horizontalOnly, verticalOnly, dragWithSprings } = this\n\n\t\t\tlet velocity = animator.getVelocity();\n\t\t\tif (horizontalOnly) velocity.y = 0;\n\t\t\tif (verticalOnly) velocity.x = 0;\n\t\t\t\n\t\t\tlet toss = (dragWithSprings && dragWithSprings.toss) || this.props.dragToss;\n\t\t\tlet {x,y} = this.getTranslation()\n\t\t\tlet projectedCenter = {\n\t\t\t\tx: x + toss * velocity.x,\n\t\t\t\ty: y + toss * velocity.y\n\t\t\t};\n\n\t\t\t// console.log( 'pc', projectedCenter, velocity)\n\t\t\tlet snapPoint = Utils.findClosest(projectedCenter, this.props.snapPoints);\n\t\t\tlet targetSnapPointId = (snapPoint && snapPoint.id) || \"\";\n\n\t\t\tthis.props.onDrag({ state: 'end', x: x, y: y, targetSnapPointId })\n\n\t\t\tthis.addTempSnapToPointBehavior(snapPoint);\n\t\t\tthis.addTempBoundaries();\n\n\t\t\tlet animated = this.getAnimated()\n\t\t\tanimated.x.flattenOffset()\n\t\t\tanimated.y.flattenOffset()\n\n\t\t\t// Restore text selection\n\t\t\tif ( isWeb ) {\n\t\t\t\tdocument.body.userSelect = this.userSelectCache || ''\n\t\t\t}\n\t\t}\n\n\t\taddTempDragBehavior( drag ) {\n\t\t\tlet pos = this.getTranslation()\n\n\t\t\tif ( !drag || drag.tension === Infinity ) {\n\t\t\t\tthis.dragBehavior = this.animator.addBehavior( 'anchor', pos, true )\n\t\t\t}\n\t\t\telse {\n\t\t\t\tpos.tension = drag.tension || 300\n\t\t\t\tthis.dragBehavior = this.animator.addBehavior( 'spring', pos, true )\n\t\t\t\tif( drag.damping ){\n\t\t\t\t\tthis.animator.addBehavior('friction', drag, true)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\taddTempSnapToPointBehavior( snapPoint ) {\n\t\t\tif (!snapPoint) return;\n\t\t\tlet { snapPoints, onSnap, onSnapStart } = this.props\n\n\t\t\tlet index = snapPoints.indexOf(snapPoint)\n\n\t\t\tonSnap({index, id: snapPoint.id});\n\t\t\tonSnapStart({index, id: snapPoint.id});\n\n\t\t\tlet springOptions = {\n\t\t\t\tdamping: .7,\n\t\t\t\ttension: 300,\n\t\t\t\t...snapPoint\n\t\t\t}\n\n\t\t\tthis.addBehavior( 'spring', springOptions, true )\n\t\t}\n\n\t\tsetVelocity( velocity ) {\n\t\t\tif ( this.dragBehavior ) return;\n\t\t\tthis.animator.physicsObject.vx = velocity.x\n\t\t\tthis.animator.physicsObject.vy = velocity.y\n\t\t\tthis.endDrag();\n\t\t}\n\n\t\tsnapTo( {index} ) {\n\t\t\tlet {snapPoints} = this.props;\n\n\t\t\tif( !snapPoints || index === undefined || index >= snapPoints.length ) return;\n\t\t\t\n\t\t\tthis.animator.removeTempBehaviors();\n\t\t\tthis.dragBehavior = null;\n\t\t\tlet snapPoint = snapPoints[index]\n\n\t\t\tthis.addTempSnapToPointBehavior(snapPoint);\n\t\t\tthis.addTempBoundaries();\n\t\t}\n\n\t\taddTempBoundaries(){\n\t\t\tlet boundaries = this.propAreas.boundaries;\n\t\t\tif( !boundaries ) return;\n\t\t\tthis.animator.addBehavior( 'bounce', boundaries, true );\n\t\t}\n\n\t\tchangePosition( position ) {\n\t\t\tif ( this.dragBehavior ) return;\n\n\t\t\tthis.setTranslation( position.x, position.y )\n\t\t\tthis.endDrag();\n\t\t}\n\n\t\tcomponentDidUpdate( prevProps ){\n\t\t\tthis.setPropBehaviours( prevProps, this.props )\n\t\t}\n\n\t\tsetPropBehaviours( prevProps, props ){\n\t\t\t// spring, gravity, friction\n\t\t\tObject.keys( propBehaviors ).forEach( prop => {\n\t\t\t\tif( prevProps[ prop ] !== props[ prop ] ){\n\t\t\t\t\tthis.animator.removeTypeBehaviors(propBehaviors[prop])\n\t\t\t\t\tthis.addTypeBehaviors( propBehaviors[prop], props[ prop ] )\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tif( prevProps.alertAreas !== props.alertAreas ){\n\t\t\t\tlet alertAreas = []\n\t\t\t\tprops.alertAreas.forEach( area => {\n\t\t\t\t\talertAreas.push({\n\t\t\t\t\t\tid: area.id,\n\t\t\t\t\t\tinfluence: Utils.createArea( area.influenceArea )\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t\tthis.propAreas.alert = alertAreas\n\t\t\t}\n\n\t\t\tif( prevProps.boundaries !== props.boundaries ){\n\t\t\t\tthis.animator.removeBehavior( this.oldBoundariesBehavior )\n\t\t\t\tif( props.boundaries ){\n\t\t\t\t\tlet bounce = {\n\t\t\t\t\t\tbounce: props.boundaries.bounce || 0,\n\t\t\t\t\t\tinfluence: Utils.createArea( props.boundaries )\n\t\t\t\t\t}\n\t\t\t\t\tthis.propAreas.boundaries = bounce\n\t\t\t\t\tthis.oldBoundariesBehavior = this.animator.addBehavior( 'bounce', bounce )\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthis.propAreas.boundaries = false\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (!this.props.dragEnabled && prevProps.dragEnabled && this.dragBehavior ){\n\t\t\t\tthis.endDrag()\n\t\t\t}\n\t\t}\n\n\t\taddTypeBehaviors( type, behaviors, isTemp ){\n\t\t\tbehaviors.forEach( b => this.addBehavior( type, b, isTemp )\t)\n\t\t}\n\n\t\taddBehavior( type, behavior, isTemp ){\n\t\t\tthis.animator.addBehavior( type, behavior, isTemp )\n\t\t\tif( behavior.damping && type !== 'friction' ){\n\t\t\t\tlet b = this.animator.addBehavior('friction', behavior, isTemp )\n\t\t\t\tif( type === 'gravity' && !behavior.influenceArea ){\n\t\t\t\t\tb.influence = Utils.createAreaFromRadius(1.4 * (behavior.falloff || 40), behavior)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import React from 'react'\r\nimport Animated from 'animated/lib/targets/react-dom'\r\n\r\nexport default function AnimatedView(props) {\r\n let propStyles = props.style || {}\r\n let style = { position: 'relative', display: 'flex', ...propStyles}\r\n\r\n return (\r\n \r\n {props.children}\r\n \r\n )\r\n}","import Animated from 'animated/lib/targets/react-dom'\nimport PanResponder from 'react-panresponder-web'\nimport injectDependencies from './InteractableView'\nimport AnimatedView from './AnimatedView'\n\n// Fake the Animated.View component\nAnimated.View = AnimatedView\n\nlet Interactable = injectDependencies( Animated, PanResponder ) \nexport default {View: Interactable}"],"names":["createArea","boundaries","minPoint","x","left","undefined","Infinity","y","top","maxPoint","right","bottom","createAreaFromRadius","radius","anchor","isPointInArea","area","findClosest","origin","points","minDistance","closestPoint","forEach","point","distance","getDistance","relative","p","r","dx","Math","abs","dy","sqrt","getDelta","def","value","defaultValue","create","options","isTemp","x0","y0","priority","type","doFrame","deltaTime","state","coords","vx","vy","bounce","influence","target","setTranslationX","setTranslationY","friction","damping","Utils","influenceArea","pow","gravity","strength","falloff","dr","a","exp","mass","ax","ay","spring","tension","ANIMATOR_PAUSE_CONSECUTIVE_FRAMES","ANIMATOR_PAUSE_ZERO_VELOCITY","requestAnimationFrame","PhysicsAnimator","View","listener","debug","animatorListener","nofn","debugStart","debugEnd","frameTimeMillis","isRunning","lastFrameTS","animateFrameWithDeltaTime","onAnimationFrame","Date","now","behavior","debugB","debugInitialV","physicsObject","console","log","dvx","dvy","behaviors","hadMovement","getTranslation","Behaviors","animate","cfwnm","consecutiveFramesWithNoMovement","isDragging","stopRunning","onAnimatorPause","b","idx","length","splice","ensureRunning","condition","i","remove","startRunning","removeTempBehaviors","propBehaviors","frictionAreas","gravityPoints","springPoints","isWeb","document","injectDependencies","Animated","PanResponder","props","initialPosition","animated","ValueXY","animator","createAnimator","insideAlertAreas","propAreas","alert","_pr","createPanResponder","setPropBehaviours","getAnimated","setValue","_startingValue","lastEnd","style","withPosition","transform","translateX","translateY","concat","panHandlers","dragEnabled","React","children","_value","_offset","tx","animatedValueX","ty","animatedValueY","Animator","round","onStop","reportAlertEvent","setTranslation","capturer","checkResponderCapture","bind","onMoveShouldSetResponderCapture","onMoveShouldSetPanResponderCapture","onPanResponderGrant","e","_captured","startDrag","onPanResponderMove","gesture","onDragging","onPanResponderRelease","endDrag","position","inside","onAlert","id","ev","offset","setOffset","dragBoundaries","onDrag","dragStartLocation","addTempDragBehavior","dragWithSpring","styles","body","userSelectCache","userSelect","pos","verticalOnly","dragBehavior","horizontalOnly","dragWithSprings","velocity","getVelocity","toss","dragToss","projectedCenter","snapPoint","snapPoints","targetSnapPointId","addTempSnapToPointBehavior","addTempBoundaries","flattenOffset","drag","addBehavior","onSnap","onSnapStart","index","indexOf","springOptions","prevProps","Object","keys","prop","removeTypeBehaviors","addTypeBehaviors","alertAreas","push","removeBehavior","oldBoundariesBehavior","Component","PropTypes","array","bool","object","instanceOf","Value","func","onEnd","number","AnimatedView","propStyles","display","Interactable"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,cAAe;EACdA,EAAAA,UAAU,EAAE,oBAAUC,UAAV,EAAsB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V,eAAkBxB,KAAlB;EAAyB,IAAA,KAAK,EAAEgB;EAAhC,MACGhB,KAAK,CAACyB,QADT,CADF;EAKD;;ECND3B,QAAQ,CAACjD,IAAT,GAAgBiK,YAAhB;EAEA,IAAIG,YAAY,GAAGpH,kBAAkB,CAAEC,QAAF,EAAYC,YAAZ,CAArC;AACA,iBAAe;EAAClD,EAAAA,IAAI,EAAEoK;EAAP,CAAf;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"interactable.noNative.js","sources":["../playground/src/react-interactable/Utils.js","../playground/src/react-interactable/Behaviors.js","../playground/src/react-interactable/Animator.js","../playground/src/react-interactable/InteractableView.js","../playground/src/react-interactable/AnimatedView.js","../playground/src/react-interactable/noNative.js"],"sourcesContent":["export default {\r\n\tcreateArea: function( boundaries ){\r\n\t\treturn {\r\n\t\t\tminPoint: {\r\n\t\t\t\tx: boundaries.left === undefined ? -Infinity : boundaries.left,\r\n\t\t\t\ty: boundaries.top === undefined ? -Infinity : boundaries.top\r\n\t\t\t},\r\n\t\t\tmaxPoint: {\r\n\t\t\t\tx: boundaries.right === undefined ? Infinity : boundaries.right,\r\n\t\t\t\ty: boundaries.bottom === undefined ? Infinity : boundaries.bottom\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\tcreateAreaFromRadius: function( radius, anchor ){\r\n\t\treturn {\r\n\t\t\tminPoint: {x: anchor.x - radius, y: anchor.y - radius},\r\n\t\t\tmaxPoint: {x: anchor.x + radius, y: anchor.y + radius}\r\n\t\t}\r\n\t},\r\n\tisPointInArea: function( {x, y}, area ){\r\n\t\tif( !area ) return true\r\n\r\n\t\tlet { minPoint, maxPoint } = area\r\n\r\n\t\treturn x>=minPoint.x && x <= maxPoint.x && y >= minPoint.y && y <= maxPoint.y\r\n\t},\r\n\tfindClosest: function( origin, points ){\r\n\t\tlet minDistance = Infinity;\r\n\t\tlet closestPoint = null;\r\n\t\tlet distances = []\r\n\t\tpoints.forEach( point => {\r\n\t\t\tlet distance = this.getDistance( point, origin );\r\n\t\t\tdistances.push( distance )\r\n\t\t\tif (distance < minDistance) {\r\n\t\t\t\tminDistance = distance;\r\n\t\t\t\tclosestPoint = point;\r\n\t\t\t}\r\n\t\t})\r\n\t\t// console.log( distances )\r\n\t\treturn closestPoint\r\n\t},\r\n\tgetDistance( point, relative ){\r\n\t\tlet p = {x: point.x === undefined ? Infinity : point.x, y: point.y === undefined ? Infinity : point.y }\r\n\t\tlet r = {x: relative.x === undefined ? Infinity : relative.x, y: relative.y === undefined ? Infinity : relative.y }\r\n\t\tif( p.x === Infinity && p.y === Infinity ) return Infinity\r\n\t\tlet dx = p.x === Infinity ? 0 : Math.abs(r.x - p.x)\r\n\t\tlet dy = p.y === Infinity ? 0 : Math.abs(r.y - p.y)\r\n\t\t\r\n\t\treturn Math.sqrt( dx*dx + dy*dy )\r\n\t},\r\n\tgetDelta( point, origin ){\r\n\t\treturn {\r\n\t\t\tx: point.x - origin.x,\r\n\t\t\ty: point.y - origin.y\r\n\t\t}\r\n\t}\r\n}","import Utils from './Utils'\r\n\r\nfunction def( value, defaultValue ){\r\n\treturn value === undefined ? defaultValue : value\r\n}\r\n\r\nexport default {\r\n\tanchor: {\r\n\t\tcreate: (options, isTemp = false) => (\r\n\t\t\t{ x0: options.x, y0: options.y, priority: 1, isTemp, type: 'anchor' }\r\n\t\t),\r\n\t\tdoFrame: (options, deltaTime, state, coords ) => {\r\n\t\t\t// Velocity = dx / deltaTime\r\n\t\t\tstate.vx = (options.x0 - coords.x) / deltaTime\r\n\t\t\tstate.vy = (options.y0 - coords.y) / deltaTime\r\n\t\t}\r\n\t},\r\n\r\n\tbounce: {\r\n\t\tcreate: (options, isTemp = false) => ({\r\n\t\t\ttype: 'bounce',\r\n\t\t\tbounce: def(options.bounce, .5),\r\n\t\t\tminPoint: options.influence.minPoint,\r\n\t\t\tmaxPoint: options.influence.maxPoint,\r\n\t\t\tpriority: 3,\r\n\t\t\tisTemp\r\n\t\t}),\r\n\t\tdoFrame: ({minPoint, maxPoint, bounce}, deltaTime, state, {x,y}, target ) => {\r\n\t\t\t// Apply limits\r\n\r\n\t\t\tif (minPoint.x > x) target.setTranslationX(minPoint.x);\r\n\t\t\tif (minPoint.y > y) target.setTranslationY(minPoint.y);\r\n\t\t\tif (maxPoint.x < x) target.setTranslationX(maxPoint.x);\r\n\t\t\tif (maxPoint.y < y) target.setTranslationY(maxPoint.y);\r\n\r\n\t\t\tlet { vx, vy } = state\r\n\r\n\t\t\tif (minPoint.x > x && vx < 0) {\r\n\t\t\t\tstate.vx = -vx * bounce\r\n\t\t\t}\r\n\t\t\tif (minPoint.y > y && vy < 0) {\r\n\t\t\t\tstate.vy= -vy * bounce\r\n\t\t\t}\r\n\t\t\tif (maxPoint.x < x && vx > 0) {\r\n\t\t\t\tstate.vx = -vx * bounce\r\n\t\t\t}\r\n\t\t\tif (maxPoint.y < y && vy > 0) {\r\n\t\t\t\tstate.vy = -vy * bounce\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\tfriction: {\r\n\t\tcreate: ( options, isTemp = false ) => ({\r\n\t\t\ttype: 'friction',\r\n\t\t\tdamping: def(options.damping, .7),\r\n\t\t\tinfluence: Utils.createArea( options.influenceArea || {} ),\r\n\t\t\tpriority: 2,\r\n\t\t\tisTemp\r\n\t\t}),\r\n\t\tdoFrame: (options, deltaTime, state, coords) => {\r\n\t\t\tif( !Utils.isPointInArea( coords, options.influence) ) return;\r\n\t\t\t\r\n\t\t\tlet pow = Math.pow(options.damping, 60.0 * deltaTime)\r\n\t\t\tstate.vx = pow * state.vx\r\n\t\t\tstate.vy = pow * state.vy\r\n\t\t}\r\n\t},\r\n\r\n\tgravity: {\r\n\t\tcreate: ( options, isTemp = false ) => ({\r\n\t\t\ttype: 'gravity',\r\n\t\t\tx0: def(options.x, Infinity),\r\n\t\t\ty0: def(options.y, Infinity),\r\n\t\t\tstrength: def(options.strength, 400),\r\n\t\t\tfalloff: def(options.falloff, 40),\r\n\t\t\tdamping: def(options.damping, 0),\r\n\t\t\tinfluence: Utils.createArea(options.influenceArea || {}),\r\n\t\t\tisTemp,\r\n\t\t\tpriority: 1\r\n\t\t}),\r\n\t\tdoFrame: (options, deltaTime, state, coords) => {\r\n\t\t\tif( !Utils.isPointInArea( coords, options.influence) ) return;\r\n\r\n\t\t\tlet dx = options.x0 !== Infinity ? coords.x - options.x0 : 0;\r\n\t\t\tlet dy = options.y0 !== Infinity ? coords.y - options.y0 : 0;\r\n\t\t\tlet dr = Math.sqrt(dx * dx + dy * dy);\r\n\r\n\t\t\tif (!dr) return;\r\n\r\n\t\t\tlet { falloff, strength } = options\r\n\t\t\tlet a = (-strength * dr * Math.exp(-0.5 * (dr * dr) / (falloff * falloff))) / state.mass;\r\n\r\n\t\t\tlet ax = dx / dr * a;\r\n\t\t\tlet ay = dy / dr * a;\r\n\r\n\t\t\tstate.vx += deltaTime * ax\r\n\t\t\tstate.vy += deltaTime * ay\r\n\t\t}\r\n\t},\r\n\r\n\tspring: {\r\n\t\tcreate: ( options, isTemp = false ) => ({\r\n\t\t\ttype: 'spring',\r\n\t\t\tx0: def(options.x, 0),\r\n\t\t\ty0: def(options.y, 0),\r\n\t\t\ttension: def(options.tension, 300),\r\n\t\t\tinfluence: Utils.createArea( options.influenceArea || {} ),\r\n\t\t\tisTemp,\r\n\t\t\tpriority: 1\r\n\t\t}),\r\n\t\tdoFrame: ( options, deltaTime, state, coords) => {\r\n\t\t\tif( !Utils.isPointInArea( coords, options.influence) ) return;\r\n\t\r\n\t\t\tlet dx = coords.x - options.x0;\r\n\t\t\tif( dx ){\r\n\t\t\t\t// time * acceleration\r\n\t\t\t\tstate.vx += deltaTime * ((-1 * options.tension * dx) / state.mass)\r\n\t\t\t}\r\n\t\r\n\t\t\tlet dy = coords.y - options.y0;\r\n\t\t\tif( dy ){\r\n\t\t\t\t// time * acceleration\r\n\t\t\t\tstate.vy += deltaTime * ((-1 * options.tension * dy) / state.mass)\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}","import Behaviors from './Behaviors'\r\n\r\nconst ANIMATOR_PAUSE_CONSECUTIVE_FRAMES = 10;\r\nconst ANIMATOR_PAUSE_ZERO_VELOCITY = 1.0;\r\n\r\nif( typeof requestAnimationFrame === 'undefined' ){\r\n\t// We just don't work without raf (maybe we are in the server)\r\n\t// eslint-disable-next-line no-native-reassign\r\n\trequestAnimationFrame = function(){}\r\n}\r\n\r\nclass PhysicsAnimator {\r\n\tbehaviors = []\r\n\tphysicsObject = {vx: 0, vy: 0, mass: 1}\r\n\tconsecutiveFramesWithNoMovement = 0\r\n\tscreenScale = 1\r\n\tlastFrameTS = 0\r\n\tisRunning = false\r\n\tticking = false\r\n\tisDragging = false\r\n\r\n\tconstructor( View, listener, debug ){\r\n\t\tthis.View = View\r\n\t\tthis.animatorListener = listener\r\n\t\tif( !debug ){\r\n\t\t\tlet nofn = function(){}\r\n\t\t\tthis.debugStart = nofn;\r\n\t\t\tthis.debugEnd = nofn;\r\n\t\t}\r\n\t}\r\n\r\n\tdoFrame( frameTimeMillis ) {\r\n\t\tif( !this.isRunning ) return;\r\n\r\n\t\tif ( this.lastFrameTS ) {\r\n\t\t\tthis.animateFrameWithDeltaTime(\r\n\t\t\t\t(frameTimeMillis - this.lastFrameTS) * 1e-3\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\tthis.lastFrameTS = frameTimeMillis;\r\n\t\tthis.animatorListener.onAnimationFrame();\r\n\t\trequestAnimationFrame( () => this.doFrame( Date.now() ) )\r\n\t}\r\n\r\n\tdebugStart( behavior ){\r\n\t\tif( this.debug !== true && this.debug !== behavior.type ) return;\r\n\t\tthis.debugB = behavior\r\n\t\tthis.debugInitialV = {...this.physicsObject}\r\n\t}\r\n\r\n\tdebugEnd() {\r\n\t\tif (!this.debugB || (this.debug !== true && this.debug !== this.debugB.type)) return;\r\n\t\tconsole.log( `Debug ${this.debugB.type}`, {\r\n\t\t\tdvx: this.physicsObject.vx - this.debugInitialV.vx,\r\n\t\t\tdvy: this.physicsObject.vy - this.debugInitialV.vy,\r\n\t\t})\r\n\t}\r\n\t\r\n\tanimateFrameWithDeltaTime( deltaTime ) {\r\n\t\tif( !deltaTime ) return;\r\n\r\n\t\tlet { physicsObject, behaviors, View } = this\r\n\t\tlet hadMovement = false\r\n\t\tlet coords = View.getTranslation()\r\n\r\n\t\tbehaviors.forEach( behavior => {\r\n\t\t\tthis.debugStart( behavior )\r\n\t\t\tBehaviors[ behavior.type ].doFrame( behavior, deltaTime, physicsObject, coords, View )\r\n\t\t\tthis.debugEnd()\r\n\t\t})\r\n\r\n\t\tlet dx = 0;\r\n\t\tlet {vx,vy} = physicsObject\r\n\t\t\r\n\t\tif ( Math.abs(vx) > ANIMATOR_PAUSE_ZERO_VELOCITY ) {\r\n\t\t\tdx = deltaTime * vx;\r\n\t\t\thadMovement = true;\r\n\t\t}\r\n\r\n\t\tlet dy = 0;\r\n\t\tif ( Math.abs(vy) > ANIMATOR_PAUSE_ZERO_VELOCITY ) {\r\n\t\t\tdy = deltaTime * vy;\r\n\t\t\thadMovement = true;\r\n\t\t}\r\n\t\t\r\n\t\tView.animate( dx, dy )\r\n\r\n\t\tlet cfwnm = hadMovement ? 0 : this.consecutiveFramesWithNoMovement + 1\r\n\t\tthis.consecutiveFramesWithNoMovement = cfwnm\r\n\r\n\t\tif (cfwnm >= ANIMATOR_PAUSE_CONSECUTIVE_FRAMES && !this.isDragging ) {\r\n\t\t\tthis.stopRunning();\r\n\t\t\tthis.animatorListener.onAnimatorPause();\r\n\t\t}\r\n\t}\r\n\r\n\taddBehavior( type, options, isTemp ){\r\n\t\tlet b = Behaviors[ type ]\r\n\t\tif( !b ) return;\r\n\r\n\t\tlet behavior = b.create( options, isTemp )\r\n\t\tlet behaviors = this.behaviors\r\n\t\tlet idx = 0\r\n\r\n\t\twhile (behaviors.length > idx && behaviors[idx].priority <= behavior.priority) {\r\n\t\t\t++idx;\r\n\t\t}\r\n\t\tbehaviors.splice( idx, 0, behavior )\r\n\r\n\t\tthis.ensureRunning()\r\n\t\treturn behavior\r\n\t}\r\n\r\n\tremove( condition ){\r\n\t\tlet behaviors = this.behaviors\r\n\t\tlet i = behaviors.length\r\n\t\twhile( i-- > 0 ){\r\n\t\t\tif( condition(behaviors[i]) ){\r\n\t\t\t\tbehaviors.splice( i, 1 )\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tremoveBehavior( behavior ) {\r\n\t\tthis.remove( target => target === behavior )\r\n\t}\r\n\r\n\tremoveTypeBehaviors( type ){\r\n\t\tthis.remove( target => target.type === type )\r\n\t}\r\n\t\r\n\tremoveTempBehaviors(){\r\n\t\tthis.remove( target => target.isTemp )\r\n\t}\r\n\t\r\n\tgetVelocity(){ \r\n\t\treturn { x: this.physicsObject.vx, y: this.physicsObject.vy }\r\n\t}\r\n\r\n\tensureRunning() {\r\n\t\tthis.isRunning || this.startRunning()\r\n\t}\r\n\r\n\tstartRunning() {\r\n\t\tthis.isRunning = true;\r\n\t\tthis.lastFrameTS = 0;\r\n\t\tthis.consecutiveFramesWithNoMovement = 0;\r\n\t\trequestAnimationFrame( () => this.doFrame( Date.now() ) )\r\n\t}\r\n\r\n\tstopRunning() {\r\n\t\tthis.removeTempBehaviors();\r\n\t\tthis.physicsObject = {vx: 0, vy: 0, mass: this.physicsObject.mass}\r\n\t\tthis.isRunning = false;\r\n\t}\r\n}\r\n\r\nexport default PhysicsAnimator","import React, { Component } from 'react'\r\nimport PropTypes from 'prop-types'\r\nimport Animator from './Animator'\r\nimport Utils from './Utils';\r\n\r\nconst propBehaviors = {\r\n\tfrictionAreas: 'friction',\r\n\tgravityPoints: 'gravity',\r\n\tspringPoints: 'spring',\r\n}\r\n\r\nconst isWeb = typeof document !== 'undefined'\r\n\r\nexport default function injectDependencies( Animated, PanResponder ){\r\n\r\n\treturn class InteractableView extends Component {\r\n\t\tstatic propTypes = {\r\n\t\t\tsnapPoints: PropTypes.array,\r\n\t\t\tfrictionAreas: PropTypes.array,\r\n\t\t\talertAreas: PropTypes.array,\r\n\t\t\tgravityPoints: PropTypes.array,\r\n\t\t\thorizontalOnly: PropTypes.bool,\r\n\t\t\tverticalOnly: PropTypes.bool,\r\n\t\t\tdragWithSpring: PropTypes.object,\r\n\t\t\tdragEnabled: PropTypes.bool,\r\n\t\t\tanimatedValueX: PropTypes.instanceOf(Animated.Value),\r\n\t\t\tanimatedValueY: PropTypes.instanceOf(Animated.Value),\r\n\t\t\tonSnap: PropTypes.func,\r\n\t\t\tonSnapStart: PropTypes.func,\r\n\t\t\tonEnd: PropTypes.func,\r\n\t\t\tonDrag: PropTypes.func,\r\n\t\t\tboundaries: PropTypes.object,\r\n\t\t\tinitialPosition: PropTypes.object,\r\n\t\t\tdragToss: PropTypes.number\r\n\t\t}\r\n\r\n\t\tstatic defaultProps = {\r\n\t\t\tsnapPoints: [],\r\n\t\t\tfrictionAreas: [],\r\n\t\t\talertAreas: [],\r\n\t\t\tgravityPoints: [],\r\n\t\t\tboundaries: {},\r\n\t\t\tinitialPosition: {x: 0, y: 0},\r\n\t\t\tdragToss: .1,\r\n\t\t\tdragEnabled: true,\r\n\t\t\tonSnap: function () { },\r\n\t\t\tonSnapStart: function () { },\r\n\t\t\tonStop: function () { },\r\n\t\t\tonDrag: function () { },\r\n\t\t\tonAlert: function () { },\r\n\t\t\tstyle: {}\r\n\t\t}\r\n\r\n\t\tinitialPositionSet = false\r\n\t\tisDragging = false\r\n\r\n\t\tconstructor(props) {\r\n\t\t\tsuper(props)\r\n\r\n\t\t\tlet { x=0, y=0 } = props.initialPosition\r\n\r\n\t\t\t// In case animatedValueXY is not given\r\n\t\t\tthis.animated = new Animated.ValueXY({x, y})\r\n\r\n\t\t\t// This guy will apply all the physics\r\n\t\t\tthis.animator = this.createAnimator( props )\r\n\r\n\t\t\t// Cache when the view is inside of an alert area\r\n\t\t\tthis.insideAlertAreas = {}\r\n\r\n\t\t\t// cache calculated areas\r\n\t\t\tthis.propAreas = {\r\n\t\t\t\talert: [],\r\n\t\t\t\tboundaries: false\r\n\t\t\t}\r\n\r\n\t\t\tthis._pr = this.createPanResponder(props)\r\n\t\t\t\r\n\t\t\t// Set behaviors and prop defaults\r\n\t\t\tthis.setPropBehaviours( {}, props )\r\n\r\n\t\t\t// Set initial position\r\n\t\t\tlet animated = this.getAnimated( props )\r\n\t\t\tanimated.x.setValue( x )\r\n\t\t\tanimated.y.setValue(y)\r\n\t\t\tanimated.x._startingValue = x\r\n\t\t\tanimated.y._startingValue = y\r\n\t\t\t\r\n\t\t\t// Save the last animation end position to report good coordinates in the events\r\n\t\t\tthis.lastEnd = {...this.initialPosition}\r\n\t\t}\r\n\r\n\t\trender() {\r\n\t\t\tlet { x, y } = this.getAnimated()\r\n\t\t\tlet style = this.props.style\r\n\t\t\tlet withPosition = {\r\n\t\t\t\ttransform: [{ translateX: x }, { translateY: y }].concat( style.transform || [] ),\r\n\t\t\t\t...style\r\n\t\t\t}\r\n\r\n\t\t\tlet panHandlers = this.props.dragEnabled ? this._pr.panHandlers : {}\r\n\r\n\t\t\treturn (\r\n\t\t\t\t\r\n\t\t\t\t\t{this.props.children}\r\n\t\t\t\t\r\n\t\t\t)\r\n\t\t}\r\n\r\n\t\tgetTranslation(){\r\n\t\t\tlet {x, y} = this.getAnimated()\r\n\t\t\treturn {\r\n\t\t\t\tx: x._value + x._offset,\r\n\t\t\t\ty: y._value + y._offset\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tsetTranslationX( tx ){\r\n\t\t\tlet animated = this.props.animatedValueX || this.animated.x\r\n\t\t\tanimated.setValue( tx - animated._offset )\r\n\t\t}\r\n\r\n\t\tsetTranslationY(ty) {\r\n\t\t\tlet animated = this.props.animatedValueY || this.animated.y\r\n\t\t\tanimated.setValue( ty - animated._offset )\r\n\t\t}\r\n\r\n\t\tsetTranslation( tx, ty ){\r\n\t\t\tthis.setTranslationX( tx )\r\n\t\t\tthis.setTranslationY( ty )\r\n\t\t}\r\n\r\n\t\tcreateAnimator(){\r\n\t\t\treturn new Animator( this, {\r\n\t\t\t\tonAnimatorPause: () => {\r\n\t\t\t\t\tlet { x, y } = this.getTranslation()\r\n\t\t\t\t\tthis.lastEnd = {x: Math.round(x), y: Math.round(y)}\r\n\t\t\t\t\tthis.props.onStop( this.lastEnd )\r\n\t\t\t\t},\r\n\t\t\t\tonAnimationFrame: () => {\r\n\t\t\t\t\tthis.reportAlertEvent( this.getTranslation() )\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tfalse // Set true or behavior type to output debug info in the console\r\n\t\t\t)\r\n\t\t}\r\n\r\n\t\tanimate( dx, dy ){\r\n\t\t\tif(!dx && !dy) return\r\n\t\t\t// let animated = this.getAnimated()\r\n\t\t\t// console.log( dx + animated.x._value + animated.x._offset )\r\n\r\n\t\t\tlet {x,y} = this.getTranslation()\r\n\t\t\tthis.setTranslation( x + dx, y + dy ) \r\n\t\t}\r\n\r\n\t\tgetAnimated( props ){\r\n\t\t\tlet { animatedValueX, animatedValueY } = (props || this.props)\r\n\r\n\t\t\treturn {\r\n\t\t\t\tx: animatedValueX || this.animated.x ,\r\n\t\t\t\ty: animatedValueY || this.animated.y\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tcreatePanResponder() {\r\n\t\t\tlet capturer = this.checkResponderCapture.bind(this)\r\n\t\t\t\r\n\t\t\treturn PanResponder.create({\r\n\t\t\t\tonMoveShouldSetResponderCapture: capturer,\r\n\t\t\t\tonMoveShouldSetPanResponderCapture: capturer,\r\n\r\n\t\t\t\tonPanResponderGrant: (e, {x0, y0}) => {\t\r\n\t\t\t\t\tthis._captured = true;\r\n\t\t\t\t\tthis.startDrag( {x: x0, y: y0} )\r\n\t\t\t\t},\r\n\r\n\t\t\t\tonPanResponderMove: (e, gesture ) => {\r\n\t\t\t\t\tthis.onDragging( gesture )\r\n\t\t\t\t},\r\n\r\n\t\t\t\tonPanResponderRelease: () => {\r\n\t\t\t\t\tthis._captured = false;\r\n\t\t\t\t\tthis.endDrag()\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t}\r\n\r\n\t\tcheckResponderCapture( e, gesture ){\r\n\t\t\treturn this._captured || Math.abs( gesture.dx ) > 5 || Math.abs( gesture.dy ) > 5;\r\n\t\t}\r\n\r\n\t\treportAlertEvent( position ){\r\n\t\t\tlet inside = this.insideAlertAreas\r\n\t\t\tlet { onAlert } = this.props\r\n\r\n\t\t\tthis.propAreas.alert.forEach( ({ influence, id }) => {\r\n\t\t\t\tif ( !influence || !id ) return;\r\n\r\n\t\t\t\tif ( Utils.isPointInArea( position, influence ) ) {\r\n\t\t\t\t\tif ( !inside[id] ) {\r\n\t\t\t\t\t\tonAlert({id, value:\"enter\"});\r\n\t\t\t\t\t\tinside[id] = 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t} else if (inside[id]) {\r\n\t\t\t\t\tonAlert({ id, value: \"leave\" });\r\n\t\t\t\t\tinside[id] = 0;\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t}\r\n\r\n\t\tstartDrag( ev ){\r\n\t\t\t// Prepare the animated\r\n\t\t\tlet {x,y} = this.getAnimated()\r\n\t\t\tlet offset = {x: x._value, y: y._value}\r\n\t\t\tx.setOffset( offset.x )\r\n\t\t\ty.setOffset( offset.y )\r\n\t\t\tx.setValue( 0 )\r\n\t\t\ty.setValue( 0 )\r\n\r\n\t\t\t// Save the offset for triggering events with the right coordinates\r\n\t\t\tthis.lastEnd = offset\r\n\t\t\t// console.log( offset )\r\n\r\n\t\t\t// Set boundaries to fast access\r\n\t\t\tthis.dragBoundaries = this.propAreas.boundaries ? this.propAreas.boundaries.influence : {}\r\n\r\n\t\t\t// Prepare the animation\r\n\t\t\tthis.props.onDrag({state: 'start', x: offset.x, y: offset.y})\r\n\t\t\tthis.dragStartLocation = { x: ev.x, y: ev.y }\r\n\t\t\tthis.animator.removeTempBehaviors();\r\n\t\t\tthis.animator.isDragging = true\r\n\t\t\tthis.animator.vx = 0\r\n\t\t\tthis.animator.vy = 0\r\n\t\t\tthis.addTempDragBehavior( this.props.dragWithSpring );\r\n\r\n\t\t\t// Stop text selection\r\n\t\t\tif ( isWeb ) {\r\n\t\t\t\tlet styles = document.body.style\r\n\t\t\t\tthis.userSelectCache = styles.userSelect\r\n\t\t\t\tstyles.userSelect = \"none\"\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tonDragging({dx, dy}){\r\n\t\t\tif( !this.animator.isDragging ) return false\r\n\t\t\tif( !this.props.dragEnabled ) return this.endDrag()\r\n\r\n\t\t\tlet pos = this.lastEnd\r\n\t\t\tlet x = dx + pos.x\r\n\t\t\tlet y = dy + pos.y\r\n\t\t\t\r\n\t\t\t// console.log( this.dragBoundaries.minPoint )\r\n\r\n\t\t\tlet {minPoint, maxPoint} = this.dragBoundaries\r\n\t\t\tif( !this.props.verticalOnly ){\r\n\t\t\t\tif (minPoint) {\r\n\t\t\t\t\tif (minPoint.x > x) x = minPoint.x\r\n\t\t\t\t\tif (maxPoint.x < x) x = maxPoint.x\r\n\t\t\t\t}\r\n\t\t\t\tthis.dragBehavior.x0 = x\r\n\t\t\t}\r\n\r\n\t\t\tif (!this.props.horizontalOnly) {\r\n\t\t\t\tif (minPoint) {\r\n\t\t\t\t\tif (minPoint.y > y) y = minPoint.y\r\n\t\t\t\t\tif (maxPoint.y < y) y = maxPoint.y\r\n\t\t\t\t}\r\n\t\t\t\tthis.dragBehavior.y0 = y\r\n\t\t\t}\r\n\r\n\t\t\t// console.log( this.dragBehavior )\r\n\t\t}\r\n\r\n\t\tendDrag(){\r\n\t\t\tthis.animator.removeTempBehaviors();\r\n\t\t\tthis.dragBehavior = null;\r\n\t\t\tthis.animator.isDragging = false\r\n\r\n\t\t\tlet { animator, horizontalOnly, verticalOnly, dragWithSprings } = this\r\n\r\n\t\t\tlet velocity = animator.getVelocity();\r\n\t\t\tif (horizontalOnly) velocity.y = 0;\r\n\t\t\tif (verticalOnly) velocity.x = 0;\r\n\t\t\t\r\n\t\t\tlet toss = (dragWithSprings && dragWithSprings.toss) || this.props.dragToss;\r\n\t\t\tlet {x,y} = this.getTranslation()\r\n\t\t\tlet projectedCenter = {\r\n\t\t\t\tx: x + toss * velocity.x,\r\n\t\t\t\ty: y + toss * velocity.y\r\n\t\t\t};\r\n\r\n\t\t\t// console.log( 'pc', projectedCenter, velocity)\r\n\t\t\tlet snapPoint = Utils.findClosest(projectedCenter, this.props.snapPoints);\r\n\t\t\tlet targetSnapPointId = (snapPoint && snapPoint.id) || \"\";\r\n\r\n\t\t\tthis.props.onDrag({ state: 'end', x: x, y: y, targetSnapPointId })\r\n\r\n\t\t\tthis.addTempSnapToPointBehavior(snapPoint);\r\n\t\t\tthis.addTempBoundaries();\r\n\r\n\t\t\tlet animated = this.getAnimated()\r\n\t\t\tanimated.x.flattenOffset()\r\n\t\t\tanimated.y.flattenOffset()\r\n\r\n\t\t\t// Restore text selection\r\n\t\t\tif ( isWeb ) {\r\n\t\t\t\tdocument.body.style.userSelect = this.userSelectCache || ''\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\taddTempDragBehavior( drag ) {\r\n\t\t\tlet pos = this.getTranslation()\r\n\r\n\t\t\tif ( !drag || drag.tension === Infinity ) {\r\n\t\t\t\tthis.dragBehavior = this.animator.addBehavior( 'anchor', pos, true )\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tpos.tension = drag.tension || 300\r\n\t\t\t\tthis.dragBehavior = this.animator.addBehavior( 'spring', pos, true )\r\n\t\t\t\tif( drag.damping ){\r\n\t\t\t\t\tthis.animator.addBehavior('friction', drag, true)\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\taddTempSnapToPointBehavior( snapPoint ) {\r\n\t\t\tif (!snapPoint) return;\r\n\t\t\tlet { snapPoints, onSnap, onSnapStart } = this.props\r\n\r\n\t\t\tlet index = snapPoints.indexOf(snapPoint)\r\n\r\n\t\t\tonSnap({index, id: snapPoint.id});\r\n\t\t\tonSnapStart({index, id: snapPoint.id});\r\n\r\n\t\t\tlet springOptions = {\r\n\t\t\t\tdamping: .7,\r\n\t\t\t\ttension: 300,\r\n\t\t\t\t...snapPoint\r\n\t\t\t}\r\n\r\n\t\t\tthis.addBehavior( 'spring', springOptions, true )\r\n\t\t}\r\n\r\n\t\tsetVelocity( velocity ) {\r\n\t\t\tif ( this.dragBehavior ) return;\r\n\t\t\tthis.animator.physicsObject.vx = velocity.x\r\n\t\t\tthis.animator.physicsObject.vy = velocity.y\r\n\t\t\tthis.endDrag();\r\n\t\t}\r\n\r\n\t\tsnapTo( {index} ) {\r\n\t\t\tlet {snapPoints} = this.props;\r\n\r\n\t\t\tif( !snapPoints || index === undefined || index >= snapPoints.length ) return;\r\n\t\t\t\r\n\t\t\tthis.animator.removeTempBehaviors();\r\n\t\t\tthis.dragBehavior = null;\r\n\t\t\tlet snapPoint = snapPoints[index]\r\n\r\n\t\t\tthis.addTempSnapToPointBehavior(snapPoint);\r\n\t\t\tthis.addTempBoundaries();\r\n\t\t}\r\n\r\n\t\taddTempBoundaries(){\r\n\t\t\tlet boundaries = this.propAreas.boundaries;\r\n\t\t\tif( !boundaries ) return;\r\n\t\t\tthis.animator.addBehavior( 'bounce', boundaries, true );\r\n\t\t}\r\n\r\n\t\tchangePosition( position ) {\r\n\t\t\tif ( this.dragBehavior ) return;\r\n\r\n\t\t\tthis.setTranslation( position.x, position.y )\r\n\t\t\tthis.endDrag();\r\n\t\t}\r\n\r\n\t\tcomponentDidUpdate( prevProps ){\r\n\t\t\tthis.setPropBehaviours( prevProps, this.props )\r\n\t\t}\r\n\r\n\t\tsetPropBehaviours( prevProps, props ){\r\n\t\t\t// spring, gravity, friction\r\n\t\t\tObject.keys( propBehaviors ).forEach( prop => {\r\n\t\t\t\tif( prevProps[ prop ] !== props[ prop ] ){\r\n\t\t\t\t\tthis.animator.removeTypeBehaviors(propBehaviors[prop])\r\n\t\t\t\t\tthis.addTypeBehaviors( propBehaviors[prop], props[ prop ] )\r\n\t\t\t\t}\r\n\t\t\t})\r\n\r\n\t\t\tif( prevProps.alertAreas !== props.alertAreas ){\r\n\t\t\t\tlet alertAreas = []\r\n\t\t\t\tprops.alertAreas.forEach( area => {\r\n\t\t\t\t\talertAreas.push({\r\n\t\t\t\t\t\tid: area.id,\r\n\t\t\t\t\t\tinfluence: Utils.createArea( area.influenceArea )\r\n\t\t\t\t\t})\r\n\t\t\t\t})\r\n\t\t\t\tthis.propAreas.alert = alertAreas\r\n\t\t\t}\r\n\r\n\t\t\tif( prevProps.boundaries !== props.boundaries ){\r\n\t\t\t\tthis.animator.removeBehavior( this.oldBoundariesBehavior )\r\n\t\t\t\tif( props.boundaries ){\r\n\t\t\t\t\tlet bounce = {\r\n\t\t\t\t\t\tbounce: props.boundaries.bounce || 0,\r\n\t\t\t\t\t\tinfluence: Utils.createArea( props.boundaries )\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.propAreas.boundaries = bounce\r\n\t\t\t\t\tthis.oldBoundariesBehavior = this.animator.addBehavior( 'bounce', bounce )\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tthis.propAreas.boundaries = false\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif (!this.props.dragEnabled && prevProps.dragEnabled && this.dragBehavior ){\r\n\t\t\t\tthis.endDrag()\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\taddTypeBehaviors( type, behaviors, isTemp ){\r\n\t\t\tbehaviors.forEach( b => this.addBehavior( type, b, isTemp )\t)\r\n\t\t}\r\n\r\n\t\taddBehavior( type, behavior, isTemp ){\r\n\t\t\tthis.animator.addBehavior( type, behavior, isTemp )\r\n\t\t\tif( behavior.damping && type !== 'friction' ){\r\n\t\t\t\tlet b = this.animator.addBehavior('friction', behavior, isTemp )\r\n\t\t\t\tif( type === 'gravity' && !behavior.influenceArea ){\r\n\t\t\t\t\tb.influence = Utils.createAreaFromRadius(1.4 * (behavior.falloff || 40), behavior)\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n","import React from 'react'\r\nimport Animated from 'animated/lib/targets/react-dom'\r\n\r\nexport default function AnimatedView(props) {\r\n let propStyles = props.style || {}\r\n let style = { position: 'relative', display: 'flex', ...propStyles}\r\n\r\n return (\r\n \r\n {props.children}\r\n \r\n )\r\n}","import Animated from 'animated/lib/targets/react-dom'\r\nimport PanResponder from 'react-panresponder-web'\r\nimport injectDependencies from './InteractableView'\r\nimport AnimatedView from './AnimatedView'\r\n\r\n// Fake the Animated.View component\r\nAnimated.View = AnimatedView\r\n\r\nlet Interactable = injectDependencies( Animated, PanResponder ) \r\nexport default {View: Interactable}"],"names":["createArea","boundaries","minPoint","x","left","undefined","Infinity","y","top","maxPoint","right","bottom","createAreaFromRadius","radius","anchor","isPointInArea","area","findClosest","origin","points","minDistance","closestPoint","forEach","point","distance","getDistance","relative","p","r","dx","Math","abs","dy","sqrt","getDelta","def","value","defaultValue","create","options","isTemp","x0","y0","priority","type","doFrame","deltaTime","state","coords","vx","vy","bounce","influence","target","setTranslationX","setTranslationY","friction","damping","Utils","influenceArea","pow","gravity","strength","falloff","dr","a","exp","mass","ax","ay","spring","tension","ANIMATOR_PAUSE_CONSECUTIVE_FRAMES","ANIMATOR_PAUSE_ZERO_VELOCITY","requestAnimationFrame","PhysicsAnimator","View","listener","debug","animatorListener","nofn","debugStart","debugEnd","frameTimeMillis","isRunning","lastFrameTS","animateFrameWithDeltaTime","onAnimationFrame","Date","now","behavior","debugB","debugInitialV","physicsObject","console","log","dvx","dvy","behaviors","hadMovement","getTranslation","Behaviors","animate","cfwnm","consecutiveFramesWithNoMovement","isDragging","stopRunning","onAnimatorPause","b","idx","length","splice","ensureRunning","condition","i","remove","startRunning","removeTempBehaviors","propBehaviors","frictionAreas","gravityPoints","springPoints","isWeb","document","injectDependencies","Animated","PanResponder","props","initialPosition","animated","ValueXY","animator","createAnimator","insideAlertAreas","propAreas","alert","_pr","createPanResponder","setPropBehaviours","getAnimated","setValue","_startingValue","lastEnd","style","withPosition","transform","translateX","translateY","concat","panHandlers","dragEnabled","React","children","_value","_offset","tx","animatedValueX","ty","animatedValueY","Animator","round","onStop","reportAlertEvent","setTranslation","capturer","checkResponderCapture","bind","onMoveShouldSetResponderCapture","onMoveShouldSetPanResponderCapture","onPanResponderGrant","e","_captured","startDrag","onPanResponderMove","gesture","onDragging","onPanResponderRelease","endDrag","position","inside","onAlert","id","ev","offset","setOffset","dragBoundaries","onDrag","dragStartLocation","addTempDragBehavior","dragWithSpring","styles","body","userSelectCache","userSelect","pos","verticalOnly","dragBehavior","horizontalOnly","dragWithSprings","velocity","getVelocity","toss","dragToss","projectedCenter","snapPoint","snapPoints","targetSnapPointId","addTempSnapToPointBehavior","addTempBoundaries","flattenOffset","drag","addBehavior","onSnap","onSnapStart","index","indexOf","springOptions","prevProps","Object","keys","prop","removeTypeBehaviors","addTypeBehaviors","alertAreas","push","removeBehavior","oldBoundariesBehavior","Component","PropTypes","array","bool","object","instanceOf","Value","func","onEnd","number","AnimatedView","propStyles","display","Interactable"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,cAAe;EACdA,EAAAA,UAAU,EAAE,oBAAUC,UAAV,EAAsB;EACjC,WAAO;EACNC,MAAAA,QAAQ,EAAE;EACTC,QAAAA,CAAC,EAAEF,UAAU,CAACG,IAAX,KAAoBC,SAApB,GAAgC,CAACC,QAAjC,GAA4CL,UAAU,CAACG,IADjD;EAETG,QAAAA,CAAC,EAAEN,UAAU,CAACO,GAAX,KAAmBH,SAAnB,GAA+B,CAACC,QAAhC,GAA2CL,UAAU,CAACO;EAFhD,OADJ;EAKNC,MAAAA,QAAQ,EAAE;EACTN,QAAAA,CAAC,EAAEF,UAAU,CAACS,KAAX,KAAqBL,SAArB,GAAiCC,QAAjC,GAA4CL,UAAU,CAACS,KADjD;EAETH,QAAAA,CAAC,EAAEN,UAAU,CAACU,MAAX,KA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tF,IAAAA,aAAa,EAAE,EAFM;EAGrBwG,IAAAA,UAAU,EAAE,EAHS;EAIrBvG,IAAAA,aAAa,EAAE,EAJM;EAKrBvH,IAAAA,UAAU,EAAE,EALS;EAMrB+H,IAAAA,eAAe,EAAE;EAAC7H,MAAAA,CAAC,EAAE,CAAJ;EAAOI,MAAAA,CAAC,EAAE;EAAV,KANI;EAOrBmM,IAAAA,QAAQ,EAAE,EAPW;EAQrBpD,IAAAA,WAAW,EAAE,IARQ;EASrB8D,IAAAA,MAAM,EAAE,kBAAY,EATC;EAUrBC,IAAAA,WAAW,EAAE,uBAAY,EAVJ;EAWrBpD,IAAAA,MAAM,EAAE,kBAAY,EAXC;EAYrByB,IAAAA,MAAM,EAAE,kBAAY,EAZC;EAarBN,IAAAA,OAAO,EAAE,mBAAY,EAbA;EAcrBrC,IAAAA,KAAK,EAAE;EAdc,GArBvB;EAoaA;;EChbc,SAAS8F,YAAT,CAAsB9G,KAAtB,EAA6B;EAC1C,MAAI+G,UAAU,GAAG/G,KAAK,CAACgB,KAAN,IAAe,EAAhC;EACA,MAAIA,KAAK;EAAKmC,IAAAA,QAAQ,EAAE,UAAf;EAA2B6D,IAAAA,OAAO,EAAE;EAApC,KAA+CD,UAA/C,CAAT;EAEA,SACEvF,6BAAC,QAAD,CAAU,GAAV,eAAkBxB,KAAlB;EAAyB,IAAA,KAAK,EAAEgB;EAAhC,MACGhB,KAAK,CAACyB,QADT,CADF;EAKD;;ECND3B,QAAQ,CAACjD,IAAT,GAAgBiK,YAAhB;EAEA,IAAIG,YAAY,GAAGpH,kBAAkB,CAAEC,QAAF,EAAYC,YAAZ,CAArC;AACA,iBAAe;EAAClD,EAAAA,IAAI,EAAEoK;EAAP,CAAf;;;;;;;;"} \ No newline at end of file diff --git a/dist/interactable.noNative.min.js b/dist/interactable.noNative.min.js index adb74f9..e40b76f 100644 --- a/dist/interactable.noNative.min.js +++ b/dist/interactable.noNative.min.js @@ -1,9 +1,9 @@ /*! * *//* eslint-disable */ /*! - * react-interactable v0.6.5 + * react-interactable v0.6.6 * (c) 2019-present Javier Marquez * Released under the MIT License. */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("prop-types"),require("animated/lib/targets/react-dom"),require("react-panresponder-web")):"function"==typeof define&&define.amd?define(["react","prop-types","animated/lib/targets/react-dom","react-panresponder-web"],t):e.Interactable=t(e.React,e.PropTypes,e.Animated,e.PanResponder)}(this,function(e,t,n,i){"use strict";var a="default"in e?e.default:e;function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;n=a.x&&n<=r.x&&i>=a.y&&i<=r.y},findClosest:function(e,t){var n=this,i=1/0,a=null;return t.forEach(function(t){var r=n.getDistance(t,e);r1&&void 0!==arguments[1]&&arguments[1];return{x0:e.x,y0:e.y,priority:1,isTemp:t,type:"anchor"}},doFrame:function(e,t,n,i){n.vx=(e.x0-i.x)/t,n.vy=(e.y0-i.y)/t}},bounce:{create:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{type:"bounce",bounce:f(e.bounce,.5),minPoint:e.influence.minPoint,maxPoint:e.influence.maxPoint,priority:3,isTemp:t}},doFrame:function(e,t,n,i,a){var r=e.minPoint,o=e.maxPoint,s=e.bounce,u=i.x,h=i.y;r.x>u&&a.setTranslationX(r.x),r.y>h&&a.setTranslationY(r.y),o.xu&&c<0&&(n.vx=-c*s),r.y>h&&d<0&&(n.vy=-d*s),o.x0&&(n.vx=-c*s),o.y0&&(n.vy=-d*s)}},friction:{create:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{type:"friction",damping:f(e.damping,.7),influence:v.createArea(e.influenceArea||{}),priority:2,isTemp:t}},doFrame:function(e,t,n,i){if(v.isPointInArea(i,e.influence)){var a=Math.pow(e.damping,60*t);n.vx=a*n.vx,n.vy=a*n.vy}}},gravity:{create:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{type:"gravity",x0:f(e.x,1/0),y0:f(e.y,1/0),strength:f(e.strength,400),falloff:f(e.falloff,40),damping:f(e.damping,0),influence:v.createArea(e.influenceArea||{}),isTemp:t,priority:1}},doFrame:function(e,t,n,i){if(v.isPointInArea(i,e.influence)){var a=e.x0!==1/0?i.x-e.x0:0,r=e.y0!==1/0?i.y-e.y0:0,o=Math.sqrt(a*a+r*r);if(o){var s=e.falloff,u=-e.strength*o*Math.exp(o*o*-.5/(s*s))/n.mass,h=a/o*u,c=r/o*u;n.vx+=t*h,n.vy+=t*c}}}},spring:{create:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{type:"spring",x0:f(e.x,0),y0:f(e.y,0),tension:f(e.tension,300),influence:v.createArea(e.influenceArea||{}),isTemp:t,priority:1}},doFrame:function(e,t,n,i){if(v.isPointInArea(i,e.influence)){var a=i.x-e.x0;a&&(n.vx+=t*(-1*e.tension*a/n.mass));var r=i.y-e.y0;r&&(n.vy+=t*(-1*e.tension*r/n.mass))}}}};"undefined"==typeof requestAnimationFrame&&(requestAnimationFrame=function(){});var y,m,g,b,x=function(){function e(t,n,i){if(r(this,e),u(this,"behaviors",[]),u(this,"physicsObject",{vx:0,vy:0,mass:1}),u(this,"consecutiveFramesWithNoMovement",0),u(this,"screenScale",1),u(this,"lastFrameTS",0),u(this,"isRunning",!1),u(this,"ticking",!1),u(this,"isDragging",!1),this.View=t,this.animatorListener=n,!i){var a=function(){};this.debugStart=a,this.debugEnd=a}}return s(e,[{key:"doFrame",value:function(e){var t=this;this.isRunning&&(this.lastFrameTS&&this.animateFrameWithDeltaTime(.001*(e-this.lastFrameTS)),this.lastFrameTS=e,this.animatorListener.onAnimationFrame(),requestAnimationFrame(function(){return t.doFrame(Date.now())}))}},{key:"debugStart",value:function(e){!0!==this.debug&&this.debug!==e.type||(this.debugB=e,this.debugInitialV=Object.assign({},this.physicsObject))}},{key:"debugEnd",value:function(){!this.debugB||!0!==this.debug&&this.debug!==this.debugB.type||console.log("Debug ".concat(this.debugB.type),{dvx:this.physicsObject.vx-this.debugInitialV.vx,dvy:this.physicsObject.vy-this.debugInitialV.vy})}},{key:"animateFrameWithDeltaTime",value:function(e){var t=this;if(e){var n=this.physicsObject,i=this.behaviors,a=this.View,r=!1,o=a.getTranslation();i.forEach(function(i){t.debugStart(i),p[i.type].doFrame(i,e,n,o,a),t.debugEnd()});var s=0,u=n.vx,h=n.vy;Math.abs(u)>1&&(s=e*u,r=!0);var c=0;Math.abs(h)>1&&(c=e*h,r=!0),a.animate(s,c);var d=r?0:this.consecutiveFramesWithNoMovement+1;this.consecutiveFramesWithNoMovement=d,d>=10&&!this.isDragging&&(this.stopRunning(),this.animatorListener.onAnimatorPause())}}},{key:"addBehavior",value:function(e,t,n){var i=p[e];if(i){for(var a=i.create(t,n),r=this.behaviors,o=0;r.length>o&&r[o].priority<=a.priority;)++o;return r.splice(o,0,a),this.ensureRunning(),a}}},{key:"remove",value:function(e){for(var t=this.behaviors,n=t.length;n-- >0;)e(t[n])&&t.splice(n,1)}},{key:"removeBehavior",value:function(e){this.remove(function(t){return t===e})}},{key:"removeTypeBehaviors",value:function(e){this.remove(function(t){return t.type===e})}},{key:"removeTempBehaviors",value:function(){this.remove(function(e){return e.isTemp})}},{key:"getVelocity",value:function(){return{x:this.physicsObject.vx,y:this.physicsObject.vy}}},{key:"ensureRunning",value:function(){this.isRunning||this.startRunning()}},{key:"startRunning",value:function(){var e=this;this.isRunning=!0,this.lastFrameTS=0,this.consecutiveFramesWithNoMovement=0,requestAnimationFrame(function(){return e.doFrame(Date.now())})}},{key:"stopRunning",value:function(){this.removeTempBehaviors(),this.physicsObject={vx:0,vy:0,mass:this.physicsObject.mass},this.isRunning=!1}}]),e}(),P={frictionAreas:"friction",gravityPoints:"gravity",springPoints:"spring"},A="undefined"!=typeof document;return n.View=function(e){var t=e.style||{},i=Object.assign({position:"relative",display:"flex"},t);return a.createElement(n.div,h({},e,{style:i}),e.children)},{View:(y=n,m=i,b=g=function(t){function n(e){var t,i,a;r(this,n),i=this,t=!(a=c(n).call(this,e))||"object"!=typeof a&&"function"!=typeof a?l(i):a,u(l(l(t)),"initialPositionSet",!1),u(l(l(t)),"isDragging",!1);var o=e.initialPosition,s=o.x,h=void 0===s?0:s,d=o.y,v=void 0===d?0:d;t.animated=new y.ValueXY({x:h,y:v}),t.animator=t.createAnimator(e),t.insideAlertAreas={},t.propAreas={alert:[],boundaries:!1},t._pr=t.createPanResponder(e),t.setPropBehaviours({},e);var f=t.getAnimated(e);return f.x.setValue(h),f.y.setValue(v),f.x._startingValue=h,f.y._startingValue=v,t.lastEnd=Object.assign({},t.initialPosition),t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&d(e,t)}(n,e.Component),s(n,[{key:"render",value:function(){var e=this.getAnimated(),t=e.x,n=e.y,i=this.props.style,r=Object.assign({transform:[{translateX:t},{translateY:n}].concat(i.transform||[])},i),o=this.props.dragEnabled?this._pr.panHandlers:{};return a.createElement(y.View,h({style:r},o),this.props.children)}},{key:"getTranslation",value:function(){var e=this.getAnimated(),t=e.x,n=e.y;return{x:t._value+t._offset,y:n._value+n._offset}}},{key:"setTranslationX",value:function(e){var t=this.props.animatedValueX||this.animated.x;t.setValue(e-t._offset)}},{key:"setTranslationY",value:function(e){var t=this.props.animatedValueY||this.animated.y;t.setValue(e-t._offset)}},{key:"setTranslation",value:function(e,t){this.setTranslationX(e),this.setTranslationY(t)}},{key:"createAnimator",value:function(){var e=this;return new x(this,{onAnimatorPause:function(){var t=e.getTranslation(),n=t.x,i=t.y;e.lastEnd={x:Math.round(n),y:Math.round(i)},e.props.onStop(e.lastEnd)},onAnimationFrame:function(){e.reportAlertEvent(e.getTranslation())}},!1)}},{key:"animate",value:function(e,t){if(e||t){var n=this.getTranslation(),i=n.x,a=n.y;this.setTranslation(i+e,a+t)}}},{key:"getAnimated",value:function(e){var t=e||this.props,n=t.animatedValueX,i=t.animatedValueY;return{x:n||this.animated.x,y:i||this.animated.y}}},{key:"createPanResponder",value:function(){var e=this,t=this.checkResponderCapture.bind(this);return m.create({onMoveShouldSetResponderCapture:t,onMoveShouldSetPanResponderCapture:t,onPanResponderGrant:function(t,n){var i=n.x0,a=n.y0;e._captured=!0,e.startDrag({x:i,y:a})},onPanResponderMove:function(t,n){e.onDragging(n)},onPanResponderRelease:function(){e._captured=!1,e.endDrag()}})}},{key:"checkResponderCapture",value:function(e,t){return this._captured||Math.abs(t.dx)>5||Math.abs(t.dy)>5}},{key:"reportAlertEvent",value:function(e){var t=this.insideAlertAreas,n=this.props.onAlert;this.propAreas.alert.forEach(function(i){var a=i.influence,r=i.id;a&&r&&(v.isPointInArea(e,a)?t[r]||(n({id:r,value:"enter"}),t[r]=1):t[r]&&(n({id:r,value:"leave"}),t[r]=0))})}},{key:"startDrag",value:function(e){var t=this.getAnimated(),n=t.x,i=t.y,a={x:n._value,y:i._value};if(n.setOffset(a.x),i.setOffset(a.y),n.setValue(0),i.setValue(0),this.lastEnd=a,this.dragBoundaries=this.propAreas.boundaries?this.propAreas.boundaries.influence:{},this.props.onDrag({state:"start",x:a.x,y:a.y}),this.dragStartLocation={x:e.x,y:e.y},this.animator.removeTempBehaviors(),this.animator.isDragging=!0,this.animator.vx=0,this.animator.vy=0,this.addTempDragBehavior(this.props.dragWithSpring),A){var r=document.body.style;this.userSelectCache=r.userSelect,r.userSelect="none"}}},{key:"onDragging",value:function(e){var t=e.dx,n=e.dy;if(!this.animator.isDragging)return!1;if(!this.props.dragEnabled)return this.endDrag();var i=this.lastEnd,a=t+i.x,r=n+i.y,o=this.dragBoundaries,s=o.minPoint,u=o.maxPoint;this.props.verticalOnly||(s&&(s.x>a&&(a=s.x),u.xr&&(r=s.y),u.y=n.length)){this.animator.removeTempBehaviors(),this.dragBehavior=null;var i=n[t];this.addTempSnapToPointBehavior(i),this.addTempBoundaries()}}},{key:"addTempBoundaries",value:function(){var e=this.propAreas.boundaries;e&&this.animator.addBehavior("bounce",e,!0)}},{key:"changePosition",value:function(e){this.dragBehavior||(this.setTranslation(e.x,e.y),this.endDrag())}},{key:"componentDidUpdate",value:function(e){this.setPropBehaviours(e,this.props)}},{key:"setPropBehaviours",value:function(e,t){var n=this;if(Object.keys(P).forEach(function(i){e[i]!==t[i]&&(n.animator.removeTypeBehaviors(P[i]),n.addTypeBehaviors(P[i],t[i]))}),e.alertAreas!==t.alertAreas){var i=[];t.alertAreas.forEach(function(e){i.push({id:e.id,influence:v.createArea(e.influenceArea)})}),this.propAreas.alert=i}if(e.boundaries!==t.boundaries)if(this.animator.removeBehavior(this.oldBoundariesBehavior),t.boundaries){var a={bounce:t.boundaries.bounce||0,influence:v.createArea(t.boundaries)};this.propAreas.boundaries=a,this.oldBoundariesBehavior=this.animator.addBehavior("bounce",a)}else this.propAreas.boundaries=!1;!this.props.dragEnabled&&e.dragEnabled&&this.dragBehavior&&this.endDrag()}},{key:"addTypeBehaviors",value:function(e,t,n){var i=this;t.forEach(function(t){return i.addBehavior(e,t,n)})}},{key:"addBehavior",value:function(e,t,n){if(this.animator.addBehavior(e,t,n),t.damping&&"friction"!==e){var i=this.animator.addBehavior("friction",t,n);"gravity"!==e||t.influenceArea||(i.influence=v.createAreaFromRadius(1.4*(t.falloff||40),t))}}}]),n}(),u(g,"propTypes",{snapPoints:t.array,frictionAreas:t.array,alertAreas:t.array,gravityPoints:t.array,horizontalOnly:t.bool,verticalOnly:t.bool,dragWithSpring:t.object,dragEnabled:t.bool,animatedValueX:t.instanceOf(y.Value),animatedValueY:t.instanceOf(y.Value),onSnap:t.func,onSnapStart:t.func,onEnd:t.func,onDrag:t.func,boundaries:t.object,initialPosition:t.object,dragToss:t.number}),u(g,"defaultProps",{snapPoints:[],frictionAreas:[],alertAreas:[],gravityPoints:[],boundaries:{},initialPosition:{x:0,y:0},dragToss:.1,dragEnabled:!0,onSnap:function(){},onSnapStart:function(){},onStop:function(){},onDrag:function(){},onAlert:function(){},style:{}}),b)}}); +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("prop-types"),require("animated/lib/targets/react-dom"),require("react-panresponder-web")):"function"==typeof define&&define.amd?define(["react","prop-types","animated/lib/targets/react-dom","react-panresponder-web"],t):e.Interactable=t(e.React,e.PropTypes,e.Animated,e.PanResponder)}(this,function(e,t,n,i){"use strict";var a="default"in e?e.default:e;function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;n=a.x&&n<=r.x&&i>=a.y&&i<=r.y},findClosest:function(e,t){var n=this,i=1/0,a=null;return t.forEach(function(t){var r=n.getDistance(t,e);r1&&void 0!==arguments[1]&&arguments[1];return{x0:e.x,y0:e.y,priority:1,isTemp:t,type:"anchor"}},doFrame:function(e,t,n,i){n.vx=(e.x0-i.x)/t,n.vy=(e.y0-i.y)/t}},bounce:{create:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{type:"bounce",bounce:f(e.bounce,.5),minPoint:e.influence.minPoint,maxPoint:e.influence.maxPoint,priority:3,isTemp:t}},doFrame:function(e,t,n,i,a){var r=e.minPoint,o=e.maxPoint,s=e.bounce,u=i.x,h=i.y;r.x>u&&a.setTranslationX(r.x),r.y>h&&a.setTranslationY(r.y),o.xu&&c<0&&(n.vx=-c*s),r.y>h&&d<0&&(n.vy=-d*s),o.x0&&(n.vx=-c*s),o.y0&&(n.vy=-d*s)}},friction:{create:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{type:"friction",damping:f(e.damping,.7),influence:v.createArea(e.influenceArea||{}),priority:2,isTemp:t}},doFrame:function(e,t,n,i){if(v.isPointInArea(i,e.influence)){var a=Math.pow(e.damping,60*t);n.vx=a*n.vx,n.vy=a*n.vy}}},gravity:{create:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{type:"gravity",x0:f(e.x,1/0),y0:f(e.y,1/0),strength:f(e.strength,400),falloff:f(e.falloff,40),damping:f(e.damping,0),influence:v.createArea(e.influenceArea||{}),isTemp:t,priority:1}},doFrame:function(e,t,n,i){if(v.isPointInArea(i,e.influence)){var a=e.x0!==1/0?i.x-e.x0:0,r=e.y0!==1/0?i.y-e.y0:0,o=Math.sqrt(a*a+r*r);if(o){var s=e.falloff,u=-e.strength*o*Math.exp(o*o*-.5/(s*s))/n.mass,h=a/o*u,c=r/o*u;n.vx+=t*h,n.vy+=t*c}}}},spring:{create:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{type:"spring",x0:f(e.x,0),y0:f(e.y,0),tension:f(e.tension,300),influence:v.createArea(e.influenceArea||{}),isTemp:t,priority:1}},doFrame:function(e,t,n,i){if(v.isPointInArea(i,e.influence)){var a=i.x-e.x0;a&&(n.vx+=t*(-1*e.tension*a/n.mass));var r=i.y-e.y0;r&&(n.vy+=t*(-1*e.tension*r/n.mass))}}}};"undefined"==typeof requestAnimationFrame&&(requestAnimationFrame=function(){});var y,m,g,b,x=function(){function e(t,n,i){if(r(this,e),u(this,"behaviors",[]),u(this,"physicsObject",{vx:0,vy:0,mass:1}),u(this,"consecutiveFramesWithNoMovement",0),u(this,"screenScale",1),u(this,"lastFrameTS",0),u(this,"isRunning",!1),u(this,"ticking",!1),u(this,"isDragging",!1),this.View=t,this.animatorListener=n,!i){var a=function(){};this.debugStart=a,this.debugEnd=a}}return s(e,[{key:"doFrame",value:function(e){var t=this;this.isRunning&&(this.lastFrameTS&&this.animateFrameWithDeltaTime(.001*(e-this.lastFrameTS)),this.lastFrameTS=e,this.animatorListener.onAnimationFrame(),requestAnimationFrame(function(){return t.doFrame(Date.now())}))}},{key:"debugStart",value:function(e){!0!==this.debug&&this.debug!==e.type||(this.debugB=e,this.debugInitialV=Object.assign({},this.physicsObject))}},{key:"debugEnd",value:function(){!this.debugB||!0!==this.debug&&this.debug!==this.debugB.type||console.log("Debug ".concat(this.debugB.type),{dvx:this.physicsObject.vx-this.debugInitialV.vx,dvy:this.physicsObject.vy-this.debugInitialV.vy})}},{key:"animateFrameWithDeltaTime",value:function(e){var t=this;if(e){var n=this.physicsObject,i=this.behaviors,a=this.View,r=!1,o=a.getTranslation();i.forEach(function(i){t.debugStart(i),p[i.type].doFrame(i,e,n,o,a),t.debugEnd()});var s=0,u=n.vx,h=n.vy;Math.abs(u)>1&&(s=e*u,r=!0);var c=0;Math.abs(h)>1&&(c=e*h,r=!0),a.animate(s,c);var d=r?0:this.consecutiveFramesWithNoMovement+1;this.consecutiveFramesWithNoMovement=d,d>=10&&!this.isDragging&&(this.stopRunning(),this.animatorListener.onAnimatorPause())}}},{key:"addBehavior",value:function(e,t,n){var i=p[e];if(i){for(var a=i.create(t,n),r=this.behaviors,o=0;r.length>o&&r[o].priority<=a.priority;)++o;return r.splice(o,0,a),this.ensureRunning(),a}}},{key:"remove",value:function(e){for(var t=this.behaviors,n=t.length;n-- >0;)e(t[n])&&t.splice(n,1)}},{key:"removeBehavior",value:function(e){this.remove(function(t){return t===e})}},{key:"removeTypeBehaviors",value:function(e){this.remove(function(t){return t.type===e})}},{key:"removeTempBehaviors",value:function(){this.remove(function(e){return e.isTemp})}},{key:"getVelocity",value:function(){return{x:this.physicsObject.vx,y:this.physicsObject.vy}}},{key:"ensureRunning",value:function(){this.isRunning||this.startRunning()}},{key:"startRunning",value:function(){var e=this;this.isRunning=!0,this.lastFrameTS=0,this.consecutiveFramesWithNoMovement=0,requestAnimationFrame(function(){return e.doFrame(Date.now())})}},{key:"stopRunning",value:function(){this.removeTempBehaviors(),this.physicsObject={vx:0,vy:0,mass:this.physicsObject.mass},this.isRunning=!1}}]),e}(),P={frictionAreas:"friction",gravityPoints:"gravity",springPoints:"spring"},A="undefined"!=typeof document;return n.View=function(e){var t=e.style||{},i=Object.assign({position:"relative",display:"flex"},t);return a.createElement(n.div,h({},e,{style:i}),e.children)},{View:(y=n,m=i,b=g=function(t){function n(e){var t,i,a;r(this,n),i=this,t=!(a=c(n).call(this,e))||"object"!=typeof a&&"function"!=typeof a?l(i):a,u(l(l(t)),"initialPositionSet",!1),u(l(l(t)),"isDragging",!1);var o=e.initialPosition,s=o.x,h=void 0===s?0:s,d=o.y,v=void 0===d?0:d;t.animated=new y.ValueXY({x:h,y:v}),t.animator=t.createAnimator(e),t.insideAlertAreas={},t.propAreas={alert:[],boundaries:!1},t._pr=t.createPanResponder(e),t.setPropBehaviours({},e);var f=t.getAnimated(e);return f.x.setValue(h),f.y.setValue(v),f.x._startingValue=h,f.y._startingValue=v,t.lastEnd=Object.assign({},t.initialPosition),t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&d(e,t)}(n,e.Component),s(n,[{key:"render",value:function(){var e=this.getAnimated(),t=e.x,n=e.y,i=this.props.style,r=Object.assign({transform:[{translateX:t},{translateY:n}].concat(i.transform||[])},i),o=this.props.dragEnabled?this._pr.panHandlers:{};return a.createElement(y.View,h({style:r},o),this.props.children)}},{key:"getTranslation",value:function(){var e=this.getAnimated(),t=e.x,n=e.y;return{x:t._value+t._offset,y:n._value+n._offset}}},{key:"setTranslationX",value:function(e){var t=this.props.animatedValueX||this.animated.x;t.setValue(e-t._offset)}},{key:"setTranslationY",value:function(e){var t=this.props.animatedValueY||this.animated.y;t.setValue(e-t._offset)}},{key:"setTranslation",value:function(e,t){this.setTranslationX(e),this.setTranslationY(t)}},{key:"createAnimator",value:function(){var e=this;return new x(this,{onAnimatorPause:function(){var t=e.getTranslation(),n=t.x,i=t.y;e.lastEnd={x:Math.round(n),y:Math.round(i)},e.props.onStop(e.lastEnd)},onAnimationFrame:function(){e.reportAlertEvent(e.getTranslation())}},!1)}},{key:"animate",value:function(e,t){if(e||t){var n=this.getTranslation(),i=n.x,a=n.y;this.setTranslation(i+e,a+t)}}},{key:"getAnimated",value:function(e){var t=e||this.props,n=t.animatedValueX,i=t.animatedValueY;return{x:n||this.animated.x,y:i||this.animated.y}}},{key:"createPanResponder",value:function(){var e=this,t=this.checkResponderCapture.bind(this);return m.create({onMoveShouldSetResponderCapture:t,onMoveShouldSetPanResponderCapture:t,onPanResponderGrant:function(t,n){var i=n.x0,a=n.y0;e._captured=!0,e.startDrag({x:i,y:a})},onPanResponderMove:function(t,n){e.onDragging(n)},onPanResponderRelease:function(){e._captured=!1,e.endDrag()}})}},{key:"checkResponderCapture",value:function(e,t){return this._captured||Math.abs(t.dx)>5||Math.abs(t.dy)>5}},{key:"reportAlertEvent",value:function(e){var t=this.insideAlertAreas,n=this.props.onAlert;this.propAreas.alert.forEach(function(i){var a=i.influence,r=i.id;a&&r&&(v.isPointInArea(e,a)?t[r]||(n({id:r,value:"enter"}),t[r]=1):t[r]&&(n({id:r,value:"leave"}),t[r]=0))})}},{key:"startDrag",value:function(e){var t=this.getAnimated(),n=t.x,i=t.y,a={x:n._value,y:i._value};if(n.setOffset(a.x),i.setOffset(a.y),n.setValue(0),i.setValue(0),this.lastEnd=a,this.dragBoundaries=this.propAreas.boundaries?this.propAreas.boundaries.influence:{},this.props.onDrag({state:"start",x:a.x,y:a.y}),this.dragStartLocation={x:e.x,y:e.y},this.animator.removeTempBehaviors(),this.animator.isDragging=!0,this.animator.vx=0,this.animator.vy=0,this.addTempDragBehavior(this.props.dragWithSpring),A){var r=document.body.style;this.userSelectCache=r.userSelect,r.userSelect="none"}}},{key:"onDragging",value:function(e){var t=e.dx,n=e.dy;if(!this.animator.isDragging)return!1;if(!this.props.dragEnabled)return this.endDrag();var i=this.lastEnd,a=t+i.x,r=n+i.y,o=this.dragBoundaries,s=o.minPoint,u=o.maxPoint;this.props.verticalOnly||(s&&(s.x>a&&(a=s.x),u.xr&&(r=s.y),u.y=n.length)){this.animator.removeTempBehaviors(),this.dragBehavior=null;var i=n[t];this.addTempSnapToPointBehavior(i),this.addTempBoundaries()}}},{key:"addTempBoundaries",value:function(){var e=this.propAreas.boundaries;e&&this.animator.addBehavior("bounce",e,!0)}},{key:"changePosition",value:function(e){this.dragBehavior||(this.setTranslation(e.x,e.y),this.endDrag())}},{key:"componentDidUpdate",value:function(e){this.setPropBehaviours(e,this.props)}},{key:"setPropBehaviours",value:function(e,t){var n=this;if(Object.keys(P).forEach(function(i){e[i]!==t[i]&&(n.animator.removeTypeBehaviors(P[i]),n.addTypeBehaviors(P[i],t[i]))}),e.alertAreas!==t.alertAreas){var i=[];t.alertAreas.forEach(function(e){i.push({id:e.id,influence:v.createArea(e.influenceArea)})}),this.propAreas.alert=i}if(e.boundaries!==t.boundaries)if(this.animator.removeBehavior(this.oldBoundariesBehavior),t.boundaries){var a={bounce:t.boundaries.bounce||0,influence:v.createArea(t.boundaries)};this.propAreas.boundaries=a,this.oldBoundariesBehavior=this.animator.addBehavior("bounce",a)}else this.propAreas.boundaries=!1;!this.props.dragEnabled&&e.dragEnabled&&this.dragBehavior&&this.endDrag()}},{key:"addTypeBehaviors",value:function(e,t,n){var i=this;t.forEach(function(t){return i.addBehavior(e,t,n)})}},{key:"addBehavior",value:function(e,t,n){if(this.animator.addBehavior(e,t,n),t.damping&&"friction"!==e){var i=this.animator.addBehavior("friction",t,n);"gravity"!==e||t.influenceArea||(i.influence=v.createAreaFromRadius(1.4*(t.falloff||40),t))}}}]),n}(),u(g,"propTypes",{snapPoints:t.array,frictionAreas:t.array,alertAreas:t.array,gravityPoints:t.array,horizontalOnly:t.bool,verticalOnly:t.bool,dragWithSpring:t.object,dragEnabled:t.bool,animatedValueX:t.instanceOf(y.Value),animatedValueY:t.instanceOf(y.Value),onSnap:t.func,onSnapStart:t.func,onEnd:t.func,onDrag:t.func,boundaries:t.object,initialPosition:t.object,dragToss:t.number}),u(g,"defaultProps",{snapPoints:[],frictionAreas:[],alertAreas:[],gravityPoints:[],boundaries:{},initialPosition:{x:0,y:0},dragToss:.1,dragEnabled:!0,onSnap:function(){},onSnapStart:function(){},onStop:function(){},onDrag:function(){},onAlert:function(){},style:{}}),b)}}); //# sourceMappingURL=interactable.noNative.min.js.map diff --git a/dist/interactable.noNative.min.js.map b/dist/interactable.noNative.min.js.map index 4cc39b4..10ee46d 100644 --- a/dist/interactable.noNative.min.js.map +++ b/dist/interactable.noNative.min.js.map @@ -1 +1 @@ -{"version":3,"file":"interactable.noNative.min.js","sources":["../playground/src/react-interactable/Utils.js","../playground/src/react-interactable/Behaviors.js","../playground/src/react-interactable/Animator.js","../playground/src/react-interactable/InteractableView.js","../playground/src/react-interactable/noNative.js","../playground/src/react-interactable/AnimatedView.js"],"sourcesContent":["export default {\r\n\tcreateArea: function( boundaries ){\r\n\t\treturn {\r\n\t\t\tminPoint: {\r\n\t\t\t\tx: boundaries.left === undefined ? -Infinity : boundaries.left,\r\n\t\t\t\ty: boundaries.top === undefined ? -Infinity : boundaries.top\r\n\t\t\t},\r\n\t\t\tmaxPoint: {\r\n\t\t\t\tx: boundaries.right === undefined ? Infinity : boundaries.right,\r\n\t\t\t\ty: boundaries.bottom === undefined ? Infinity : boundaries.bottom\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\tcreateAreaFromRadius: function( radius, anchor ){\r\n\t\treturn {\r\n\t\t\tminPoint: {x: anchor.x - radius, y: anchor.y - radius},\r\n\t\t\tmaxPoint: {x: anchor.x + radius, y: anchor.y + radius}\r\n\t\t}\r\n\t},\r\n\tisPointInArea: function( {x, y}, area ){\r\n\t\tif( !area ) return true\r\n\r\n\t\tlet { minPoint, maxPoint } = area\r\n\r\n\t\treturn x>=minPoint.x && x <= maxPoint.x && y >= minPoint.y && y <= maxPoint.y\r\n\t},\r\n\tfindClosest: function( origin, points ){\r\n\t\tlet minDistance = Infinity;\r\n\t\tlet closestPoint = null;\r\n\t\tlet distances = []\r\n\t\tpoints.forEach( point => {\r\n\t\t\tlet distance = this.getDistance( point, origin );\r\n\t\t\tdistances.push( distance )\r\n\t\t\tif (distance < minDistance) {\r\n\t\t\t\tminDistance = distance;\r\n\t\t\t\tclosestPoint = point;\r\n\t\t\t}\r\n\t\t})\r\n\t\t// console.log( distances )\r\n\t\treturn closestPoint\r\n\t},\r\n\tgetDistance( point, relative ){\r\n\t\tlet p = {x: point.x === undefined ? Infinity : point.x, y: point.y === undefined ? Infinity : point.y }\r\n\t\tlet r = {x: relative.x === undefined ? Infinity : relative.x, y: relative.y === undefined ? Infinity : relative.y }\r\n\t\tif( p.x === Infinity && p.y === Infinity ) return Infinity\r\n\t\tlet dx = p.x === Infinity ? 0 : Math.abs(r.x - p.x)\r\n\t\tlet dy = p.y === Infinity ? 0 : Math.abs(r.y - p.y)\r\n\t\t\r\n\t\treturn Math.sqrt( dx*dx + dy*dy )\r\n\t},\r\n\tgetDelta( point, origin ){\r\n\t\treturn {\r\n\t\t\tx: point.x - origin.x,\r\n\t\t\ty: point.y - origin.y\r\n\t\t}\r\n\t}\r\n}","import Utils from './Utils'\r\n\r\nfunction def( value, defaultValue ){\r\n\treturn value === undefined ? defaultValue : value\r\n}\r\n\r\nexport default {\r\n\tanchor: {\r\n\t\tcreate: (options, isTemp = false) => (\r\n\t\t\t{ x0: options.x, y0: options.y, priority: 1, isTemp, type: 'anchor' }\r\n\t\t),\r\n\t\tdoFrame: (options, deltaTime, state, coords ) => {\r\n\t\t\t// Velocity = dx / deltaTime\r\n\t\t\tstate.vx = (options.x0 - coords.x) / deltaTime\r\n\t\t\tstate.vy = (options.y0 - coords.y) / deltaTime\r\n\t\t}\r\n\t},\r\n\r\n\tbounce: {\r\n\t\tcreate: (options, isTemp = false) => ({\r\n\t\t\ttype: 'bounce',\r\n\t\t\tbounce: def(options.bounce, .5),\r\n\t\t\tminPoint: options.influence.minPoint,\r\n\t\t\tmaxPoint: options.influence.maxPoint,\r\n\t\t\tpriority: 3,\r\n\t\t\tisTemp\r\n\t\t}),\r\n\t\tdoFrame: ({minPoint, maxPoint, bounce}, deltaTime, state, {x,y}, target ) => {\r\n\t\t\t// Apply limits\r\n\r\n\t\t\tif (minPoint.x > x) target.setTranslationX(minPoint.x);\r\n\t\t\tif (minPoint.y > y) target.setTranslationY(minPoint.y);\r\n\t\t\tif (maxPoint.x < x) target.setTranslationX(maxPoint.x);\r\n\t\t\tif (maxPoint.y < y) target.setTranslationY(maxPoint.y);\r\n\r\n\t\t\tlet { vx, vy } = state\r\n\r\n\t\t\tif (minPoint.x > x && vx < 0) {\r\n\t\t\t\tstate.vx = -vx * bounce\r\n\t\t\t}\r\n\t\t\tif (minPoint.y > y && vy < 0) {\r\n\t\t\t\tstate.vy= -vy * bounce\r\n\t\t\t}\r\n\t\t\tif (maxPoint.x < x && vx > 0) {\r\n\t\t\t\tstate.vx = -vx * bounce\r\n\t\t\t}\r\n\t\t\tif (maxPoint.y < y && vy > 0) {\r\n\t\t\t\tstate.vy = -vy * bounce\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\tfriction: {\r\n\t\tcreate: ( options, isTemp = false ) => ({\r\n\t\t\ttype: 'friction',\r\n\t\t\tdamping: def(options.damping, .7),\r\n\t\t\tinfluence: Utils.createArea( options.influenceArea || {} ),\r\n\t\t\tpriority: 2,\r\n\t\t\tisTemp\r\n\t\t}),\r\n\t\tdoFrame: (options, deltaTime, state, coords) => {\r\n\t\t\tif( !Utils.isPointInArea( coords, options.influence) ) return;\r\n\t\t\t\r\n\t\t\tlet pow = Math.pow(options.damping, 60.0 * deltaTime)\r\n\t\t\tstate.vx = pow * state.vx\r\n\t\t\tstate.vy = pow * state.vy\r\n\t\t}\r\n\t},\r\n\r\n\tgravity: {\r\n\t\tcreate: ( options, isTemp = false ) => ({\r\n\t\t\ttype: 'gravity',\r\n\t\t\tx0: def(options.x, Infinity),\r\n\t\t\ty0: def(options.y, Infinity),\r\n\t\t\tstrength: def(options.strength, 400),\r\n\t\t\tfalloff: def(options.falloff, 40),\r\n\t\t\tdamping: def(options.damping, 0),\r\n\t\t\tinfluence: Utils.createArea(options.influenceArea || {}),\r\n\t\t\tisTemp,\r\n\t\t\tpriority: 1\r\n\t\t}),\r\n\t\tdoFrame: (options, deltaTime, state, coords) => {\r\n\t\t\tif( !Utils.isPointInArea( coords, options.influence) ) return;\r\n\r\n\t\t\tlet dx = options.x0 !== Infinity ? coords.x - options.x0 : 0;\r\n\t\t\tlet dy = options.y0 !== Infinity ? coords.y - options.y0 : 0;\r\n\t\t\tlet dr = Math.sqrt(dx * dx + dy * dy);\r\n\r\n\t\t\tif (!dr) return;\r\n\r\n\t\t\tlet { falloff, strength } = options\r\n\t\t\tlet a = (-strength * dr * Math.exp(-0.5 * (dr * dr) / (falloff * falloff))) / state.mass;\r\n\r\n\t\t\tlet ax = dx / dr * a;\r\n\t\t\tlet ay = dy / dr * a;\r\n\r\n\t\t\tstate.vx += deltaTime * ax\r\n\t\t\tstate.vy += deltaTime * ay\r\n\t\t}\r\n\t},\r\n\r\n\tspring: {\r\n\t\tcreate: ( options, isTemp = false ) => ({\r\n\t\t\ttype: 'spring',\r\n\t\t\tx0: def(options.x, 0),\r\n\t\t\ty0: def(options.y, 0),\r\n\t\t\ttension: def(options.tension, 300),\r\n\t\t\tinfluence: Utils.createArea( options.influenceArea || {} ),\r\n\t\t\tisTemp,\r\n\t\t\tpriority: 1\r\n\t\t}),\r\n\t\tdoFrame: ( options, deltaTime, state, coords) => {\r\n\t\t\tif( !Utils.isPointInArea( coords, options.influence) ) return;\r\n\t\r\n\t\t\tlet dx = coords.x - options.x0;\r\n\t\t\tif( dx ){\r\n\t\t\t\t// time * acceleration\r\n\t\t\t\tstate.vx += deltaTime * ((-1 * options.tension * dx) / state.mass)\r\n\t\t\t}\r\n\t\r\n\t\t\tlet dy = coords.y - options.y0;\r\n\t\t\tif( dy ){\r\n\t\t\t\t// time * acceleration\r\n\t\t\t\tstate.vy += deltaTime * ((-1 * options.tension * dy) / state.mass)\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}","import Behaviors from './Behaviors'\r\n\r\nconst ANIMATOR_PAUSE_CONSECUTIVE_FRAMES = 10;\r\nconst ANIMATOR_PAUSE_ZERO_VELOCITY = 1.0;\r\n\r\nif( typeof requestAnimationFrame === 'undefined' ){\r\n\t// We just don't work without raf (maybe we are in the server)\r\n\t// eslint-disable-next-line no-native-reassign\r\n\trequestAnimationFrame = function(){}\r\n}\r\n\r\nclass PhysicsAnimator {\r\n\tbehaviors = []\r\n\tphysicsObject = {vx: 0, vy: 0, mass: 1}\r\n\tconsecutiveFramesWithNoMovement = 0\r\n\tscreenScale = 1\r\n\tlastFrameTS = 0\r\n\tisRunning = false\r\n\tticking = false\r\n\tisDragging = false\r\n\r\n\tconstructor( View, listener, debug ){\r\n\t\tthis.View = View\r\n\t\tthis.animatorListener = listener\r\n\t\tif( !debug ){\r\n\t\t\tlet nofn = function(){}\r\n\t\t\tthis.debugStart = nofn;\r\n\t\t\tthis.debugEnd = nofn;\r\n\t\t}\r\n\t}\r\n\r\n\tdoFrame( frameTimeMillis ) {\r\n\t\tif( !this.isRunning ) return;\r\n\r\n\t\tif ( this.lastFrameTS ) {\r\n\t\t\tthis.animateFrameWithDeltaTime(\r\n\t\t\t\t(frameTimeMillis - this.lastFrameTS) * 1e-3\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\tthis.lastFrameTS = frameTimeMillis;\r\n\t\tthis.animatorListener.onAnimationFrame();\r\n\t\trequestAnimationFrame( () => this.doFrame( Date.now() ) )\r\n\t}\r\n\r\n\tdebugStart( behavior ){\r\n\t\tif( this.debug !== true && this.debug !== behavior.type ) return;\r\n\t\tthis.debugB = behavior\r\n\t\tthis.debugInitialV = {...this.physicsObject}\r\n\t}\r\n\r\n\tdebugEnd() {\r\n\t\tif (!this.debugB || (this.debug !== true && this.debug !== this.debugB.type)) return;\r\n\t\tconsole.log( `Debug ${this.debugB.type}`, {\r\n\t\t\tdvx: this.physicsObject.vx - this.debugInitialV.vx,\r\n\t\t\tdvy: this.physicsObject.vy - this.debugInitialV.vy,\r\n\t\t})\r\n\t}\r\n\t\r\n\tanimateFrameWithDeltaTime( deltaTime ) {\r\n\t\tif( !deltaTime ) return;\r\n\r\n\t\tlet { physicsObject, behaviors, View } = this\r\n\t\tlet hadMovement = false\r\n\t\tlet coords = View.getTranslation()\r\n\r\n\t\tbehaviors.forEach( behavior => {\r\n\t\t\tthis.debugStart( behavior )\r\n\t\t\tBehaviors[ behavior.type ].doFrame( behavior, deltaTime, physicsObject, coords, View )\r\n\t\t\tthis.debugEnd()\r\n\t\t})\r\n\r\n\t\tlet dx = 0;\r\n\t\tlet {vx,vy} = physicsObject\r\n\t\t\r\n\t\tif ( Math.abs(vx) > ANIMATOR_PAUSE_ZERO_VELOCITY ) {\r\n\t\t\tdx = deltaTime * vx;\r\n\t\t\thadMovement = true;\r\n\t\t}\r\n\r\n\t\tlet dy = 0;\r\n\t\tif ( Math.abs(vy) > ANIMATOR_PAUSE_ZERO_VELOCITY ) {\r\n\t\t\tdy = deltaTime * vy;\r\n\t\t\thadMovement = true;\r\n\t\t}\r\n\t\t\r\n\t\tView.animate( dx, dy )\r\n\r\n\t\tlet cfwnm = hadMovement ? 0 : this.consecutiveFramesWithNoMovement + 1\r\n\t\tthis.consecutiveFramesWithNoMovement = cfwnm\r\n\r\n\t\tif (cfwnm >= ANIMATOR_PAUSE_CONSECUTIVE_FRAMES && !this.isDragging ) {\r\n\t\t\tthis.stopRunning();\r\n\t\t\tthis.animatorListener.onAnimatorPause();\r\n\t\t}\r\n\t}\r\n\r\n\taddBehavior( type, options, isTemp ){\r\n\t\tlet b = Behaviors[ type ]\r\n\t\tif( !b ) return;\r\n\r\n\t\tlet behavior = b.create( options, isTemp )\r\n\t\tlet behaviors = this.behaviors\r\n\t\tlet idx = 0\r\n\r\n\t\twhile (behaviors.length > idx && behaviors[idx].priority <= behavior.priority) {\r\n\t\t\t++idx;\r\n\t\t}\r\n\t\tbehaviors.splice( idx, 0, behavior )\r\n\r\n\t\tthis.ensureRunning()\r\n\t\treturn behavior\r\n\t}\r\n\r\n\tremove( condition ){\r\n\t\tlet behaviors = this.behaviors\r\n\t\tlet i = behaviors.length\r\n\t\twhile( i-- > 0 ){\r\n\t\t\tif( condition(behaviors[i]) ){\r\n\t\t\t\tbehaviors.splice( i, 1 )\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tremoveBehavior( behavior ) {\r\n\t\tthis.remove( target => target === behavior )\r\n\t}\r\n\r\n\tremoveTypeBehaviors( type ){\r\n\t\tthis.remove( target => target.type === type )\r\n\t}\r\n\t\r\n\tremoveTempBehaviors(){\r\n\t\tthis.remove( target => target.isTemp )\r\n\t}\r\n\t\r\n\tgetVelocity(){ \r\n\t\treturn { x: this.physicsObject.vx, y: this.physicsObject.vy }\r\n\t}\r\n\r\n\tensureRunning() {\r\n\t\tthis.isRunning || this.startRunning()\r\n\t}\r\n\r\n\tstartRunning() {\r\n\t\tthis.isRunning = true;\r\n\t\tthis.lastFrameTS = 0;\r\n\t\tthis.consecutiveFramesWithNoMovement = 0;\r\n\t\trequestAnimationFrame( () => this.doFrame( Date.now() ) )\r\n\t}\r\n\r\n\tstopRunning() {\r\n\t\tthis.removeTempBehaviors();\r\n\t\tthis.physicsObject = {vx: 0, vy: 0, mass: this.physicsObject.mass}\r\n\t\tthis.isRunning = false;\r\n\t}\r\n}\r\n\r\nexport default PhysicsAnimator","import React, { Component } from 'react'\nimport PropTypes from 'prop-types'\nimport Animator from './Animator'\nimport Utils from './Utils';\n\nconst propBehaviors = {\n\tfrictionAreas: 'friction',\n\tgravityPoints: 'gravity',\n\tspringPoints: 'spring',\n}\n\nconst isWeb = typeof document !== 'undefined'\n\nexport default function injectDependencies( Animated, PanResponder ){\n\n\treturn class InteractableView extends Component {\n\t\tstatic propTypes = {\n\t\t\tsnapPoints: PropTypes.array,\n\t\t\tfrictionAreas: PropTypes.array,\n\t\t\talertAreas: PropTypes.array,\n\t\t\tgravityPoints: PropTypes.array,\n\t\t\thorizontalOnly: PropTypes.bool,\n\t\t\tverticalOnly: PropTypes.bool,\n\t\t\tdragWithSpring: PropTypes.object,\n\t\t\tdragEnabled: PropTypes.bool,\n\t\t\tanimatedValueX: PropTypes.instanceOf(Animated.Value),\n\t\t\tanimatedValueY: PropTypes.instanceOf(Animated.Value),\n\t\t\tonSnap: PropTypes.func,\n\t\t\tonSnapStart: PropTypes.func,\n\t\t\tonEnd: PropTypes.func,\n\t\t\tonDrag: PropTypes.func,\n\t\t\tboundaries: PropTypes.object,\n\t\t\tinitialPosition: PropTypes.object,\n\t\t\tdragToss: PropTypes.number\n\t\t}\n\n\t\tstatic defaultProps = {\n\t\t\tsnapPoints: [],\n\t\t\tfrictionAreas: [],\n\t\t\talertAreas: [],\n\t\t\tgravityPoints: [],\n\t\t\tboundaries: {},\n\t\t\tinitialPosition: {x: 0, y: 0},\n\t\t\tdragToss: .1,\n\t\t\tdragEnabled: true,\n\t\t\tonSnap: function () { },\n\t\t\tonSnapStart: function () { },\n\t\t\tonStop: function () { },\n\t\t\tonDrag: function () { },\n\t\t\tonAlert: function () { },\n\t\t\tstyle: {}\n\t\t}\n\n\t\tinitialPositionSet = false\n\t\tisDragging = false\n\n\t\tconstructor(props) {\n\t\t\tsuper(props)\n\n\t\t\tlet { x=0, y=0 } = props.initialPosition\n\n\t\t\t// In case animatedValueXY is not given\n\t\t\tthis.animated = new Animated.ValueXY({x, y})\n\n\t\t\t// This guy will apply all the physics\n\t\t\tthis.animator = this.createAnimator( props )\n\n\t\t\t// Cache when the view is inside of an alert area\n\t\t\tthis.insideAlertAreas = {}\n\n\t\t\t// cache calculated areas\n\t\t\tthis.propAreas = {\n\t\t\t\talert: [],\n\t\t\t\tboundaries: false\n\t\t\t}\n\n\t\t\tthis._pr = this.createPanResponder(props)\n\t\t\t\n\t\t\t// Set behaviors and prop defaults\n\t\t\tthis.setPropBehaviours( {}, props )\n\n\t\t\t// Set initial position\n\t\t\tlet animated = this.getAnimated( props )\n\t\t\tanimated.x.setValue( x )\n\t\t\tanimated.y.setValue(y)\n\t\t\tanimated.x._startingValue = x\n\t\t\tanimated.y._startingValue = y\n\t\t\t\n\t\t\t// Save the last animation end position to report good coordinates in the events\n\t\t\tthis.lastEnd = {...this.initialPosition}\n\t\t}\n\n\t\trender() {\n\t\t\tlet { x, y } = this.getAnimated()\n\t\t\tlet style = this.props.style\n\t\t\tlet withPosition = {\n\t\t\t\ttransform: [{ translateX: x }, { translateY: y }].concat( style.transform || [] ),\n\t\t\t\t...style\n\t\t\t}\n\n\t\t\tlet panHandlers = this.props.dragEnabled ? this._pr.panHandlers : {}\n\n\t\t\treturn (\n\t\t\t\t\n\t\t\t\t\t{this.props.children}\n\t\t\t\t\n\t\t\t)\n\t\t}\n\n\t\tgetTranslation(){\n\t\t\tlet {x, y} = this.getAnimated()\n\t\t\treturn {\n\t\t\t\tx: x._value + x._offset,\n\t\t\t\ty: y._value + y._offset\n\t\t\t}\n\t\t}\n\n\t\tsetTranslationX( tx ){\n\t\t\tlet animated = this.props.animatedValueX || this.animated.x\n\t\t\tanimated.setValue( tx - animated._offset )\n\t\t}\n\n\t\tsetTranslationY(ty) {\n\t\t\tlet animated = this.props.animatedValueY || this.animated.y\n\t\t\tanimated.setValue( ty - animated._offset )\n\t\t}\n\n\t\tsetTranslation( tx, ty ){\n\t\t\tthis.setTranslationX( tx )\n\t\t\tthis.setTranslationY( ty )\n\t\t}\n\n\t\tcreateAnimator(){\n\t\t\treturn new Animator( this, {\n\t\t\t\tonAnimatorPause: () => {\n\t\t\t\t\tlet { x, y } = this.getTranslation()\n\t\t\t\t\tthis.lastEnd = {x: Math.round(x), y: Math.round(y)}\n\t\t\t\t\tthis.props.onStop( this.lastEnd )\n\t\t\t\t},\n\t\t\t\tonAnimationFrame: () => {\n\t\t\t\t\tthis.reportAlertEvent( this.getTranslation() )\n\t\t\t\t}\n\t\t\t},\n\t\t\tfalse // Set true or behavior type to output debug info in the console\n\t\t\t)\n\t\t}\n\n\t\tanimate( dx, dy ){\n\t\t\tif(!dx && !dy) return\n\t\t\t// let animated = this.getAnimated()\n\t\t\t// console.log( dx + animated.x._value + animated.x._offset )\n\n\t\t\tlet {x,y} = this.getTranslation()\n\t\t\tthis.setTranslation( x + dx, y + dy ) \n\t\t}\n\n\t\tgetAnimated( props ){\n\t\t\tlet { animatedValueX, animatedValueY } = (props || this.props)\n\n\t\t\treturn {\n\t\t\t\tx: animatedValueX || this.animated.x ,\n\t\t\t\ty: animatedValueY || this.animated.y\n\t\t\t}\n\t\t}\n\n\t\tcreatePanResponder() {\n\t\t\tlet capturer = this.checkResponderCapture.bind(this)\n\t\t\t\n\t\t\treturn PanResponder.create({\n\t\t\t\tonMoveShouldSetResponderCapture: capturer,\n\t\t\t\tonMoveShouldSetPanResponderCapture: capturer,\n\n\t\t\t\tonPanResponderGrant: (e, {x0, y0}) => {\t\n\t\t\t\t\tthis._captured = true;\n\t\t\t\t\tthis.startDrag( {x: x0, y: y0} )\n\t\t\t\t},\n\n\t\t\t\tonPanResponderMove: (e, gesture ) => {\n\t\t\t\t\tthis.onDragging( gesture )\n\t\t\t\t},\n\n\t\t\t\tonPanResponderRelease: () => {\n\t\t\t\t\tthis._captured = false;\n\t\t\t\t\tthis.endDrag()\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\n\t\tcheckResponderCapture( e, gesture ){\n\t\t\treturn this._captured || Math.abs( gesture.dx ) > 5 || Math.abs( gesture.dy ) > 5;\n\t\t}\n\n\t\treportAlertEvent( position ){\n\t\t\tlet inside = this.insideAlertAreas\n\t\t\tlet { onAlert } = this.props\n\n\t\t\tthis.propAreas.alert.forEach( ({ influence, id }) => {\n\t\t\t\tif ( !influence || !id ) return;\n\n\t\t\t\tif ( Utils.isPointInArea( position, influence ) ) {\n\t\t\t\t\tif ( !inside[id] ) {\n\t\t\t\t\t\tonAlert({id, value:\"enter\"});\n\t\t\t\t\t\tinside[id] = 1;\n\t\t\t\t\t}\n\t\t\t\t} else if (inside[id]) {\n\t\t\t\t\tonAlert({ id, value: \"leave\" });\n\t\t\t\t\tinside[id] = 0;\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\n\t\tstartDrag( ev ){\n\t\t\t// Prepare the animated\n\t\t\tlet {x,y} = this.getAnimated()\n\t\t\tlet offset = {x: x._value, y: y._value}\n\t\t\tx.setOffset( offset.x )\n\t\t\ty.setOffset( offset.y )\n\t\t\tx.setValue( 0 )\n\t\t\ty.setValue( 0 )\n\n\t\t\t// Save the offset for triggering events with the right coordinates\n\t\t\tthis.lastEnd = offset\n\t\t\t// console.log( offset )\n\n\t\t\t// Set boundaries to fast access\n\t\t\tthis.dragBoundaries = this.propAreas.boundaries ? this.propAreas.boundaries.influence : {}\n\n\t\t\t// Prepare the animation\n\t\t\tthis.props.onDrag({state: 'start', x: offset.x, y: offset.y})\n\t\t\tthis.dragStartLocation = { x: ev.x, y: ev.y }\n\t\t\tthis.animator.removeTempBehaviors();\n\t\t\tthis.animator.isDragging = true\n\t\t\tthis.animator.vx = 0\n\t\t\tthis.animator.vy = 0\n\t\t\tthis.addTempDragBehavior( this.props.dragWithSpring );\n\n\t\t\t// Stop text selection\n\t\t\tif ( isWeb ) {\n\t\t\t\tlet styles = document.body.style\n\t\t\t\tthis.userSelectCache = styles.userSelect\n\t\t\t\tstyles.userSelect = \"none\"\n\t\t\t}\n\t\t}\n\n\t\tonDragging({dx, dy}){\n\t\t\tif( !this.animator.isDragging ) return false\n\t\t\tif( !this.props.dragEnabled ) return this.endDrag()\n\n\t\t\tlet pos = this.lastEnd\n\t\t\tlet x = dx + pos.x\n\t\t\tlet y = dy + pos.y\n\t\t\t\n\t\t\t// console.log( this.dragBoundaries.minPoint )\n\n\t\t\tlet {minPoint, maxPoint} = this.dragBoundaries\n\t\t\tif( !this.props.verticalOnly ){\n\t\t\t\tif (minPoint) {\n\t\t\t\t\tif (minPoint.x > x) x = minPoint.x\n\t\t\t\t\tif (maxPoint.x < x) x = maxPoint.x\n\t\t\t\t}\n\t\t\t\tthis.dragBehavior.x0 = x\n\t\t\t}\n\n\t\t\tif (!this.props.horizontalOnly) {\n\t\t\t\tif (minPoint) {\n\t\t\t\t\tif (minPoint.y > y) y = minPoint.y\n\t\t\t\t\tif (maxPoint.y < y) y = maxPoint.y\n\t\t\t\t}\n\t\t\t\tthis.dragBehavior.y0 = y\n\t\t\t}\n\n\t\t\t// console.log( this.dragBehavior )\n\t\t}\n\n\t\tendDrag(){\n\t\t\tthis.animator.removeTempBehaviors();\n\t\t\tthis.dragBehavior = null;\n\t\t\tthis.animator.isDragging = false\n\n\t\t\tlet { animator, horizontalOnly, verticalOnly, dragWithSprings } = this\n\n\t\t\tlet velocity = animator.getVelocity();\n\t\t\tif (horizontalOnly) velocity.y = 0;\n\t\t\tif (verticalOnly) velocity.x = 0;\n\t\t\t\n\t\t\tlet toss = (dragWithSprings && dragWithSprings.toss) || this.props.dragToss;\n\t\t\tlet {x,y} = this.getTranslation()\n\t\t\tlet projectedCenter = {\n\t\t\t\tx: x + toss * velocity.x,\n\t\t\t\ty: y + toss * velocity.y\n\t\t\t};\n\n\t\t\t// console.log( 'pc', projectedCenter, velocity)\n\t\t\tlet snapPoint = Utils.findClosest(projectedCenter, this.props.snapPoints);\n\t\t\tlet targetSnapPointId = (snapPoint && snapPoint.id) || \"\";\n\n\t\t\tthis.props.onDrag({ state: 'end', x: x, y: y, targetSnapPointId })\n\n\t\t\tthis.addTempSnapToPointBehavior(snapPoint);\n\t\t\tthis.addTempBoundaries();\n\n\t\t\tlet animated = this.getAnimated()\n\t\t\tanimated.x.flattenOffset()\n\t\t\tanimated.y.flattenOffset()\n\n\t\t\t// Restore text selection\n\t\t\tif ( isWeb ) {\n\t\t\t\tdocument.body.userSelect = this.userSelectCache || ''\n\t\t\t}\n\t\t}\n\n\t\taddTempDragBehavior( drag ) {\n\t\t\tlet pos = this.getTranslation()\n\n\t\t\tif ( !drag || drag.tension === Infinity ) {\n\t\t\t\tthis.dragBehavior = this.animator.addBehavior( 'anchor', pos, true )\n\t\t\t}\n\t\t\telse {\n\t\t\t\tpos.tension = drag.tension || 300\n\t\t\t\tthis.dragBehavior = this.animator.addBehavior( 'spring', pos, true )\n\t\t\t\tif( drag.damping ){\n\t\t\t\t\tthis.animator.addBehavior('friction', drag, true)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\taddTempSnapToPointBehavior( snapPoint ) {\n\t\t\tif (!snapPoint) return;\n\t\t\tlet { snapPoints, onSnap, onSnapStart } = this.props\n\n\t\t\tlet index = snapPoints.indexOf(snapPoint)\n\n\t\t\tonSnap({index, id: snapPoint.id});\n\t\t\tonSnapStart({index, id: snapPoint.id});\n\n\t\t\tlet springOptions = {\n\t\t\t\tdamping: .7,\n\t\t\t\ttension: 300,\n\t\t\t\t...snapPoint\n\t\t\t}\n\n\t\t\tthis.addBehavior( 'spring', springOptions, true )\n\t\t}\n\n\t\tsetVelocity( velocity ) {\n\t\t\tif ( this.dragBehavior ) return;\n\t\t\tthis.animator.physicsObject.vx = velocity.x\n\t\t\tthis.animator.physicsObject.vy = velocity.y\n\t\t\tthis.endDrag();\n\t\t}\n\n\t\tsnapTo( {index} ) {\n\t\t\tlet {snapPoints} = this.props;\n\n\t\t\tif( !snapPoints || index === undefined || index >= snapPoints.length ) return;\n\t\t\t\n\t\t\tthis.animator.removeTempBehaviors();\n\t\t\tthis.dragBehavior = null;\n\t\t\tlet snapPoint = snapPoints[index]\n\n\t\t\tthis.addTempSnapToPointBehavior(snapPoint);\n\t\t\tthis.addTempBoundaries();\n\t\t}\n\n\t\taddTempBoundaries(){\n\t\t\tlet boundaries = this.propAreas.boundaries;\n\t\t\tif( !boundaries ) return;\n\t\t\tthis.animator.addBehavior( 'bounce', boundaries, true );\n\t\t}\n\n\t\tchangePosition( position ) {\n\t\t\tif ( this.dragBehavior ) return;\n\n\t\t\tthis.setTranslation( position.x, position.y )\n\t\t\tthis.endDrag();\n\t\t}\n\n\t\tcomponentDidUpdate( prevProps ){\n\t\t\tthis.setPropBehaviours( prevProps, this.props )\n\t\t}\n\n\t\tsetPropBehaviours( prevProps, props ){\n\t\t\t// spring, gravity, friction\n\t\t\tObject.keys( propBehaviors ).forEach( prop => {\n\t\t\t\tif( prevProps[ prop ] !== props[ prop ] ){\n\t\t\t\t\tthis.animator.removeTypeBehaviors(propBehaviors[prop])\n\t\t\t\t\tthis.addTypeBehaviors( propBehaviors[prop], props[ prop ] )\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tif( prevProps.alertAreas !== props.alertAreas ){\n\t\t\t\tlet alertAreas = []\n\t\t\t\tprops.alertAreas.forEach( area => {\n\t\t\t\t\talertAreas.push({\n\t\t\t\t\t\tid: area.id,\n\t\t\t\t\t\tinfluence: Utils.createArea( area.influenceArea )\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t\tthis.propAreas.alert = alertAreas\n\t\t\t}\n\n\t\t\tif( prevProps.boundaries !== props.boundaries ){\n\t\t\t\tthis.animator.removeBehavior( this.oldBoundariesBehavior )\n\t\t\t\tif( props.boundaries ){\n\t\t\t\t\tlet bounce = {\n\t\t\t\t\t\tbounce: props.boundaries.bounce || 0,\n\t\t\t\t\t\tinfluence: Utils.createArea( props.boundaries )\n\t\t\t\t\t}\n\t\t\t\t\tthis.propAreas.boundaries = bounce\n\t\t\t\t\tthis.oldBoundariesBehavior = this.animator.addBehavior( 'bounce', bounce )\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthis.propAreas.boundaries = false\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (!this.props.dragEnabled && prevProps.dragEnabled && this.dragBehavior ){\n\t\t\t\tthis.endDrag()\n\t\t\t}\n\t\t}\n\n\t\taddTypeBehaviors( type, behaviors, isTemp ){\n\t\t\tbehaviors.forEach( b => this.addBehavior( type, b, isTemp )\t)\n\t\t}\n\n\t\taddBehavior( type, behavior, isTemp ){\n\t\t\tthis.animator.addBehavior( type, behavior, isTemp )\n\t\t\tif( behavior.damping && type !== 'friction' ){\n\t\t\t\tlet b = this.animator.addBehavior('friction', behavior, isTemp )\n\t\t\t\tif( type === 'gravity' && !behavior.influenceArea ){\n\t\t\t\t\tb.influence = Utils.createAreaFromRadius(1.4 * (behavior.falloff || 40), behavior)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import Animated from 'animated/lib/targets/react-dom'\nimport PanResponder from 'react-panresponder-web'\nimport injectDependencies from './InteractableView'\nimport AnimatedView from './AnimatedView'\n\n// Fake the Animated.View component\nAnimated.View = AnimatedView\n\nlet Interactable = injectDependencies( Animated, PanResponder ) \nexport default {View: Interactable}","import React from 'react'\r\nimport Animated from 'animated/lib/targets/react-dom'\r\n\r\nexport default function AnimatedView(props) {\r\n let propStyles = props.style || {}\r\n let style = { position: 'relative', display: 'flex', ...propStyles}\r\n\r\n return (\r\n \r\n {props.children}\r\n \r\n )\r\n}"],"names":["createArea","boundaries","minPoint","x","undefined","left","Infinity","y","top","maxPoint","right","bottom","createAreaFromRadius","radius","anchor","isPointInArea","area","findClosest","origin","points","minDistance","closestPoint","forEach","point","distance","_this","getDistance","relative","p","r","dx","Math","abs","dy","sqrt","getDelta","def","value","defaultValue","create","options","isTemp","x0","y0","priority","type","doFrame","deltaTime","state","coords","vx","vy","bounce","influence","target","setTranslationX","setTranslationY","friction","damping","Utils","influenceArea","pow","gravity","strength","falloff","dr","a","exp","mass","ax","ay","spring","tension","requestAnimationFrame","Animated","PanResponder","PhysicsAnimator","View","listener","debug","animatorListener","nofn","debugStart","debugEnd","frameTimeMillis","this","isRunning","lastFrameTS","animateFrameWithDeltaTime","onAnimationFrame","Date","now","behavior","debugB","debugInitialV","physicsObject","console","log","dvx","dvy","behaviors","hadMovement","getTranslation","_this2","Behaviors","animate","cfwnm","consecutiveFramesWithNoMovement","isDragging","stopRunning","onAnimatorPause","b","idx","length","splice","ensureRunning","condition","i","remove","startRunning","_this3","removeTempBehaviors","propBehaviors","frictionAreas","gravityPoints","springPoints","isWeb","document","props","propStyles","style","position","display","React","div","children","initialPosition","animated","ValueXY","animator","createAnimator","insideAlertAreas","propAreas","alert","_pr","createPanResponder","setPropBehaviours","getAnimated","setValue","_startingValue","lastEnd","Component","withPosition","transform","translateX","translateY","concat","panHandlers","dragEnabled","_value","_offset","tx","animatedValueX","ty","animatedValueY","Animator","round","onStop","reportAlertEvent","setTranslation","capturer","checkResponderCapture","bind","onMoveShouldSetResponderCapture","onMoveShouldSetPanResponderCapture","onPanResponderGrant","e","_captured","startDrag","onPanResponderMove","gesture","onDragging","onPanResponderRelease","endDrag","inside","onAlert","id","ev","offset","setOffset","dragBoundaries","onDrag","dragStartLocation","addTempDragBehavior","dragWithSpring","styles","body","userSelectCache","userSelect","pos","verticalOnly","dragBehavior","horizontalOnly","dragWithSprings","velocity","getVelocity","toss","dragToss","projectedCenter","snapPoint","snapPoints","targetSnapPointId","addTempSnapToPointBehavior","addTempBoundaries","flattenOffset","drag","addBehavior","onSnap","onSnapStart","index","indexOf","springOptions","prevProps","Object","keys","prop","_this4","removeTypeBehaviors","addTypeBehaviors","alertAreas","push","removeBehavior","oldBoundariesBehavior","_this5","PropTypes","array","bool","object","instanceOf","Value","func","onEnd","number"],"mappings":";;;;;;;wjDAAe,CACdA,WAAY,SAAUC,SACd,CACNC,SAAU,CACTC,OAAuBC,IAApBH,EAAWI,MAAsBC,EAAAA,EAAWL,EAAWI,KAC1DE,OAAsBH,IAAnBH,EAAWO,KAAqBF,EAAAA,EAAWL,EAAWO,KAE1DC,SAAU,CACTN,OAAwBC,IAArBH,EAAWS,MAAsBJ,EAAAA,EAAWL,EAAWS,MAC1DH,OAAyBH,IAAtBH,EAAWU,OAAuBL,EAAAA,EAAWL,EAAWU,UAI9DC,qBAAsB,SAAUC,EAAQC,SAChC,CACNZ,SAAU,CAACC,EAAGW,EAAOX,EAAIU,EAAQN,EAAGO,EAAOP,EAAIM,GAC/CJ,SAAU,CAACN,EAAGW,EAAOX,EAAIU,EAAQN,EAAGO,EAAOP,EAAIM,KAGjDE,cAAe,WAAkBC,OAAPb,IAAAA,EAAGI,IAAAA,MACvBS,EAAO,OAAO,MAEbd,EAAuBc,EAAvBd,SAAUO,EAAaO,EAAbP,gBAETN,GAAGD,EAASC,GAAKA,GAAKM,EAASN,GAAKI,GAAKL,EAASK,GAAKA,GAAKE,EAASF,GAE7EU,YAAa,SAAUC,EAAQ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EAAUQ,4BAGC,CACrBhC,WAAY,GACZvF,cAAe,GACf0G,WAAY,GACZzG,cAAe,GACf3H,WAAY,GACZuI,gBAAiB,CAACrI,EAAG,EAAGI,EAAG,GAC3BwM,SAAU,GACVjD,aAAa,EACb2D,OAAQ,aACRC,YAAa,aACbnD,OAAQ,aACRwB,OAAQ,aACRN,QAAS,aACTvD,MAAO"} \ No newline at end of file +{"version":3,"file":"interactable.noNative.min.js","sources":["../playground/src/react-interactable/Utils.js","../playground/src/react-interactable/Behaviors.js","../playground/src/react-interactable/Animator.js","../playground/src/react-interactable/InteractableView.js","../playground/src/react-interactable/noNative.js","../playground/src/react-interactable/AnimatedView.js"],"sourcesContent":["export default {\r\n\tcreateArea: function( boundaries ){\r\n\t\treturn {\r\n\t\t\tminPoint: {\r\n\t\t\t\tx: boundaries.left === undefined ? -Infinity : boundaries.left,\r\n\t\t\t\ty: boundaries.top === undefined ? -Infinity : boundaries.top\r\n\t\t\t},\r\n\t\t\tmaxPoint: {\r\n\t\t\t\tx: boundaries.right === undefined ? Infinity : boundaries.right,\r\n\t\t\t\ty: boundaries.bottom === undefined ? Infinity : boundaries.bottom\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\tcreateAreaFromRadius: function( radius, anchor ){\r\n\t\treturn {\r\n\t\t\tminPoint: {x: anchor.x - radius, y: anchor.y - radius},\r\n\t\t\tmaxPoint: {x: anchor.x + radius, y: anchor.y + radius}\r\n\t\t}\r\n\t},\r\n\tisPointInArea: function( {x, y}, area ){\r\n\t\tif( !area ) return true\r\n\r\n\t\tlet { minPoint, maxPoint } = area\r\n\r\n\t\treturn x>=minPoint.x && x <= maxPoint.x && y >= minPoint.y && y <= maxPoint.y\r\n\t},\r\n\tfindClosest: function( origin, points ){\r\n\t\tlet minDistance = Infinity;\r\n\t\tlet closestPoint = null;\r\n\t\tlet distances = []\r\n\t\tpoints.forEach( point => {\r\n\t\t\tlet distance = this.getDistance( point, origin );\r\n\t\t\tdistances.push( distance )\r\n\t\t\tif (distance < minDistance) {\r\n\t\t\t\tminDistance = distance;\r\n\t\t\t\tclosestPoint = point;\r\n\t\t\t}\r\n\t\t})\r\n\t\t// console.log( distances )\r\n\t\treturn closestPoint\r\n\t},\r\n\tgetDistance( point, relative ){\r\n\t\tlet p = {x: point.x === undefined ? Infinity : point.x, y: point.y === undefined ? Infinity : point.y }\r\n\t\tlet r = {x: relative.x === undefined ? Infinity : relative.x, y: relative.y === undefined ? Infinity : relative.y }\r\n\t\tif( p.x === Infinity && p.y === Infinity ) return Infinity\r\n\t\tlet dx = p.x === Infinity ? 0 : Math.abs(r.x - p.x)\r\n\t\tlet dy = p.y === Infinity ? 0 : Math.abs(r.y - p.y)\r\n\t\t\r\n\t\treturn Math.sqrt( dx*dx + dy*dy )\r\n\t},\r\n\tgetDelta( point, origin ){\r\n\t\treturn {\r\n\t\t\tx: point.x - origin.x,\r\n\t\t\ty: point.y - origin.y\r\n\t\t}\r\n\t}\r\n}","import Utils from './Utils'\r\n\r\nfunction def( value, defaultValue ){\r\n\treturn value === undefined ? defaultValue : value\r\n}\r\n\r\nexport default {\r\n\tanchor: {\r\n\t\tcreate: (options, isTemp = false) => (\r\n\t\t\t{ x0: options.x, y0: options.y, priority: 1, isTemp, type: 'anchor' }\r\n\t\t),\r\n\t\tdoFrame: (options, deltaTime, state, coords ) => {\r\n\t\t\t// Velocity = dx / deltaTime\r\n\t\t\tstate.vx = (options.x0 - coords.x) / deltaTime\r\n\t\t\tstate.vy = (options.y0 - coords.y) / deltaTime\r\n\t\t}\r\n\t},\r\n\r\n\tbounce: {\r\n\t\tcreate: (options, isTemp = false) => ({\r\n\t\t\ttype: 'bounce',\r\n\t\t\tbounce: def(options.bounce, .5),\r\n\t\t\tminPoint: options.influence.minPoint,\r\n\t\t\tmaxPoint: options.influence.maxPoint,\r\n\t\t\tpriority: 3,\r\n\t\t\tisTemp\r\n\t\t}),\r\n\t\tdoFrame: ({minPoint, maxPoint, bounce}, deltaTime, state, {x,y}, target ) => {\r\n\t\t\t// Apply limits\r\n\r\n\t\t\tif (minPoint.x > x) target.setTranslationX(minPoint.x);\r\n\t\t\tif (minPoint.y > y) target.setTranslationY(minPoint.y);\r\n\t\t\tif (maxPoint.x < x) target.setTranslationX(maxPoint.x);\r\n\t\t\tif (maxPoint.y < y) target.setTranslationY(maxPoint.y);\r\n\r\n\t\t\tlet { vx, vy } = state\r\n\r\n\t\t\tif (minPoint.x > x && vx < 0) {\r\n\t\t\t\tstate.vx = -vx * bounce\r\n\t\t\t}\r\n\t\t\tif (minPoint.y > y && vy < 0) {\r\n\t\t\t\tstate.vy= -vy * bounce\r\n\t\t\t}\r\n\t\t\tif (maxPoint.x < x && vx > 0) {\r\n\t\t\t\tstate.vx = -vx * bounce\r\n\t\t\t}\r\n\t\t\tif (maxPoint.y < y && vy > 0) {\r\n\t\t\t\tstate.vy = -vy * bounce\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\tfriction: {\r\n\t\tcreate: ( options, isTemp = false ) => ({\r\n\t\t\ttype: 'friction',\r\n\t\t\tdamping: def(options.damping, .7),\r\n\t\t\tinfluence: Utils.createArea( options.influenceArea || {} ),\r\n\t\t\tpriority: 2,\r\n\t\t\tisTemp\r\n\t\t}),\r\n\t\tdoFrame: (options, deltaTime, state, coords) => {\r\n\t\t\tif( !Utils.isPointInArea( coords, options.influence) ) return;\r\n\t\t\t\r\n\t\t\tlet pow = Math.pow(options.damping, 60.0 * deltaTime)\r\n\t\t\tstate.vx = pow * state.vx\r\n\t\t\tstate.vy = pow * state.vy\r\n\t\t}\r\n\t},\r\n\r\n\tgravity: {\r\n\t\tcreate: ( options, isTemp = false ) => ({\r\n\t\t\ttype: 'gravity',\r\n\t\t\tx0: def(options.x, Infinity),\r\n\t\t\ty0: def(options.y, Infinity),\r\n\t\t\tstrength: def(options.strength, 400),\r\n\t\t\tfalloff: def(options.falloff, 40),\r\n\t\t\tdamping: def(options.damping, 0),\r\n\t\t\tinfluence: Utils.createArea(options.influenceArea || {}),\r\n\t\t\tisTemp,\r\n\t\t\tpriority: 1\r\n\t\t}),\r\n\t\tdoFrame: (options, deltaTime, state, coords) => {\r\n\t\t\tif( !Utils.isPointInArea( coords, options.influence) ) return;\r\n\r\n\t\t\tlet dx = options.x0 !== Infinity ? coords.x - options.x0 : 0;\r\n\t\t\tlet dy = options.y0 !== Infinity ? coords.y - options.y0 : 0;\r\n\t\t\tlet dr = Math.sqrt(dx * dx + dy * dy);\r\n\r\n\t\t\tif (!dr) return;\r\n\r\n\t\t\tlet { falloff, strength } = options\r\n\t\t\tlet a = (-strength * dr * Math.exp(-0.5 * (dr * dr) / (falloff * falloff))) / state.mass;\r\n\r\n\t\t\tlet ax = dx / dr * a;\r\n\t\t\tlet ay = dy / dr * a;\r\n\r\n\t\t\tstate.vx += deltaTime * ax\r\n\t\t\tstate.vy += deltaTime * ay\r\n\t\t}\r\n\t},\r\n\r\n\tspring: {\r\n\t\tcreate: ( options, isTemp = false ) => ({\r\n\t\t\ttype: 'spring',\r\n\t\t\tx0: def(options.x, 0),\r\n\t\t\ty0: def(options.y, 0),\r\n\t\t\ttension: def(options.tension, 300),\r\n\t\t\tinfluence: Utils.createArea( options.influenceArea || {} ),\r\n\t\t\tisTemp,\r\n\t\t\tpriority: 1\r\n\t\t}),\r\n\t\tdoFrame: ( options, deltaTime, state, coords) => {\r\n\t\t\tif( !Utils.isPointInArea( coords, options.influence) ) return;\r\n\t\r\n\t\t\tlet dx = coords.x - options.x0;\r\n\t\t\tif( dx ){\r\n\t\t\t\t// time * acceleration\r\n\t\t\t\tstate.vx += deltaTime * ((-1 * options.tension * dx) / state.mass)\r\n\t\t\t}\r\n\t\r\n\t\t\tlet dy = coords.y - options.y0;\r\n\t\t\tif( dy ){\r\n\t\t\t\t// time * acceleration\r\n\t\t\t\tstate.vy += deltaTime * ((-1 * options.tension * dy) / state.mass)\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}","import Behaviors from './Behaviors'\r\n\r\nconst ANIMATOR_PAUSE_CONSECUTIVE_FRAMES = 10;\r\nconst ANIMATOR_PAUSE_ZERO_VELOCITY = 1.0;\r\n\r\nif( typeof requestAnimationFrame === 'undefined' ){\r\n\t// We just don't work without raf (maybe we are in the server)\r\n\t// eslint-disable-next-line no-native-reassign\r\n\trequestAnimationFrame = function(){}\r\n}\r\n\r\nclass PhysicsAnimator {\r\n\tbehaviors = []\r\n\tphysicsObject = {vx: 0, vy: 0, mass: 1}\r\n\tconsecutiveFramesWithNoMovement = 0\r\n\tscreenScale = 1\r\n\tlastFrameTS = 0\r\n\tisRunning = false\r\n\tticking = false\r\n\tisDragging = false\r\n\r\n\tconstructor( View, listener, debug ){\r\n\t\tthis.View = View\r\n\t\tthis.animatorListener = listener\r\n\t\tif( !debug ){\r\n\t\t\tlet nofn = function(){}\r\n\t\t\tthis.debugStart = nofn;\r\n\t\t\tthis.debugEnd = nofn;\r\n\t\t}\r\n\t}\r\n\r\n\tdoFrame( frameTimeMillis ) {\r\n\t\tif( !this.isRunning ) return;\r\n\r\n\t\tif ( this.lastFrameTS ) {\r\n\t\t\tthis.animateFrameWithDeltaTime(\r\n\t\t\t\t(frameTimeMillis - this.lastFrameTS) * 1e-3\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\tthis.lastFrameTS = frameTimeMillis;\r\n\t\tthis.animatorListener.onAnimationFrame();\r\n\t\trequestAnimationFrame( () => this.doFrame( Date.now() ) )\r\n\t}\r\n\r\n\tdebugStart( behavior ){\r\n\t\tif( this.debug !== true && this.debug !== behavior.type ) return;\r\n\t\tthis.debugB = behavior\r\n\t\tthis.debugInitialV = {...this.physicsObject}\r\n\t}\r\n\r\n\tdebugEnd() {\r\n\t\tif (!this.debugB || (this.debug !== true && this.debug !== this.debugB.type)) return;\r\n\t\tconsole.log( `Debug ${this.debugB.type}`, {\r\n\t\t\tdvx: this.physicsObject.vx - this.debugInitialV.vx,\r\n\t\t\tdvy: this.physicsObject.vy - this.debugInitialV.vy,\r\n\t\t})\r\n\t}\r\n\t\r\n\tanimateFrameWithDeltaTime( deltaTime ) {\r\n\t\tif( !deltaTime ) return;\r\n\r\n\t\tlet { physicsObject, behaviors, View } = this\r\n\t\tlet hadMovement = false\r\n\t\tlet coords = View.getTranslation()\r\n\r\n\t\tbehaviors.forEach( behavior => {\r\n\t\t\tthis.debugStart( behavior )\r\n\t\t\tBehaviors[ behavior.type ].doFrame( behavior, deltaTime, physicsObject, coords, View )\r\n\t\t\tthis.debugEnd()\r\n\t\t})\r\n\r\n\t\tlet dx = 0;\r\n\t\tlet {vx,vy} = physicsObject\r\n\t\t\r\n\t\tif ( Math.abs(vx) > ANIMATOR_PAUSE_ZERO_VELOCITY ) {\r\n\t\t\tdx = deltaTime * vx;\r\n\t\t\thadMovement = true;\r\n\t\t}\r\n\r\n\t\tlet dy = 0;\r\n\t\tif ( Math.abs(vy) > ANIMATOR_PAUSE_ZERO_VELOCITY ) {\r\n\t\t\tdy = deltaTime * vy;\r\n\t\t\thadMovement = true;\r\n\t\t}\r\n\t\t\r\n\t\tView.animate( dx, dy )\r\n\r\n\t\tlet cfwnm = hadMovement ? 0 : this.consecutiveFramesWithNoMovement + 1\r\n\t\tthis.consecutiveFramesWithNoMovement = cfwnm\r\n\r\n\t\tif (cfwnm >= ANIMATOR_PAUSE_CONSECUTIVE_FRAMES && !this.isDragging ) {\r\n\t\t\tthis.stopRunning();\r\n\t\t\tthis.animatorListener.onAnimatorPause();\r\n\t\t}\r\n\t}\r\n\r\n\taddBehavior( type, options, isTemp ){\r\n\t\tlet b = Behaviors[ type ]\r\n\t\tif( !b ) return;\r\n\r\n\t\tlet behavior = b.create( options, isTemp )\r\n\t\tlet behaviors = this.behaviors\r\n\t\tlet idx = 0\r\n\r\n\t\twhile (behaviors.length > idx && behaviors[idx].priority <= behavior.priority) {\r\n\t\t\t++idx;\r\n\t\t}\r\n\t\tbehaviors.splice( idx, 0, behavior )\r\n\r\n\t\tthis.ensureRunning()\r\n\t\treturn behavior\r\n\t}\r\n\r\n\tremove( condition ){\r\n\t\tlet behaviors = this.behaviors\r\n\t\tlet i = behaviors.length\r\n\t\twhile( i-- > 0 ){\r\n\t\t\tif( condition(behaviors[i]) ){\r\n\t\t\t\tbehaviors.splice( i, 1 )\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tremoveBehavior( behavior ) {\r\n\t\tthis.remove( target => target === behavior )\r\n\t}\r\n\r\n\tremoveTypeBehaviors( type ){\r\n\t\tthis.remove( target => target.type === type )\r\n\t}\r\n\t\r\n\tremoveTempBehaviors(){\r\n\t\tthis.remove( target => target.isTemp )\r\n\t}\r\n\t\r\n\tgetVelocity(){ \r\n\t\treturn { x: this.physicsObject.vx, y: this.physicsObject.vy }\r\n\t}\r\n\r\n\tensureRunning() {\r\n\t\tthis.isRunning || this.startRunning()\r\n\t}\r\n\r\n\tstartRunning() {\r\n\t\tthis.isRunning = true;\r\n\t\tthis.lastFrameTS = 0;\r\n\t\tthis.consecutiveFramesWithNoMovement = 0;\r\n\t\trequestAnimationFrame( () => this.doFrame( Date.now() ) )\r\n\t}\r\n\r\n\tstopRunning() {\r\n\t\tthis.removeTempBehaviors();\r\n\t\tthis.physicsObject = {vx: 0, vy: 0, mass: this.physicsObject.mass}\r\n\t\tthis.isRunning = false;\r\n\t}\r\n}\r\n\r\nexport default PhysicsAnimator","import React, { Component } from 'react'\r\nimport PropTypes from 'prop-types'\r\nimport Animator from './Animator'\r\nimport Utils from './Utils';\r\n\r\nconst propBehaviors = {\r\n\tfrictionAreas: 'friction',\r\n\tgravityPoints: 'gravity',\r\n\tspringPoints: 'spring',\r\n}\r\n\r\nconst isWeb = typeof document !== 'undefined'\r\n\r\nexport default function injectDependencies( Animated, PanResponder ){\r\n\r\n\treturn class InteractableView extends Component {\r\n\t\tstatic propTypes = {\r\n\t\t\tsnapPoints: PropTypes.array,\r\n\t\t\tfrictionAreas: PropTypes.array,\r\n\t\t\talertAreas: PropTypes.array,\r\n\t\t\tgravityPoints: PropTypes.array,\r\n\t\t\thorizontalOnly: PropTypes.bool,\r\n\t\t\tverticalOnly: PropTypes.bool,\r\n\t\t\tdragWithSpring: PropTypes.object,\r\n\t\t\tdragEnabled: PropTypes.bool,\r\n\t\t\tanimatedValueX: PropTypes.instanceOf(Animated.Value),\r\n\t\t\tanimatedValueY: PropTypes.instanceOf(Animated.Value),\r\n\t\t\tonSnap: PropTypes.func,\r\n\t\t\tonSnapStart: PropTypes.func,\r\n\t\t\tonEnd: PropTypes.func,\r\n\t\t\tonDrag: PropTypes.func,\r\n\t\t\tboundaries: PropTypes.object,\r\n\t\t\tinitialPosition: PropTypes.object,\r\n\t\t\tdragToss: PropTypes.number\r\n\t\t}\r\n\r\n\t\tstatic defaultProps = {\r\n\t\t\tsnapPoints: [],\r\n\t\t\tfrictionAreas: [],\r\n\t\t\talertAreas: [],\r\n\t\t\tgravityPoints: [],\r\n\t\t\tboundaries: {},\r\n\t\t\tinitialPosition: {x: 0, y: 0},\r\n\t\t\tdragToss: .1,\r\n\t\t\tdragEnabled: true,\r\n\t\t\tonSnap: function () { },\r\n\t\t\tonSnapStart: function () { },\r\n\t\t\tonStop: function () { },\r\n\t\t\tonDrag: function () { },\r\n\t\t\tonAlert: function () { },\r\n\t\t\tstyle: {}\r\n\t\t}\r\n\r\n\t\tinitialPositionSet = false\r\n\t\tisDragging = false\r\n\r\n\t\tconstructor(props) {\r\n\t\t\tsuper(props)\r\n\r\n\t\t\tlet { x=0, y=0 } = props.initialPosition\r\n\r\n\t\t\t// In case animatedValueXY is not given\r\n\t\t\tthis.animated = new Animated.ValueXY({x, y})\r\n\r\n\t\t\t// This guy will apply all the physics\r\n\t\t\tthis.animator = this.createAnimator( props )\r\n\r\n\t\t\t// Cache when the view is inside of an alert area\r\n\t\t\tthis.insideAlertAreas = {}\r\n\r\n\t\t\t// cache calculated areas\r\n\t\t\tthis.propAreas = {\r\n\t\t\t\talert: [],\r\n\t\t\t\tboundaries: false\r\n\t\t\t}\r\n\r\n\t\t\tthis._pr = this.createPanResponder(props)\r\n\t\t\t\r\n\t\t\t// Set behaviors and prop defaults\r\n\t\t\tthis.setPropBehaviours( {}, props )\r\n\r\n\t\t\t// Set initial position\r\n\t\t\tlet animated = this.getAnimated( props )\r\n\t\t\tanimated.x.setValue( x )\r\n\t\t\tanimated.y.setValue(y)\r\n\t\t\tanimated.x._startingValue = x\r\n\t\t\tanimated.y._startingValue = y\r\n\t\t\t\r\n\t\t\t// Save the last animation end position to report good coordinates in the events\r\n\t\t\tthis.lastEnd = {...this.initialPosition}\r\n\t\t}\r\n\r\n\t\trender() {\r\n\t\t\tlet { x, y } = this.getAnimated()\r\n\t\t\tlet style = this.props.style\r\n\t\t\tlet withPosition = {\r\n\t\t\t\ttransform: [{ translateX: x }, { translateY: y }].concat( style.transform || [] ),\r\n\t\t\t\t...style\r\n\t\t\t}\r\n\r\n\t\t\tlet panHandlers = this.props.dragEnabled ? this._pr.panHandlers : {}\r\n\r\n\t\t\treturn (\r\n\t\t\t\t\r\n\t\t\t\t\t{this.props.children}\r\n\t\t\t\t\r\n\t\t\t)\r\n\t\t}\r\n\r\n\t\tgetTranslation(){\r\n\t\t\tlet {x, y} = this.getAnimated()\r\n\t\t\treturn {\r\n\t\t\t\tx: x._value + x._offset,\r\n\t\t\t\ty: y._value + y._offset\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tsetTranslationX( tx ){\r\n\t\t\tlet animated = this.props.animatedValueX || this.animated.x\r\n\t\t\tanimated.setValue( tx - animated._offset )\r\n\t\t}\r\n\r\n\t\tsetTranslationY(ty) {\r\n\t\t\tlet animated = this.props.animatedValueY || this.animated.y\r\n\t\t\tanimated.setValue( ty - animated._offset )\r\n\t\t}\r\n\r\n\t\tsetTranslation( tx, ty ){\r\n\t\t\tthis.setTranslationX( tx )\r\n\t\t\tthis.setTranslationY( ty )\r\n\t\t}\r\n\r\n\t\tcreateAnimator(){\r\n\t\t\treturn new Animator( this, {\r\n\t\t\t\tonAnimatorPause: () => {\r\n\t\t\t\t\tlet { x, y } = this.getTranslation()\r\n\t\t\t\t\tthis.lastEnd = {x: Math.round(x), y: Math.round(y)}\r\n\t\t\t\t\tthis.props.onStop( this.lastEnd )\r\n\t\t\t\t},\r\n\t\t\t\tonAnimationFrame: () => {\r\n\t\t\t\t\tthis.reportAlertEvent( this.getTranslation() )\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tfalse // Set true or behavior type to output debug info in the console\r\n\t\t\t)\r\n\t\t}\r\n\r\n\t\tanimate( dx, dy ){\r\n\t\t\tif(!dx && !dy) return\r\n\t\t\t// let animated = this.getAnimated()\r\n\t\t\t// console.log( dx + animated.x._value + animated.x._offset )\r\n\r\n\t\t\tlet {x,y} = this.getTranslation()\r\n\t\t\tthis.setTranslation( x + dx, y + dy ) \r\n\t\t}\r\n\r\n\t\tgetAnimated( props ){\r\n\t\t\tlet { animatedValueX, animatedValueY } = (props || this.props)\r\n\r\n\t\t\treturn {\r\n\t\t\t\tx: animatedValueX || this.animated.x ,\r\n\t\t\t\ty: animatedValueY || this.animated.y\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tcreatePanResponder() {\r\n\t\t\tlet capturer = this.checkResponderCapture.bind(this)\r\n\t\t\t\r\n\t\t\treturn PanResponder.create({\r\n\t\t\t\tonMoveShouldSetResponderCapture: capturer,\r\n\t\t\t\tonMoveShouldSetPanResponderCapture: capturer,\r\n\r\n\t\t\t\tonPanResponderGrant: (e, {x0, y0}) => {\t\r\n\t\t\t\t\tthis._captured = true;\r\n\t\t\t\t\tthis.startDrag( {x: x0, y: y0} )\r\n\t\t\t\t},\r\n\r\n\t\t\t\tonPanResponderMove: (e, gesture ) => {\r\n\t\t\t\t\tthis.onDragging( gesture )\r\n\t\t\t\t},\r\n\r\n\t\t\t\tonPanResponderRelease: () => {\r\n\t\t\t\t\tthis._captured = false;\r\n\t\t\t\t\tthis.endDrag()\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t}\r\n\r\n\t\tcheckResponderCapture( e, gesture ){\r\n\t\t\treturn this._captured || Math.abs( gesture.dx ) > 5 || Math.abs( gesture.dy ) > 5;\r\n\t\t}\r\n\r\n\t\treportAlertEvent( position ){\r\n\t\t\tlet inside = this.insideAlertAreas\r\n\t\t\tlet { onAlert } = this.props\r\n\r\n\t\t\tthis.propAreas.alert.forEach( ({ influence, id }) => {\r\n\t\t\t\tif ( !influence || !id ) return;\r\n\r\n\t\t\t\tif ( Utils.isPointInArea( position, influence ) ) {\r\n\t\t\t\t\tif ( !inside[id] ) {\r\n\t\t\t\t\t\tonAlert({id, value:\"enter\"});\r\n\t\t\t\t\t\tinside[id] = 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t} else if (inside[id]) {\r\n\t\t\t\t\tonAlert({ id, value: \"leave\" });\r\n\t\t\t\t\tinside[id] = 0;\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t}\r\n\r\n\t\tstartDrag( ev ){\r\n\t\t\t// Prepare the animated\r\n\t\t\tlet {x,y} = this.getAnimated()\r\n\t\t\tlet offset = {x: x._value, y: y._value}\r\n\t\t\tx.setOffset( offset.x )\r\n\t\t\ty.setOffset( offset.y )\r\n\t\t\tx.setValue( 0 )\r\n\t\t\ty.setValue( 0 )\r\n\r\n\t\t\t// Save the offset for triggering events with the right coordinates\r\n\t\t\tthis.lastEnd = offset\r\n\t\t\t// console.log( offset )\r\n\r\n\t\t\t// Set boundaries to fast access\r\n\t\t\tthis.dragBoundaries = this.propAreas.boundaries ? this.propAreas.boundaries.influence : {}\r\n\r\n\t\t\t// Prepare the animation\r\n\t\t\tthis.props.onDrag({state: 'start', x: offset.x, y: offset.y})\r\n\t\t\tthis.dragStartLocation = { x: ev.x, y: ev.y }\r\n\t\t\tthis.animator.removeTempBehaviors();\r\n\t\t\tthis.animator.isDragging = true\r\n\t\t\tthis.animator.vx = 0\r\n\t\t\tthis.animator.vy = 0\r\n\t\t\tthis.addTempDragBehavior( this.props.dragWithSpring );\r\n\r\n\t\t\t// Stop text selection\r\n\t\t\tif ( isWeb ) {\r\n\t\t\t\tlet styles = document.body.style\r\n\t\t\t\tthis.userSelectCache = styles.userSelect\r\n\t\t\t\tstyles.userSelect = \"none\"\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tonDragging({dx, dy}){\r\n\t\t\tif( !this.animator.isDragging ) return false\r\n\t\t\tif( !this.props.dragEnabled ) return this.endDrag()\r\n\r\n\t\t\tlet pos = this.lastEnd\r\n\t\t\tlet x = dx + pos.x\r\n\t\t\tlet y = dy + pos.y\r\n\t\t\t\r\n\t\t\t// console.log( this.dragBoundaries.minPoint )\r\n\r\n\t\t\tlet {minPoint, maxPoint} = this.dragBoundaries\r\n\t\t\tif( !this.props.verticalOnly ){\r\n\t\t\t\tif (minPoint) {\r\n\t\t\t\t\tif (minPoint.x > x) x = minPoint.x\r\n\t\t\t\t\tif (maxPoint.x < x) x = maxPoint.x\r\n\t\t\t\t}\r\n\t\t\t\tthis.dragBehavior.x0 = x\r\n\t\t\t}\r\n\r\n\t\t\tif (!this.props.horizontalOnly) {\r\n\t\t\t\tif (minPoint) {\r\n\t\t\t\t\tif (minPoint.y > y) y = minPoint.y\r\n\t\t\t\t\tif (maxPoint.y < y) y = maxPoint.y\r\n\t\t\t\t}\r\n\t\t\t\tthis.dragBehavior.y0 = y\r\n\t\t\t}\r\n\r\n\t\t\t// console.log( this.dragBehavior )\r\n\t\t}\r\n\r\n\t\tendDrag(){\r\n\t\t\tthis.animator.removeTempBehaviors();\r\n\t\t\tthis.dragBehavior = null;\r\n\t\t\tthis.animator.isDragging = false\r\n\r\n\t\t\tlet { animator, horizontalOnly, verticalOnly, dragWithSprings } = this\r\n\r\n\t\t\tlet velocity = animator.getVelocity();\r\n\t\t\tif (horizontalOnly) velocity.y = 0;\r\n\t\t\tif (verticalOnly) velocity.x = 0;\r\n\t\t\t\r\n\t\t\tlet toss = (dragWithSprings && dragWithSprings.toss) || this.props.dragToss;\r\n\t\t\tlet {x,y} = this.getTranslation()\r\n\t\t\tlet projectedCenter = {\r\n\t\t\t\tx: x + toss * velocity.x,\r\n\t\t\t\ty: y + toss * velocity.y\r\n\t\t\t};\r\n\r\n\t\t\t// console.log( 'pc', projectedCenter, velocity)\r\n\t\t\tlet snapPoint = Utils.findClosest(projectedCenter, this.props.snapPoints);\r\n\t\t\tlet targetSnapPointId = (snapPoint && snapPoint.id) || \"\";\r\n\r\n\t\t\tthis.props.onDrag({ state: 'end', x: x, y: y, targetSnapPointId })\r\n\r\n\t\t\tthis.addTempSnapToPointBehavior(snapPoint);\r\n\t\t\tthis.addTempBoundaries();\r\n\r\n\t\t\tlet animated = this.getAnimated()\r\n\t\t\tanimated.x.flattenOffset()\r\n\t\t\tanimated.y.flattenOffset()\r\n\r\n\t\t\t// Restore text selection\r\n\t\t\tif ( isWeb ) {\r\n\t\t\t\tdocument.body.style.userSelect = this.userSelectCache || ''\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\taddTempDragBehavior( drag ) {\r\n\t\t\tlet pos = this.getTranslation()\r\n\r\n\t\t\tif ( !drag || drag.tension === Infinity ) {\r\n\t\t\t\tthis.dragBehavior = this.animator.addBehavior( 'anchor', pos, true )\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tpos.tension = drag.tension || 300\r\n\t\t\t\tthis.dragBehavior = this.animator.addBehavior( 'spring', pos, true )\r\n\t\t\t\tif( drag.damping ){\r\n\t\t\t\t\tthis.animator.addBehavior('friction', drag, true)\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\taddTempSnapToPointBehavior( snapPoint ) {\r\n\t\t\tif (!snapPoint) return;\r\n\t\t\tlet { snapPoints, onSnap, onSnapStart } = this.props\r\n\r\n\t\t\tlet index = snapPoints.indexOf(snapPoint)\r\n\r\n\t\t\tonSnap({index, id: snapPoint.id});\r\n\t\t\tonSnapStart({index, id: snapPoint.id});\r\n\r\n\t\t\tlet springOptions = {\r\n\t\t\t\tdamping: .7,\r\n\t\t\t\ttension: 300,\r\n\t\t\t\t...snapPoint\r\n\t\t\t}\r\n\r\n\t\t\tthis.addBehavior( 'spring', springOptions, true )\r\n\t\t}\r\n\r\n\t\tsetVelocity( velocity ) {\r\n\t\t\tif ( this.dragBehavior ) return;\r\n\t\t\tthis.animator.physicsObject.vx = velocity.x\r\n\t\t\tthis.animator.physicsObject.vy = velocity.y\r\n\t\t\tthis.endDrag();\r\n\t\t}\r\n\r\n\t\tsnapTo( {index} ) {\r\n\t\t\tlet {snapPoints} = this.props;\r\n\r\n\t\t\tif( !snapPoints || index === undefined || index >= snapPoints.length ) return;\r\n\t\t\t\r\n\t\t\tthis.animator.removeTempBehaviors();\r\n\t\t\tthis.dragBehavior = null;\r\n\t\t\tlet snapPoint = snapPoints[index]\r\n\r\n\t\t\tthis.addTempSnapToPointBehavior(snapPoint);\r\n\t\t\tthis.addTempBoundaries();\r\n\t\t}\r\n\r\n\t\taddTempBoundaries(){\r\n\t\t\tlet boundaries = this.propAreas.boundaries;\r\n\t\t\tif( !boundaries ) return;\r\n\t\t\tthis.animator.addBehavior( 'bounce', boundaries, true );\r\n\t\t}\r\n\r\n\t\tchangePosition( position ) {\r\n\t\t\tif ( this.dragBehavior ) return;\r\n\r\n\t\t\tthis.setTranslation( position.x, position.y )\r\n\t\t\tthis.endDrag();\r\n\t\t}\r\n\r\n\t\tcomponentDidUpdate( prevProps ){\r\n\t\t\tthis.setPropBehaviours( prevProps, this.props )\r\n\t\t}\r\n\r\n\t\tsetPropBehaviours( prevProps, props ){\r\n\t\t\t// spring, gravity, friction\r\n\t\t\tObject.keys( propBehaviors ).forEach( prop => {\r\n\t\t\t\tif( prevProps[ prop ] !== props[ prop ] ){\r\n\t\t\t\t\tthis.animator.removeTypeBehaviors(propBehaviors[prop])\r\n\t\t\t\t\tthis.addTypeBehaviors( propBehaviors[prop], props[ prop ] )\r\n\t\t\t\t}\r\n\t\t\t})\r\n\r\n\t\t\tif( prevProps.alertAreas !== props.alertAreas ){\r\n\t\t\t\tlet alertAreas = []\r\n\t\t\t\tprops.alertAreas.forEach( area => {\r\n\t\t\t\t\talertAreas.push({\r\n\t\t\t\t\t\tid: area.id,\r\n\t\t\t\t\t\tinfluence: Utils.createArea( area.influenceArea )\r\n\t\t\t\t\t})\r\n\t\t\t\t})\r\n\t\t\t\tthis.propAreas.alert = alertAreas\r\n\t\t\t}\r\n\r\n\t\t\tif( prevProps.boundaries !== props.boundaries ){\r\n\t\t\t\tthis.animator.removeBehavior( this.oldBoundariesBehavior )\r\n\t\t\t\tif( props.boundaries ){\r\n\t\t\t\t\tlet bounce = {\r\n\t\t\t\t\t\tbounce: props.boundaries.bounce || 0,\r\n\t\t\t\t\t\tinfluence: Utils.createArea( props.boundaries )\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.propAreas.boundaries = bounce\r\n\t\t\t\t\tthis.oldBoundariesBehavior = this.animator.addBehavior( 'bounce', bounce )\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tthis.propAreas.boundaries = false\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif (!this.props.dragEnabled && prevProps.dragEnabled && this.dragBehavior ){\r\n\t\t\t\tthis.endDrag()\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\taddTypeBehaviors( type, behaviors, isTemp ){\r\n\t\t\tbehaviors.forEach( b => this.addBehavior( type, b, isTemp )\t)\r\n\t\t}\r\n\r\n\t\taddBehavior( type, behavior, isTemp ){\r\n\t\t\tthis.animator.addBehavior( type, behavior, isTemp )\r\n\t\t\tif( behavior.damping && type !== 'friction' ){\r\n\t\t\t\tlet b = this.animator.addBehavior('friction', behavior, isTemp )\r\n\t\t\t\tif( type === 'gravity' && !behavior.influenceArea ){\r\n\t\t\t\t\tb.influence = Utils.createAreaFromRadius(1.4 * (behavior.falloff || 40), behavior)\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n","import Animated from 'animated/lib/targets/react-dom'\r\nimport PanResponder from 'react-panresponder-web'\r\nimport injectDependencies from './InteractableView'\r\nimport AnimatedView from './AnimatedView'\r\n\r\n// Fake the Animated.View component\r\nAnimated.View = AnimatedView\r\n\r\nlet Interactable = injectDependencies( Animated, PanResponder ) \r\nexport default {View: Interactable}","import React from 'react'\r\nimport Animated from 'animated/lib/targets/react-dom'\r\n\r\nexport default function AnimatedView(props) {\r\n let propStyles = props.style || {}\r\n let style = { position: 'relative', display: 'flex', ...propStyles}\r\n\r\n return (\r\n \r\n {props.children}\r\n \r\n )\r\n}"],"names":["createArea","boundaries","minPoint","x","undefined","left","Infinity","y","top","maxPoint","right","bottom","createAreaFromRadius","radius","anchor","isPointInArea","area","findClosest","origin","points","minDistance","closestPoint","forEach","point","distance","_this","getDistance","relative","p","r","dx","Math","abs","dy","sqrt","getDelta","def","value","defaultValue","create","options","isTemp","x0","y0","priority","type","doFrame","deltaTime","state","coords","vx","vy","bounce","influence","target","setTranslationX","setTranslationY","friction","damping","Utils","influenceArea","pow","gravity","strength","falloff","dr","a","exp","mass","ax","ay","spring","tension","requestAnimationFrame","Animated","PanResponder","PhysicsAnimator","View","listener","debug","animatorListener","nofn","debugStart","debugEnd","frameTimeMillis","this","isRunning","lastFrameTS","animateFrameWithDeltaTime","onAnimationFrame","Date","now","behavior","debugB","debugInitialV","physicsObject","console","log","dvx","dvy","behaviors","hadMovement","getTranslation","_this2","Behaviors","animate","cfwnm","consecutiveFramesWithNoMovement","isDragging","stopRunning","onAnimatorPause","b","idx","length","splice","ensureRunning","condition","i","remove","startRunning","_this3","removeTempBehaviors","propBehaviors","frictionAreas","gravityPoints","springPoints","isWeb","document","props","propStyles","style","position","display","React","div","children","initialPosition","animated","ValueXY","animator","createAnimator","insideAlertAreas","propAreas","alert","_pr","createPanResponder","setPropBehaviours","getAnimated","setValue","_startingValue","lastEnd","Component","withPosition","transform","translateX","translateY","concat","panHandlers","dragEnabled","_value","_offset","tx","animatedValueX","ty","animatedValueY","Animator","round","onStop","reportAlertEvent","setTranslation","capturer","checkResponderCapture","bind","onMoveShouldSetResponderCapture","onMoveShouldSetPanResponderCapture","onPanResponderGrant","e","_captured","startDrag","onPanResponderMove","gesture","onDragging","onPanResponderRelease","endDrag","inside","onAlert","id","ev","offset","setOffset","dragBoundaries","onDrag","dragStartLocation","addTempDragBehavior","dragWithSpring","styles","body","userSelectCache","userSelect","pos","verticalOnly","dragBehavior","horizontalOnly","dragWithSprings","velocity","getVelocity","toss","dragToss","projectedCenter","snapPoint","snapPoints","targetSnapPointId","addTempSnapToPointBehavior","addTempBoundaries","flattenOffset","drag","addBehavior","onSnap","onSnapStart","index","indexOf","springOptions","prevProps","Object","keys","prop","_this4","removeTypeBehaviors","addTypeBehaviors","alertAreas","push","removeBehavior","oldBoundariesBehavior","_this5","PropTypes","array","bool","object","instanceOf","Value","func","onEnd","number"],"mappings":";;;;;;;wjDAAe,CACdA,WAAY,SAAUC,SACd,CACNC,SAAU,CACTC,OAAuBC,IAApBH,EAAWI,MAAsBC,EAAAA,EAAWL,EAAWI,KAC1DE,OAAsBH,IAAnBH,EAAWO,KAAqBF,EAAAA,EAAWL,EAAWO,KAE1DC,SAAU,CACTN,OAAwBC,IAArBH,EAAWS,MAAsBJ,EAAAA,EAAWL,EAAWS,MAC1DH,OAAyBH,IAAtBH,EAAWU,OAAuBL,EAAAA,EAAWL,EAAWU,UAI9DC,qBAAsB,SAAUC,EAAQC,SAChC,CACNZ,SAAU,CAACC,EAAGW,EAAOX,EAAIU,EAAQN,EAAGO,EAAOP,EAAIM,GAC/CJ,SAAU,CAACN,EAAGW,EAAOX,EAAIU,EAAQN,EAAGO,EAAOP,EAAIM,KAGjDE,cAAe,WAAkBC,OAAPb,IAAAA,EAAGI,IAAAA,MACvBS,EAAO,OAAO,MAEbd,EAAuBc,EAAvBd,SAAUO,EAAaO,EAAbP,gBAETN,GAAGD,EAASC,GAAKA,GAAKM,EAASN,GAAKI,GAAKL,EAASK,GAAKA,GAAKE,EAASF,GAE7EU,YAAa,SAAUC,EAAQC,cAC1BC,EAAc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,4BAGC,CACrBhC,WAAY,GACZvF,cAAe,GACf0G,WAAY,GACZzG,cAAe,GACf3H,WAAY,GACZuI,gBAAiB,CAACrI,EAAG,EAAGI,EAAG,GAC3BwM,SAAU,GACVjD,aAAa,EACb2D,OAAQ,aACRC,YAAa,aACbnD,OAAQ,aACRwB,OAAQ,aACRN,QAAS,aACTvD,MAAO"} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 6cce4c2..1bc105e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "react-interactable", - "version": "0.6.5", + "version": "0.6.6", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "react-interactable", - "version": "0.6.5", + "version": "0.6.6", "license": "MIT", "dependencies": { "prop-types": "^15.8.1" diff --git a/package.json b/package.json index 8f9d6a2..6a31572 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-interactable", - "version": "0.6.5", + "version": "0.6.6", "description": "A port of react-native-interactable to make it work on the web", "main": "dist/interactable.native.js", "scripts": { diff --git a/playground/src/react-interactable/InteractableView.js b/playground/src/react-interactable/InteractableView.js index ab506ec..d99c8fe 100644 --- a/playground/src/react-interactable/InteractableView.js +++ b/playground/src/react-interactable/InteractableView.js @@ -305,7 +305,7 @@ export default function injectDependencies( Animated, PanResponder ){ // Restore text selection if ( isWeb ) { - document.body.userSelect = this.userSelectCache || '' + document.body.style.userSelect = this.userSelectCache || '' } }