aboutsummaryrefslogtreecommitdiff
path: root/node_modules/montage/ui/composer/translate-composer.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/montage/ui/composer/translate-composer.js')
-rw-r--r--node_modules/montage/ui/composer/translate-composer.js775
1 files changed, 775 insertions, 0 deletions
<
diff --git a/node_modules/montage/ui/composer/translate-composer.js b/node_modules/montage/ui/composer/translate-composer.js
new file mode 100644
index 00000000..485290b4
--- /dev/null
+++ b/node_modules/montage/ui/composer/translate-composer.js
@@ -0,0 +1,775 @@
1/* <copyright>
2 This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3 No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4 (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5 </copyright> */
6/**
7 @module montage/ui/composer/long-press-composer
8 @requires montage
9 @requires montage/ui/composer/composer
10*/
11var Montage = require("montage").Montage,
12 Composer = require("ui/composer/composer").Composer,
13 defaultEventManager = require("core/event/event-manager").defaultEventManager;
14/**
15 @class module:montage/ui/composer/translate-composer.TranslateComposer
16 @extends module:montage/ui/composer/composer.Composer
17*/
18exports.TranslateComposer = Montage.create(Composer,/** @lends module:montage/ui/event/composer/translate-composer.TranslateComposer# */ {
19
20 _externalUpdate: {
21 enumerable: false,
22 value: true
23 },
24
25 isAnimating: {
26 enumerable: false,
27 value: false
28 },
29
30 frame: {
31 value: function(timestamp) {
32 if (this.isAnimating) {
33 this._animationInterval();
34 }
35 this._externalUpdate = false;
36 }
37 },
38
39 _pointerSpeedMultiplier: {
40 enumerable: false,
41 value: 1
42 },
43
44 pointerSpeedMultiplier: {
45 get: function () {
46 return this._pointerSpeedMultiplier;
47 },
48 set: function (value) {
49 this._pointerSpeedMultiplier = value;
50 }
51 },
52
53 pointerStartEventPosition: {
54 value: null
55 },
56
57 _isSelfUpdate: {
58 enumerable: false,
59 value: false
60 },
61
62 _translateX: {
63 enumerable: false,
64 value: 0
65 },
66
67 translateX: {
68 get: function () {
69 return this._translateX;
70 },
71 set: function (value) {
72 if (this._axis==="vertical") {
73 this._translateX=0;
74 } else {
75 var tmp=isNaN(value)?0:value>>0;
76
77 if ((!this._hasBouncing)||(!this._isSelfUpdate)) {
78 if (tmp<0) {
79 tmp=0;
80 }
81 if (tmp>this._maxTranslateX) {
82 tmp=this._maxTranslateX;
83 }
84 if (!this._isSelfUpdate) {
85 this.isAnimating = false;
86 }
87 }
88 this._translateX=tmp;
89 }
90 }
91 },
92
93 _translateY: {
94 enumerable: false,
95 value: 0
96 },
97
98 translateY: {
99 get: function () {
100 return this._translateY;
101 },
102 set: function (value) {
103 if (this._axis==="horizontal") {
104 this._translateY=0;
105 } else {
106 var tmp=isNaN(value)?0:value>>0;
107
108 if ((!this._hasBouncing)||(!this._isSelfUpdate)) {
109 if (tmp<0) {
110 tmp=0;
111 }
112 if (tmp>this._maxTranslateY) {
113 tmp=this._maxTranslateY;
114 }
115 if (!this._isSelfUpdate) {
116 this.isAnimating = false;
117 }
118 }
119 this._translateY=tmp;
120 }
121 }
122 },
123
124 _maxTranslateX: {
125 enumerable: false,
126 value: 0
127 },
128
129 maxTranslateX: {
130 get: function () {
131 return this._maxTranslateX;
132 },
133 set: function (value) {
134 var tmp=isNaN(value)?0:value>>0;
135
136 if (tmp<0) {
137 tmp=0;
138 }
139 if (this._maxTranslateX!=tmp) {
140 if (this._translateX>this._maxTranslateX) {
141 this.translateX=this._maxTranslateX;
142 }
143 this._maxTranslateX=tmp;
144 }
145 }
146 },
147
148 _maxTranslateY: {
149 enumerable: false,
150 value: 0
151 },
152
153 maxTranslateY: {
154 get: function () {
155 return this._maxTranslateY;
156 },
157 set: function (value) {
158 var tmp=isNaN(value)?0:value>>0;
159
160 if (tmp<0) {
161 tmp=0;
162 }
163 if (this._maxTranslateY!=tmp) {
164 if (this._translateY>this._maxTranslateY) {
165 this.translateY=this._maxTranslateY;
166 }
167 this._maxTranslateY=tmp;
168 }
169 }
170 },
171
172 _axis: {
173 enumerable: false,
174 value: "both"
175 },
176
177 axis: {
178 get: function () {
179 return this._axis;
180 },
181 set: function (value) {
182 switch (value) {
183 case "vertical":
184 case "horizontal":
185 this._axis=value;
186 break;
187 default:
188 this._axis="both";
189 break;
190 }
191 }
192 },
193
194 _hasMomentum: {
195 enumerable: false,
196 value: true
197 },
198
199 hasMomentum: {
200 get: function () {
201 return this._hasMomentum;
202 },
203 set: function (value) {
204 this._hasMomentum=value?true:false;
205 }
206 },
207
208 _hasBouncing: {
209 enumerable: false,
210 value: true
211 },
212
213 hasBouncing: {
214 get: function () {
215 return this._hasBouncing;
216 },
217 set: function (value) {
218 this._hasBouncing=value?true:false;
219 }
220 },
221
222 _momentumDuration: {
223 enumerable: false,
224 value: 650
225 },
226
227 momentumDuration: {