aboutsummaryrefslogtreecommitdiff
path: root/node_modules/montage/ui/composer
diff options
context:
space:
mode:
authorValerio Virgillito2012-02-02 00:11:51 -0800
committerValerio Virgillito2012-02-02 15:33:42 -0800
commita3024011a91d3941f81481dd4d600e9684eb0fd4 (patch)
tree084b4856910f1db53973dd11617f7ffa03a6dd46 /node_modules/montage/ui/composer
parent97255032921178bdfbc25512ddf3e0867e353f7a (diff)
downloadninja-a3024011a91d3941f81481dd4d600e9684eb0fd4.tar.gz
upgrading to Montage v0.6
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'node_modules/montage/ui/composer')
-rw-r--r--node_modules/montage/ui/composer/composer.js142
-rw-r--r--node_modules/montage/ui/composer/long-press-composer.js232
-rw-r--r--node_modules/montage/ui/composer/swipe-composer.js303
-rw-r--r--node_modules/montage/ui/composer/translate-composer.js775
4 files changed, 1452 insertions, 0 deletions
diff --git a/node_modules/montage/ui/composer/composer.js b/node_modules/montage/ui/composer/composer.js
new file mode 100644
index 00000000..2f91bb22
--- /dev/null
+++ b/node_modules/montage/ui/composer/composer.js
@@ -0,0 +1,142 @@
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/event/composer/composer
8 @requires montage
9*/
10var Montage = require("montage").Montage;
11/**
12 @class module:montage/ui/composer/composer.Composer
13 @extends module:montage.Montage
14 */
15exports.Composer = Montage.create(Montage, /** @lends module:montage/ui/composer/composer.Composer# */ {
16
17 _component: {
18 value: null
19 },
20
21 component: {
22 get: function() {
23 return this._component;
24 },
25 set: function(component) {
26 this._component = component;
27 }
28 },
29
30 _element: {
31 value: null
32 },
33
34 element: {
35 get: function() {
36 return this._element;
37 },
38 set: function(element) {
39 this._element = element;
40 }
41 },
42
43 _needsFrame: {
44 value: false
45 },
46
47 /**
48 This property should be set to true when this composer wants to have its
49 frame method executed during the next draw cycle. Setting this property
50 to true will cause a draw cycle to be scheduled iff one is not already
51 scheduled.
52 */
53 needsFrame: {
54 set: function(value) {
55 if (this._needsFrame !== value) {
56 this._needsFrame = value;
57 if (this._component) {
58 if (value) {
59 this._component.scheduleComposer(this);
60 }
61 }
62 }
63 },
64 get: function() {
65 return this._needsFrame;
66 }
67 },
68
69 /**
70 This method will be invoked by the framework at the beginning of a draw cycle. This is the method where
71 a composer should implement its update logic.
72 @param {Date} timestamp time that the draw cycle started
73 */
74 frame: {
75 value: function(timestamp) {
76
77 }
78 },
79
80
81 /*
82 Invoked by the framework to default the composer's element to the component's element if necessary.
83 @private
84 */
85 _resolveDefaults: {
86 value: function() {
87 if (this.element == null) {
88 if (this.component != null) {
89 this.element = this.component.element;
90 }
91 }
92 }
93 },
94
95 /*
96 Invoked by the framework to load this composer
97 @private
98 */
99 _load: {
100 value: function() {
101 if (!this.element) {
102 this._resolveDefaults();
103 }
104 this.load();
105 }
106 },
107
108 /**
109 Called when a composer should be loaded. Any event listeners that the composer needs to install should
110 be installed in this method.
111 @function
112 */
113 load: {
114 value: function() {
115
116 }
117 },
118
119 /**
120 Called when a component removes a composer. Any event listeners that the composer needs to remove should
121 be removed in this method and any additional cleanup should be performed.
122 @function
123 */
124 unload: {
125 value: function() {
126
127 }
128 },
129
130 /*
131 Called when a composer is part of a template serialization. It's responsible for calling addComposer on
132 the component.
133 */
134 deserializedFromTemplate: {
135 value: function() {
136 if (this.component) {
137 this.component.addComposer(this);
138 }
139 }
140 }
141
142});
diff --git a/node_modules/montage/ui/composer/long-press-composer.js b/node_modules/montage/ui/composer/long-press-composer.js
new file mode 100644
index 00000000..717bb42e
--- /dev/null
+++ b/node_modules/montage/ui/composer/long-press-composer.js
@@ -0,0 +1,232 @@
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/**
14 @class module:montage/ui/composer/long-press-composer.LongPressComposer
15 @extends module:montage/ui/composer/composer.Composer
16*/
17exports.LongPressComposer = Montage.create(Composer,/** @lends module:montage/ui/event/composer/long-press-composer.LongPressComposer# */ {
18
19/**
20 Description TODO
21 @private
22*/
23 _motionThreshold: {
24 value: 10
25 },
26/**
27 Description TODO
28 @private
29*/
30 _longpressTimeOut: {
31 value: 1500
32 },
33
34 _longPressTimer: {
35 value: null
36 },
37
38 _fingerId: {
39 value: null
40 },
41
42 _X: {
43 value: null
44 },
45
46 _Y: {
47 value: null
48 },
49
50 /**
51 Description TODO
52 @function
53 */
54 load: {
55 value: function () {
56 if (window.Touch) {
57 this._element.addEventListener("touchstart", this);
58 this._element.addEventListener("touchmove", this);
59 this._element.addEventListener("touchend", this);
60 } else {
61 this._element.addEventListener("mousedown", this);
62 }
63 }
64 },
65 /**
66 Description TODO
67 @function
68 */
69 unload: {
70 value: function () {
71 if (window.Touch) {
72 this._element.removeEventListener("touchstart", this);
73 this._element.removeEventListener("touchmove", this);
74 this._element.removeEventListener("touchend", this);
75 }
76 else {
77 this._element.removeEventListener("mousedown", this);