diff options
author | Armen Kesablyan | 2012-06-13 11:37:11 -0700 |
---|---|---|
committer | Armen Kesablyan | 2012-06-13 11:37:11 -0700 |
commit | d2e2a39feeba51e976d139eddf6f1cf331457f4f (patch) | |
tree | 7616fb59b5210d0d0128f1fd5dde34a43eb13f11 | |
parent | cfa2d42f6ca65eb3ce1bea92db5f4af87dd68bb5 (diff) | |
parent | d57ab6509805ba4e97d6c74be913a2c1b324af3a (diff) | |
download | ninja-d2e2a39feeba51e976d139eddf6f1cf331457f4f.tar.gz |
Merge pull request #12 from ericguzman/binding
Binding Panel update
-rw-r--r-- | js/controllers/objects-controller.js | 58 | ||||
-rw-r--r-- | js/panels/binding-panel.reel/binding-panel.css | 5 | ||||
-rw-r--r-- | js/panels/binding-panel.reel/binding-panel.js | 56 | ||||
-rw-r--r-- | js/panels/binding/edit-binding-view.reel/edit-binding-view.css | 87 | ||||
-rw-r--r-- | js/panels/binding/edit-binding-view.reel/edit-binding-view.html | 59 | ||||
-rw-r--r-- | js/panels/binding/edit-binding-view.reel/edit-binding-view.js | 2 | ||||
-rwxr-xr-x | js/panels/components-panel.reel/components-panel.js | 1 | ||||
-rw-r--r-- | js/panels/objects/object.reel/object.css | 44 | ||||
-rw-r--r-- | js/panels/objects/object.reel/object.js | 30 | ||||
-rw-r--r-- | js/panels/objects/objects-panel.reel/objects-panel.css | 17 | ||||
-rw-r--r-- | js/panels/objects/objects-panel.reel/objects-panel.html | 18 | ||||
-rwxr-xr-x | js/stage/binding-view.reel/binding-view.html | 8 |
12 files changed, 295 insertions, 90 deletions
diff --git a/js/controllers/objects-controller.js b/js/controllers/objects-controller.js index fd9b12f4..386ef683 100644 --- a/js/controllers/objects-controller.js +++ b/js/controllers/objects-controller.js | |||
@@ -7,6 +7,10 @@ | |||
7 | var Montage = require("montage/core/core").Montage, | 7 | var Montage = require("montage/core/core").Montage, |
8 | Component = require("montage/ui/component").Component; | 8 | Component = require("montage/ui/component").Component; |
9 | 9 | ||
10 | var CATEGORIES = { | ||
11 | |||
12 | }; | ||
13 | |||
10 | var objectsController = exports.ObjectsController = Montage.create(Component, { | 14 | var objectsController = exports.ObjectsController = Montage.create(Component, { |
11 | 15 | ||
12 | _currentDocument : { | 16 | _currentDocument : { |
@@ -62,6 +66,7 @@ var objectsController = exports.ObjectsController = Montage.create(Component, { | |||
62 | if(!bindingArgs.sourceObject || !bindingArgs.sourceObjectPropertyPath || !bindingArgs) { return; } | 66 | if(!bindingArgs.sourceObject || !bindingArgs.sourceObjectPropertyPath || !bindingArgs) { return; } |
63 | 67 | ||
64 | Object.defineBinding(bindingArgs.sourceObject, bindingArgs.sourceObjectPropertyPath, bindingArgs); | 68 | Object.defineBinding(bindingArgs.sourceObject, bindingArgs.sourceObjectPropertyPath, bindingArgs); |
69 | this.currentObjectBindings = this.getObjectBindings(value); | ||
65 | } | 70 | } |
66 | }, | 71 | }, |
67 | 72 | ||
@@ -72,6 +77,7 @@ var objectsController = exports.ObjectsController = Montage.create(Component, { | |||
72 | 77 | ||
73 | 78 | ||
74 | Object.deleteBinding(bindingArgs.sourceObject, bindingArgs.sourceObjectPropertyPath); | 79 | Object.deleteBinding(bindingArgs.sourceObject, bindingArgs.sourceObjectPropertyPath); |
80 | this.currentObjectBindings = this.getObjectBindings(value); | ||
75 | } | 81 | } |
76 | }, | 82 | }, |
77 | 83 | ||
@@ -88,6 +94,7 @@ var objectsController = exports.ObjectsController = Montage.create(Component, { | |||
88 | } | 94 | } |
89 | 95 | ||
90 | this.addBinding(bindingArgs); | 96 | this.addBinding(bindingArgs); |
97 | |||
91 | } | 98 | } |
92 | }, | 99 | }, |
93 | 100 | ||
@@ -119,20 +126,11 @@ var objectsController = exports.ObjectsController = Montage.create(Component, { | |||
119 | } | 126 | } |
120 | }, | 127 | }, |
121 | 128 | ||
122 | /* ---- Bindable Properties ---- */ | 129 | /* ---- Get Bindable Properties ---- */ |
123 | 130 | ||
124 | getPropertyList : { | 131 | getPropertyList : { |
125 | value: function(object, excludeUnderscoreProperties) { | 132 | value: function(object, excludeUnderscoreProperties) { |
126 | var object_i = object, | 133 | return this.getPrototypes(object).map(function(proto) { |
127 | prototypes = [object_i]; | ||
128 | |||
129 | ///// Collect prototypes | ||
130 | while(Object.getPrototypeOf(object_i)) { | ||
131 | object_i = Object.getPrototypeOf(object_i); | ||
132 | prototypes.push(object_i); | ||
133 | } | ||
134 | |||
135 | return prototypes.map(function(proto) { | ||
136 | 134 | ||
137 | var metadata = proto._montage_metadata, | 135 | var metadata = proto._montage_metadata, |
138 | objectName = (metadata) ? metadata.objectName : "Object"; | 136 | objectName = (metadata) ? metadata.objectName : "Object"; |
@@ -166,6 +164,44 @@ var objectsController = exports.ObjectsController = Montage.create(Component, { | |||
166 | } | 164 | } |
167 | }, | 165 | }, |
168 | 166 | ||
167 | getPrototypes : { | ||
168 | value: function(object) { | ||
169 | var object_i = object, | ||
170 | prototypes = [object_i]; | ||
171 | |||
172 | ///// Collect prototypes | ||
173 | while(Object.getPrototypeOf(object_i)) { | ||
174 | object_i = Object.getPrototypeOf(object_i); | ||
175 | prototypes.push(object_i); | ||
176 | } | ||
177 | |||
178 | return prototypes; | ||
179 | } | ||
180 | }, | ||
181 | |||
182 | /* ----- Category properties ----- */ | ||
183 | |||
184 | getObjectCategory : { | ||
185 | value: function(object) { | ||
186 | if(this._hasPrototype(object, 'Component')) { | ||
187 | return 'Component'; | ||
188 | } | ||
189 | |||
190 | return null; | ||
191 | } | ||
192 | }, | ||
193 | |||
194 | _hasPrototype : { | ||
195 | value: function(object, prototypeName) { | ||
196 | var prototypes = this.getPrototypes(object).map(function(proto) { | ||
197 | var metadata = proto._montage_metadata; | ||
198 | return (metadata) ? metadata.objectName : "Object"; | ||
199 | }); | ||
200 | |||
201 | return prototypes.indexOf(prototypeName) !== -1; | ||
202 | } | ||
203 | }, | ||
204 | |||
169 | /* ---- Bindable controller properties ---- */ | 205 | /* ---- Bindable controller properties ---- */ |
170 | 206 | ||
171 | currentObjectBindings : { | 207 | currentObjectBindings : { |
diff --git a/js/panels/binding-panel.reel/binding-panel.css b/js/panels/binding-panel.reel/binding-panel.css index a1d5be0f..787cf114 100644 --- a/js/panels/binding-panel.reel/binding-panel.css +++ b/js/panels/binding-panel.reel/binding-panel.css | |||
@@ -20,3 +20,8 @@ | |||
20 | .binding-panel-toolbar-container { | 20 | .binding-panel-toolbar-container { |
21 | -webkit-box-flex: 0; | 21 | -webkit-box-flex: 0; |
22 | } | 22 | } |
23 | |||
24 | .binding-panel .edit-view-docked { | ||
25 | left: 0; | ||
26 | -webkit-transition-duration: 0; | ||
27 | } \ No newline at end of file | ||
diff --git a/js/panels/binding-panel.reel/binding-panel.js b/js/panels/binding-panel.reel/binding-panel.js index 0641ecf5..45fa4005 100644 --- a/js/panels/binding-panel.reel/binding-panel.js +++ b/js/panels/binding-panel.reel/binding-panel.js | |||
@@ -6,6 +6,19 @@ exports.BindingPanel = Montage.create(Component, { | |||
6 | 6 | ||
7 | bindings : { value: null }, | 7 | bindings : { value: null }, |
8 | editView : { value: null }, | 8 | editView : { value: null }, |
9 | |||
10 | _dockEditView : { value: null }, | ||
11 | dockEditView : { | ||
12 | get : function() { return this._dockEditView; }, | ||
13 | set : function(value) { | ||
14 | if(value === this._dockEditView) { return; } | ||
15 | |||
16 | this._dockEditView = value; | ||
17 | |||
18 | this.needsDraw = true; | ||
19 | } | ||
20 | }, | ||
21 | |||
9 | _editing: { value: null }, | 22 | _editing: { value: null }, |
10 | editing: { | 23 | editing: { |
11 | get: function() { | 24 | get: function() { |
@@ -14,6 +27,11 @@ exports.BindingPanel = Montage.create(Component, { | |||
14 | set: function(value) { | 27 | set: function(value) { |
15 | if(value === this._editing) { return; } | 28 | if(value === this._editing) { return; } |
16 | this._editing = value; | 29 | this._editing = value; |
30 | |||
31 | if(!value) { | ||
32 | this.dockEditView = false; | ||
33 | } | ||
34 | |||
17 | this.needsDraw = true; | 35 | this.needsDraw = true; |
18 | } | 36 | } |
19 | }, | 37 | }, |
@@ -29,6 +47,18 @@ exports.BindingPanel = Montage.create(Component, { | |||
29 | }, | 47 | }, |
30 | 48 | ||
31 | /* ------------------------- | 49 | /* ------------------------- |
50 | Event handlers | ||
51 | ------------------------- */ | ||
52 | |||
53 | handleWebkitTransitionEnd : { | ||
54 | value: function(e) { | ||
55 | console.log("trans end"); | ||
56 | |||
57 | this.dockEditView = this.editing; | ||
58 | } | ||
59 | }, | ||
60 | |||
61 | /* ------------------------- | ||
32 | Toolbar Button Actions | 62 | Toolbar Button Actions |
33 | ------------------------- */ | 63 | ------------------------- */ |
34 | 64 | ||
@@ -54,8 +84,16 @@ exports.BindingPanel = Montage.create(Component, { | |||
54 | } | 84 | } |
55 | }, | 85 | }, |
56 | 86 | ||
87 | prepareForDraw : { | ||
88 | value: function() { | ||
89 | |||
90 | } | ||
91 | }, | ||
92 | |||
57 | willDraw: { | 93 | willDraw: { |
58 | value: function() { | 94 | value: function() { |
95 | this.editView.element.addEventListener('webkitTransitionEnd', this, false); | ||
96 | |||
59 | if(this.editing) { | 97 | if(this.editing) { |
60 | this._translateDistance = this.element.offsetWidth; | 98 | this._translateDistance = this.element.offsetWidth; |
61 |