aboutsummaryrefslogtreecommitdiff
path: root/node_modules/montage/ui/composer
diff options
context:
space:
mode:
authorValerio Virgillito2012-05-03 22:53:07 -0700
committerValerio Virgillito2012-05-03 22:53:07 -0700
commit24b483db367291b72170f969de78efcb1a9b95bd (patch)
treea691a7803cefbfa76a6331a50cbeebcd16287d91 /node_modules/montage/ui/composer
parentdc93269cfa7c315d22d85c8217e2412749643f28 (diff)
downloadninja-24b483db367291b72170f969de78efcb1a9b95bd.tar.gz
integrating the latest montage version
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.js45
-rw-r--r--node_modules/montage/ui/composer/press-composer.js28
-rw-r--r--node_modules/montage/ui/composer/translate-composer.js641
3 files changed, 388 insertions, 326 deletions
diff --git a/node_modules/montage/ui/composer/composer.js b/node_modules/montage/ui/composer/composer.js
index 52027a7c..7c30b259 100644
--- a/node_modules/montage/ui/composer/composer.js
+++ b/node_modules/montage/ui/composer/composer.js
@@ -5,12 +5,13 @@
5 </copyright> */ 5 </copyright> */
6/** 6/**
7 @module montage/ui/event/composer/composer 7 @module montage/ui/event/composer/composer
8 @requires montage 8 @requires montage/core/core
9*/ 9*/
10var Montage = require("montage").Montage; 10var Montage = require("montage").Montage;
11/** 11/**
12 @class module:montage/ui/composer/composer.Composer 12 @class module:montage/ui/composer/composer.Composer
13 @extends module:montage.Montage 13 @extends module:montage/core/core.Montage
14 @summary The Composer prototype is the base class for all composers in Montage. There are two types of composers. One type, called _gesture_ composers listen for and aggregrate low-level events into higher order events (for example, [PressComposer]{@link module:montage/ui/composer/press-composer.PressComposer}. The second type of composer is called _calculation_ composers
14 */ 15 */
15exports.Composer = Montage.create(Montage, /** @lends module:montage/ui/composer/composer.Composer# */ { 16exports.Composer = Montage.create(Montage, /** @lends module:montage/ui/composer/composer.Composer# */ {
16 17
@@ -18,6 +19,11 @@ exports.Composer = Montage.create(Montage, /** @lends module:montage/ui/composer
18 value: null 19 value: null
19 }, 20 },
20 21
22/**
23 The Montage component that the composer will listen for mouse events on.
24 @type {Component}
25 @default null
26*/
21 component: { 27 component: {
22 get: function() { 28 get: function() {
23 return this._component; 29 return this._component;
@@ -31,6 +37,11 @@ exports.Composer = Montage.create(Montage, /** @lends module:montage/ui/composer
31 value: null 37 value: null
32 }, 38 },
33 39
40/**
41 The DOM element that the composer will listen for events on. If no element is specified then the composer will use the element associated with its <code>component</code> property.
42 @type {Component}
43 @default null
44*/
34 element: { 45 element: {
35 get: function() { 46 get: function() {
36 return this._element; 47 return this._element;
@@ -42,11 +53,11 @@ exports.Composer = Montage.create(Montage, /** @lends module:montage/ui/composer
42 53
43 54
44 /** 55 /**
45 * This property controls when a composer's load method is called. If `false` 56 * This property controls when a composer's <code>load()</code> method is called, which is where the composer create event listeners. If `false`
46 * the composer's load method is called immediately as part of the next draw 57 * the composer's <code>load()</code> method is called immediately as part of the next draw
47 * cycle after addComposer has been called on its associated component. If 58 * cycle after <code>addComposer()</code> has been called on its associated component. If
48 * `true` loading of the composer is delayed until its associated component 59 * `true`, the loading of the composer is delayed until its associated component
49 * has prepareForActivationEvents called. 60 * has had its <code>prepareForActivationEvents()</code> called. Delaying the creation of event listeners until necessary can improve performance.
50 * @default false 61 * @default false
51 */ 62 */
52 lazyLoad: { 63 lazyLoad: {
@@ -58,10 +69,9 @@ exports.Composer = Montage.create(Montage, /** @lends module:montage/ui/composer
58 }, 69 },
59 70
60 /** 71 /**
61 This property should be set to true when this composer wants to have its 72 This property should be set to 'true' when the composer wants to have its <code>frame()</code> method executed during the next draw cycle.Setting this property to 'true' will cause Montage to schedule a new draw cycle if one has not already been.
62 frame method executed during the next draw cycle. Setting this property 73 @type {boolean}
63 to true will cause a draw cycle to be scheduled iff one is not already 74 @default false
64 scheduled.
65 */ 75 */
66 needsFrame: { 76 needsFrame: {
67 set: function(value) { 77 set: function(value) {
@@ -80,9 +90,9 @@ exports.Composer = Montage.create(Montage, /** @lends module:montage/ui/composer
80 }, 90 },
81 91
82 /** 92 /**
83 This method will be invoked by the framework at the beginning of a draw cycle. This is the method where 93 This method will be invoked by the framework at the beginning of a draw cycle. This is where a composer implement its update logic.
84 a composer should implement its update logic. 94 @function
85 @param {Date} timestamp time that the draw cycle started 95 @param {Date} timestamp The time that the draw cycle started
86 */ 96 */
87 frame: { 97 frame: {
88 value: function(timestamp) { 98 value: function(timestamp) {
@@ -97,10 +107,8 @@ exports.Composer = Montage.create(Montage, /** @lends module:montage/ui/composer
97 */ 107 */
98 _resolveDefaults: { 108 _resolveDefaults: {
99 value: function() { 109 value: function() {
100 if (this.element == null) { 110 if (this.element == null && this.component != null) {
101 if (this.component != null) { 111 this.element = this.component.element;
102 this.element = this.component.element;
103 }
104 } 112 }
105 } 113 }
106 }, 114 },
@@ -143,6 +151,7 @@ exports.Composer = Montage.create(Montage, /** @lends module:montage/ui/composer
143 /* 151 /*
144 Called when a composer is part of a template serialization. It's responsible for calling addComposer on 152 Called when a composer is part of a template serialization. It's responsible for calling addComposer on
145 the component. 153 the component.
154 @private
146 */ 155 */
147 deserializedFromTemplate: { 156 deserializedFromTemplate: {
148 value: function() { 157 value: function() {
diff --git a/node_modules/montage/ui/composer/press-composer.js b/node_modules/montage/ui/composer/press-composer.js
index 680c301d..d71d2ec6 100644
--- a/node_modules/montage/ui/composer/press-composer.js
+++ b/node_modules/montage/ui/composer/press-composer.js
@@ -40,7 +40,7 @@ var PressComposer = exports.PressComposer = Montage.create(Composer,/** @lends m
40 @name longPress 40 @name longPress
41 @param {Event} event 41 @param {Event} event
42 42
43 Dispatched when a press lasts for longer than (@link longPressTimeout} 43 Dispatched when a press lasts for longer than (@link longPressThreshold}
44 */ 44 */
45 45
46 /** 46 /**
@@ -129,25 +129,25 @@ var PressComposer = exports.PressComposer = Montage.create(Composer,/** @lends m
129 value: false 129 value: false
130 }, 130 },
131 131
132 _longPressTimeout: { 132 _longPressThreshold: {
133 enumerable: false, 133 enumerable: false,
134 value: 1000 134 value: 1000
135 }, 135 },
136 /** 136 /**
137 How long a press has to last for a longPress event to be dispatched 137 How long a press has to last for a longPress event to be dispatched
138 */ 138 */
139 longPressTimeout: { 139 longPressThreshold: {
140 get: function() { 140 get: function() {
141 return this._longPressTimeout; 141 return this._longPressThreshold;
142 }, 142 },
143 set: function(value) { 143 set: function(value) {
144 if (this._longPressTimeout !== value) { 144 if (this._longPressThreshold !== value) {
145 this._longPressTimeout = value; 145 this._longPressThreshold = value;
146 } 146 }
147 } 147 }
148 }, 148 },
149 149
150 _longPressTimer: { 150 _longPressTimeout: {
151 enumberable: false, 151 enumberable: false,
152 value: null 152 value: null
153 }, 153 },
@@ -407,9 +407,9 @@ var PressComposer = exports.PressComposer = Montage.create(Composer,/** @lends m
407 407
408 if (this._shouldDispatchLongPress) { 408 if (this._shouldDispatchLongPress) {
409 var self = this; 409 var self = this;
410 this._longPressTimer = setTimeout(function () { 410 this._longPressTimeout = setTimeout(function () {
411 self._dispatchLongPress(); 411 self._dispatchLongPress();
412 }, this._longPressTimeout); 412 }, this._longPressThreshold);
413 } 413 }
414 } 414 }
415 }, 415 },
@@ -422,8 +422,8 @@ var PressComposer = exports.PressComposer = Montage.create(Composer,/** @lends m
422 enumerable: false, 422 enumerable: false,
423 value: function (event) { 423 value: function (event) {
424 if (this._shouldDispatchLongPress) { 424 if (this._shouldDispatchLongPress) {
425 clearTimeout(this._longPressTimer); 425 clearTimeout(this._longPressTimeout);
426 this._longPressTimer = null; 426 this._longPressTimeout = null;
427 } 427 }
428 428
429 this.dispatchEvent(this._createPressEvent("press", event)); 429 this.dispatchEvent(this._createPressEvent("press", event));
@@ -440,7 +440,7 @@ var PressComposer = exports.PressComposer = Montage.create(Composer,/** @lends m
440 value: function (event) { 440 value: function (event) {
441 if (this._shouldDispatchLongPress) { 441 if (this._shouldDispatchLongPress) {
442 this.dispatchEvent(this._createPressEvent("longPress", event));