react 15.0.0 → 15.0.2-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/react-with-addons.js +41 -8
- package/dist/react-with-addons.min.js +6 -6
- package/dist/react.js +41 -8
- package/dist/react.min.js +6 -6
- package/lib/DOMPropertyOperations.js +1 -2
- package/lib/EventPluginUtils.js +1 -1
- package/lib/IOSDefaultEventPluginOrder.js +16 -0
- package/lib/IOSNativeBridgeEventPlugin.js +57 -0
- package/lib/NativeMethodsMixin.js +165 -0
- package/lib/React.js +18 -1
- package/lib/ReactDOMComponent.js +7 -0
- package/lib/ReactDOMOption.js +10 -0
- package/lib/ReactNative.js +71 -0
- package/lib/ReactNativeAttributePayload.js +397 -0
- package/lib/ReactNativeBaseComponent.js +196 -0
- package/lib/ReactNativeComponentEnvironment.js +38 -0
- package/lib/ReactNativeComponentTree.js +66 -0
- package/lib/ReactNativeContainerInfo.js +21 -0
- package/lib/ReactNativeDOMIDOperations.js +83 -0
- package/lib/ReactNativeDefaultInjection.js +96 -0
- package/lib/ReactNativeEventEmitter.js +188 -0
- package/lib/ReactNativeGlobalResponderHandler.js +25 -0
- package/lib/ReactNativeMount.js +190 -0
- package/lib/ReactNativePropRegistry.js +52 -0
- package/lib/ReactNativeReconcileTransaction.js +100 -0
- package/lib/ReactNativeTagHandles.js +54 -0
- package/lib/ReactNativeTextComponent.js +70 -0
- package/lib/ReactNativeTreeTraversal.js +127 -0
- package/lib/ReactVersion.js +1 -1
- package/lib/TouchHistoryMath.js +99 -0
- package/lib/createReactNativeComponentClass.js +42 -0
- package/lib/findNodeHandle.js +89 -0
- package/package.json +1 -1
- package/lib/ReactDOM.native.js +0 -12
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2015-present, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the BSD-style license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
|
+
*
|
|
9
|
+
* @providesModule ReactNativeReconcileTransaction
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
'use strict';
|
|
13
|
+
|
|
14
|
+
var _assign = require('object-assign');
|
|
15
|
+
|
|
16
|
+
var CallbackQueue = require('./CallbackQueue');
|
|
17
|
+
var PooledClass = require('./PooledClass');
|
|
18
|
+
var Transaction = require('./Transaction');
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Provides a `CallbackQueue` queue for collecting `onDOMReady` callbacks during
|
|
22
|
+
* the performing of the transaction.
|
|
23
|
+
*/
|
|
24
|
+
var ON_DOM_READY_QUEUEING = {
|
|
25
|
+
/**
|
|
26
|
+
* Initializes the internal `onDOMReady` queue.
|
|
27
|
+
*/
|
|
28
|
+
initialize: function () {
|
|
29
|
+
this.reactMountReady.reset();
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* After DOM is flushed, invoke all registered `onDOMReady` callbacks.
|
|
34
|
+
*/
|
|
35
|
+
close: function () {
|
|
36
|
+
this.reactMountReady.notifyAll();
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Executed within the scope of the `Transaction` instance. Consider these as
|
|
42
|
+
* being member methods, but with an implied ordering while being isolated from
|
|
43
|
+
* each other.
|
|
44
|
+
*/
|
|
45
|
+
var TRANSACTION_WRAPPERS = [ON_DOM_READY_QUEUEING];
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Currently:
|
|
49
|
+
* - The order that these are listed in the transaction is critical:
|
|
50
|
+
* - Suppresses events.
|
|
51
|
+
* - Restores selection range.
|
|
52
|
+
*
|
|
53
|
+
* Future:
|
|
54
|
+
* - Restore document/overflow scroll positions that were unintentionally
|
|
55
|
+
* modified via DOM insertions above the top viewport boundary.
|
|
56
|
+
* - Implement/integrate with customized constraint based layout system and keep
|
|
57
|
+
* track of which dimensions must be remeasured.
|
|
58
|
+
*
|
|
59
|
+
* @class ReactNativeReconcileTransaction
|
|
60
|
+
*/
|
|
61
|
+
function ReactNativeReconcileTransaction() {
|
|
62
|
+
this.reinitializeTransaction();
|
|
63
|
+
this.reactMountReady = CallbackQueue.getPooled(null);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
var Mixin = {
|
|
67
|
+
/**
|
|
68
|
+
* @see Transaction
|
|
69
|
+
* @abstract
|
|
70
|
+
* @final
|
|
71
|
+
* @return {array<object>} List of operation wrap procedures.
|
|
72
|
+
* TODO: convert to array<TransactionWrapper>
|
|
73
|
+
*/
|
|
74
|
+
getTransactionWrappers: function () {
|
|
75
|
+
return TRANSACTION_WRAPPERS;
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* @return {object} The queue to collect `onDOMReady` callbacks with.
|
|
80
|
+
* TODO: convert to ReactMountReady
|
|
81
|
+
*/
|
|
82
|
+
getReactMountReady: function () {
|
|
83
|
+
return this.reactMountReady;
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* `PooledClass` looks for this, and will invoke this before allowing this
|
|
88
|
+
* instance to be reused.
|
|
89
|
+
*/
|
|
90
|
+
destructor: function () {
|
|
91
|
+
CallbackQueue.release(this.reactMountReady);
|
|
92
|
+
this.reactMountReady = null;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
_assign(ReactNativeReconcileTransaction.prototype, Transaction.Mixin, ReactNativeReconcileTransaction, Mixin);
|
|
97
|
+
|
|
98
|
+
PooledClass.addPoolingTo(ReactNativeReconcileTransaction);
|
|
99
|
+
|
|
100
|
+
module.exports = ReactNativeReconcileTransaction;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2015-present, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the BSD-style license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
|
+
*
|
|
9
|
+
* @providesModule ReactNativeTagHandles
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
'use strict';
|
|
13
|
+
|
|
14
|
+
var invariant = require('fbjs/lib/invariant');
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Keeps track of allocating and associating native "tags" which are numeric,
|
|
18
|
+
* unique view IDs. All the native tags are negative numbers, to avoid
|
|
19
|
+
* collisions, but in the JS we keep track of them as positive integers to store
|
|
20
|
+
* them effectively in Arrays. So we must refer to them as "inverses" of the
|
|
21
|
+
* native tags (that are * normally negative).
|
|
22
|
+
*
|
|
23
|
+
* It *must* be the case that every `rootNodeID` always maps to the exact same
|
|
24
|
+
* `tag` forever. The easiest way to accomplish this is to never delete
|
|
25
|
+
* anything from this table.
|
|
26
|
+
* Why: Because `dangerouslyReplaceNodeWithMarkupByID` relies on being able to
|
|
27
|
+
* unmount a component with a `rootNodeID`, then mount a new one in its place,
|
|
28
|
+
*/
|
|
29
|
+
var INITIAL_TAG_COUNT = 1;
|
|
30
|
+
var ReactNativeTagHandles = {
|
|
31
|
+
tagsStartAt: INITIAL_TAG_COUNT,
|
|
32
|
+
tagCount: INITIAL_TAG_COUNT,
|
|
33
|
+
|
|
34
|
+
allocateTag: function () {
|
|
35
|
+
// Skip over root IDs as those are reserved for native
|
|
36
|
+
while (this.reactTagIsNativeTopRootID(ReactNativeTagHandles.tagCount)) {
|
|
37
|
+
ReactNativeTagHandles.tagCount++;
|
|
38
|
+
}
|
|
39
|
+
var tag = ReactNativeTagHandles.tagCount;
|
|
40
|
+
ReactNativeTagHandles.tagCount++;
|
|
41
|
+
return tag;
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
assertRootTag: function (tag) {
|
|
45
|
+
!this.reactTagIsNativeTopRootID(tag) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expect a native root tag, instead got %s', tag) : invariant(false) : void 0;
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
reactTagIsNativeTopRootID: function (reactTag) {
|
|
49
|
+
// We reserve all tags that are 1 mod 10 for native root views
|
|
50
|
+
return reactTag % 10 === 1;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
module.exports = ReactNativeTagHandles;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2015-present, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the BSD-style license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
|
+
*
|
|
9
|
+
* @providesModule ReactNativeTextComponent
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
'use strict';
|
|
13
|
+
|
|
14
|
+
var _assign = require('object-assign');
|
|
15
|
+
|
|
16
|
+
var ReactNativeComponentTree = require('./ReactNativeComponentTree');
|
|
17
|
+
var ReactNativeTagHandles = require('./ReactNativeTagHandles');
|
|
18
|
+
var UIManager = require('UIManager');
|
|
19
|
+
|
|
20
|
+
var invariant = require('fbjs/lib/invariant');
|
|
21
|
+
|
|
22
|
+
var ReactNativeTextComponent = function (text) {
|
|
23
|
+
// This is really a ReactText (ReactNode), not a ReactElement
|
|
24
|
+
this._currentElement = text;
|
|
25
|
+
this._stringText = '' + text;
|
|
26
|
+
this._nativeParent = null;
|
|
27
|
+
this._rootNodeID = null;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
_assign(ReactNativeTextComponent.prototype, {
|
|
31
|
+
|
|
32
|
+
mountComponent: function (transaction, nativeParent, nativeContainerInfo, context) {
|
|
33
|
+
// TODO: nativeParent should have this context already. Stop abusing context.
|
|
34
|
+
!context.isInAParentText ? process.env.NODE_ENV !== 'production' ? invariant(false, 'RawText "%s" must be wrapped in an explicit <Text> component.', this._stringText) : invariant(false) : void 0;
|
|
35
|
+
this._nativeParent = nativeParent;
|
|
36
|
+
var tag = ReactNativeTagHandles.allocateTag();
|
|
37
|
+
this._rootNodeID = tag;
|
|
38
|
+
var nativeTopRootTag = nativeContainerInfo._tag;
|
|
39
|
+
UIManager.createView(tag, 'RCTRawText', nativeTopRootTag, { text: this._stringText });
|
|
40
|
+
|
|
41
|
+
ReactNativeComponentTree.precacheNode(this, tag);
|
|
42
|
+
|
|
43
|
+
return tag;
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
getNativeNode: function () {
|
|
47
|
+
return this._rootNodeID;
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
receiveComponent: function (nextText, transaction, context) {
|
|
51
|
+
if (nextText !== this._currentElement) {
|
|
52
|
+
this._currentElement = nextText;
|
|
53
|
+
var nextStringText = '' + nextText;
|
|
54
|
+
if (nextStringText !== this._stringText) {
|
|
55
|
+
this._stringText = nextStringText;
|
|
56
|
+
UIManager.updateView(this._rootNodeID, 'RCTRawText', { text: this._stringText });
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
unmountComponent: function () {
|
|
62
|
+
ReactNativeComponentTree.uncacheNode(this);
|
|
63
|
+
this._currentElement = null;
|
|
64
|
+
this._stringText = null;
|
|
65
|
+
this._rootNodeID = null;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
module.exports = ReactNativeTextComponent;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2015-present, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the BSD-style license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
|
+
*
|
|
9
|
+
* @providesModule ReactNativeTreeTraversal
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
'use strict';
|
|
13
|
+
|
|
14
|
+
// Same as ReactDOMTreeTraversal without the invariants.
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Return the lowest common ancestor of A and B, or null if they are in
|
|
18
|
+
* different trees.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
function getLowestCommonAncestor(instA, instB) {
|
|
22
|
+
var depthA = 0;
|
|
23
|
+
for (var tempA = instA; tempA; tempA = tempA._nativeParent) {
|
|
24
|
+
depthA++;
|
|
25
|
+
}
|
|
26
|
+
var depthB = 0;
|
|
27
|
+
for (var tempB = instB; tempB; tempB = tempB._nativeParent) {
|
|
28
|
+
depthB++;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// If A is deeper, crawl up.
|
|
32
|
+
while (depthA - depthB > 0) {
|
|
33
|
+
instA = instA._nativeParent;
|
|
34
|
+
depthA--;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// If B is deeper, crawl up.
|
|
38
|
+
while (depthB - depthA > 0) {
|
|
39
|
+
instB = instB._nativeParent;
|
|
40
|
+
depthB--;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Walk in lockstep until we find a match.
|
|
44
|
+
var depth = depthA;
|
|
45
|
+
while (depth--) {
|
|
46
|
+
if (instA === instB) {
|
|
47
|
+
return instA;
|
|
48
|
+
}
|
|
49
|
+
instA = instA._nativeParent;
|
|
50
|
+
instB = instB._nativeParent;
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Return if A is an ancestor of B.
|
|
57
|
+
*/
|
|
58
|
+
function isAncestor(instA, instB) {
|
|
59
|
+
while (instB) {
|
|
60
|
+
if (instB === instA) {
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
instB = instB._nativeParent;
|
|
64
|
+
}
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Return the parent instance of the passed-in instance.
|
|
70
|
+
*/
|
|
71
|
+
function getParentInstance(inst) {
|
|
72
|
+
return inst._nativeParent;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Simulates the traversal of a two-phase, capture/bubble event dispatch.
|
|
77
|
+
*/
|
|
78
|
+
function traverseTwoPhase(inst, fn, arg) {
|
|
79
|
+
var path = [];
|
|
80
|
+
while (inst) {
|
|
81
|
+
path.push(inst);
|
|
82
|
+
inst = inst._nativeParent;
|
|
83
|
+
}
|
|
84
|
+
var i;
|
|
85
|
+
for (i = path.length; i-- > 0;) {
|
|
86
|
+
fn(path[i], false, arg);
|
|
87
|
+
}
|
|
88
|
+
for (i = 0; i < path.length; i++) {
|
|
89
|
+
fn(path[i], true, arg);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
|
|
95
|
+
* should would receive a `mouseEnter` or `mouseLeave` event.
|
|
96
|
+
*
|
|
97
|
+
* Does not invoke the callback on the nearest common ancestor because nothing
|
|
98
|
+
* "entered" or "left" that element.
|
|
99
|
+
*/
|
|
100
|
+
function traverseEnterLeave(from, to, fn, argFrom, argTo) {
|
|
101
|
+
var common = from && to ? getLowestCommonAncestor(from, to) : null;
|
|
102
|
+
var pathFrom = [];
|
|
103
|
+
while (from && from !== common) {
|
|
104
|
+
pathFrom.push(from);
|
|
105
|
+
from = from._nativeParent;
|
|
106
|
+
}
|
|
107
|
+
var pathTo = [];
|
|
108
|
+
while (to && to !== common) {
|
|
109
|
+
pathTo.push(to);
|
|
110
|
+
to = to._nativeParent;
|
|
111
|
+
}
|
|
112
|
+
var i;
|
|
113
|
+
for (i = 0; i < pathFrom.length; i++) {
|
|
114
|
+
fn(pathFrom[i], true, argFrom);
|
|
115
|
+
}
|
|
116
|
+
for (i = pathTo.length; i-- > 0;) {
|
|
117
|
+
fn(pathTo[i], false, argTo);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
module.exports = {
|
|
122
|
+
isAncestor: isAncestor,
|
|
123
|
+
getLowestCommonAncestor: getLowestCommonAncestor,
|
|
124
|
+
getParentInstance: getParentInstance,
|
|
125
|
+
traverseTwoPhase: traverseTwoPhase,
|
|
126
|
+
traverseEnterLeave: traverseEnterLeave
|
|
127
|
+
};
|
package/lib/ReactVersion.js
CHANGED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @providesModule TouchHistoryMath
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
'use strict';
|
|
6
|
+
|
|
7
|
+
var TouchHistoryMath = {
|
|
8
|
+
/**
|
|
9
|
+
* This code is optimized and not intended to look beautiful. This allows
|
|
10
|
+
* computing of touch centroids that have moved after `touchesChangedAfter`
|
|
11
|
+
* timeStamp. You can compute the current centroid involving all touches
|
|
12
|
+
* moves after `touchesChangedAfter`, or you can compute the previous
|
|
13
|
+
* centroid of all touches that were moved after `touchesChangedAfter`.
|
|
14
|
+
*
|
|
15
|
+
* @param {TouchHistoryMath} touchHistory Standard Responder touch track
|
|
16
|
+
* data.
|
|
17
|
+
* @param {number} touchesChangedAfter timeStamp after which moved touches
|
|
18
|
+
* are considered "actively moving" - not just "active".
|
|
19
|
+
* @param {boolean} isXAxis Consider `x` dimension vs. `y` dimension.
|
|
20
|
+
* @param {boolean} ofCurrent Compute current centroid for actively moving
|
|
21
|
+
* touches vs. previous centroid of now actively moving touches.
|
|
22
|
+
* @return {number} value of centroid in specified dimension.
|
|
23
|
+
*/
|
|
24
|
+
centroidDimension: function (touchHistory, touchesChangedAfter, isXAxis, ofCurrent) {
|
|
25
|
+
var touchBank = touchHistory.touchBank;
|
|
26
|
+
var total = 0;
|
|
27
|
+
var count = 0;
|
|
28
|
+
|
|
29
|
+
var oneTouchData = touchHistory.numberActiveTouches === 1 ? touchHistory.touchBank[touchHistory.indexOfSingleActiveTouch] : null;
|
|
30
|
+
|
|
31
|
+
if (oneTouchData !== null) {
|
|
32
|
+
if (oneTouchData.touchActive && oneTouchData.currentTimeStamp > touchesChangedAfter) {
|
|
33
|
+
total += ofCurrent && isXAxis ? oneTouchData.currentPageX : ofCurrent && !isXAxis ? oneTouchData.currentPageY : !ofCurrent && isXAxis ? oneTouchData.previousPageX : oneTouchData.previousPageY;
|
|
34
|
+
count = 1;
|
|
35
|
+
}
|
|
36
|
+
} else {
|
|
37
|
+
for (var i = 0; i < touchBank.length; i++) {
|
|
38
|
+
var touchTrack = touchBank[i];
|
|
39
|
+
if (touchTrack !== null && touchTrack !== undefined && touchTrack.touchActive && touchTrack.currentTimeStamp >= touchesChangedAfter) {
|
|
40
|
+
var toAdd; // Yuck, program temporarily in invalid state.
|
|
41
|
+
if (ofCurrent && isXAxis) {
|
|
42
|
+
toAdd = touchTrack.currentPageX;
|
|
43
|
+
} else if (ofCurrent && !isXAxis) {
|
|
44
|
+
toAdd = touchTrack.currentPageY;
|
|
45
|
+
} else if (!ofCurrent && isXAxis) {
|
|
46
|
+
toAdd = touchTrack.previousPageX;
|
|
47
|
+
} else {
|
|
48
|
+
toAdd = touchTrack.previousPageY;
|
|
49
|
+
}
|
|
50
|
+
total += toAdd;
|
|
51
|
+
count++;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return count > 0 ? total / count : TouchHistoryMath.noCentroid;
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
currentCentroidXOfTouchesChangedAfter: function (touchHistory, touchesChangedAfter) {
|
|
59
|
+
return TouchHistoryMath.centroidDimension(touchHistory, touchesChangedAfter, true, // isXAxis
|
|
60
|
+
true // ofCurrent
|
|
61
|
+
);
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
currentCentroidYOfTouchesChangedAfter: function (touchHistory, touchesChangedAfter) {
|
|
65
|
+
return TouchHistoryMath.centroidDimension(touchHistory, touchesChangedAfter, false, // isXAxis
|
|
66
|
+
true // ofCurrent
|
|
67
|
+
);
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
previousCentroidXOfTouchesChangedAfter: function (touchHistory, touchesChangedAfter) {
|
|
71
|
+
return TouchHistoryMath.centroidDimension(touchHistory, touchesChangedAfter, true, // isXAxis
|
|
72
|
+
false // ofCurrent
|
|
73
|
+
);
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
previousCentroidYOfTouchesChangedAfter: function (touchHistory, touchesChangedAfter) {
|
|
77
|
+
return TouchHistoryMath.centroidDimension(touchHistory, touchesChangedAfter, false, // isXAxis
|
|
78
|
+
false // ofCurrent
|
|
79
|
+
);
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
currentCentroidX: function (touchHistory) {
|
|
83
|
+
return TouchHistoryMath.centroidDimension(touchHistory, 0, // touchesChangedAfter
|
|
84
|
+
true, // isXAxis
|
|
85
|
+
true // ofCurrent
|
|
86
|
+
);
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
currentCentroidY: function (touchHistory) {
|
|
90
|
+
return TouchHistoryMath.centroidDimension(touchHistory, 0, // touchesChangedAfter
|
|
91
|
+
false, // isXAxis
|
|
92
|
+
true // ofCurrent
|
|
93
|
+
);
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
noCentroid: -1
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
module.exports = TouchHistoryMath;
|