diff options
Diffstat (limited to 'node_modules/montage/ui/composer/composer.js')
-rw-r--r-- | node_modules/montage/ui/composer/composer.js | 45 |
1 files changed, 27 insertions, 18 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 | */ |
10 | var Montage = require("montage").Montage; | 10 | var 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 | */ |
15 | exports.Composer = Montage.create(Montage, /** @lends module:montage/ui/composer/composer.Composer# */ { | 16 | exports.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() { |