aboutsummaryrefslogtreecommitdiff
path: root/js/panels
diff options
context:
space:
mode:
authorArmen Kesablyan2012-06-11 10:25:49 -0700
committerArmen Kesablyan2012-06-11 10:25:49 -0700
commitaaac232727c82361771a0804049ada8fae17a549 (patch)
treecd9110dacb9e39e98a5d8bbd7f1dad2780cbcc1a /js/panels
parent6a27268ebf1cd5fa7bf8313eb5712fd5f6985758 (diff)
parentdbb36888eda1f25387852ea79aef89d22dfd7799 (diff)
downloadninja-aaac232727c82361771a0804049ada8fae17a549.tar.gz
Merge pull request #11 from ericguzman/binding
Binding
Diffstat (limited to 'js/panels')
-rw-r--r--js/panels/binding-panel.reel/binding-panel.css7
-rw-r--r--js/panels/binding-panel.reel/binding-panel.html18
-rw-r--r--js/panels/binding-panel.reel/binding-panel.js18
-rw-r--r--js/panels/binding/binding-item.reel/binding-item.js14
-rw-r--r--js/panels/binding/edit-binding-view.reel/edit-binding-view.css25
-rw-r--r--js/panels/binding/edit-binding-view.reel/edit-binding-view.html127
-rw-r--r--js/panels/binding/edit-binding-view.reel/edit-binding-view.js196
7 files changed, 366 insertions, 39 deletions
diff --git a/js/panels/binding-panel.reel/binding-panel.css b/js/panels/binding-panel.reel/binding-panel.css
index e3dcf140..a1d5be0f 100644
--- a/js/panels/binding-panel.reel/binding-panel.css
+++ b/js/panels/binding-panel.reel/binding-panel.css
@@ -7,9 +7,16 @@
7.binding-panel { 7.binding-panel {
8 position: relative; 8 position: relative;
9 height: 100%; 9 height: 100%;
10 display: -webkit-box;
11 overflow: hidden;
12 -webkit-box-orient: vertical;
10} 13}
11 14
12.bindings-list { 15.bindings-list {
16 -webkit-box-flex: 1;
13 padding: 0; 17 padding: 0;
14 margin: 0; 18 margin: 0;
15} 19}
20.binding-panel-toolbar-container {
21 -webkit-box-flex: 0;
22}
diff --git a/js/panels/binding-panel.reel/binding-panel.html b/js/panels/binding-panel.reel/binding-panel.html
index a926da8d..9a2834c7 100644
--- a/js/panels/binding-panel.reel/binding-panel.html
+++ b/js/panels/binding-panel.reel/binding-panel.html
@@ -36,6 +36,7 @@
36 "element": {"#": "binding-item"} 36 "element": {"#": "binding-item"}
37 }, 37 },
38 "bindings": { 38 "bindings": {
39 "bindingArgs": {"<-": "@repetition.objectAtCurrentIteration"},
39 "sourceObjectPropertyPath": {"<-": "@repetition.objectAtCurrentIteration.sourceObjectPropertyPath"}, 40 "sourceObjectPropertyPath": {"<-": "@repetition.objectAtCurrentIteration.sourceObjectPropertyPath"},
40 "sourceObject": {"<-": "@repetition.objectAtCurrentIteration.sourceObject"}, 41 "sourceObject": {"<-": "@repetition.objectAtCurrentIteration.sourceObject"},
41 "boundObjectPropertyPath": {"<-": "@repetition.objectAtCurrentIteration.boundObjectPropertyPath"}, 42 "boundObjectPropertyPath": {"<-": "@repetition.objectAtCurrentIteration.boundObjectPropertyPath"},
@@ -48,8 +49,20 @@
48 "properties": { 49 "properties": {
49 "element": {"#": "edit-binding-view" } 50 "element": {"#": "edit-binding-view" }
50 } 51 }
52 },
53 "toolbar": {
54 "prototype": "js/components/toolbar.reel",
55 "properties": {
56 "element": {"#": "binding-panel-toolbar"},
57 "delegate": {"@": "owner" },
58 "buttons": [
59 {
60 "title": "Add",
61 "identifier": "add"
62 }
63 ]
64 }
51 } 65 }
52
53 } 66 }
54 </script> 67 </script>
55 </head> 68 </head>
@@ -58,6 +71,9 @@
58 <ul data-montage-id="bindings-list" class="bindings-list"> 71 <ul data-montage-id="bindings-list" class="bindings-list">
59 <li data-montage-id="binding-item" class="binding-item"></li> 72 <li data-montage-id="binding-item" class="binding-item"></li>
60 </ul> 73 </ul>
74 <div data-montage-id="binding-panel-toolbar-container" class="binding-panel-toolbar-container">
75 <div data-montage-id="binding-panel-toolbar"></div>
76 </div>
61 <div data-montage-id="edit-binding-view" class="edit-binding-view"></div> 77 <div data-montage-id="edit-binding-view" class="edit-binding-view"></div>
62 </div> 78 </div>
63</body> 79</body>
diff --git a/js/panels/binding-panel.reel/binding-panel.js b/js/panels/binding-panel.reel/binding-panel.js
index c2ce556c..0641ecf5 100644
--- a/js/panels/binding-panel.reel/binding-panel.js
+++ b/js/panels/binding-panel.reel/binding-panel.js
@@ -6,7 +6,6 @@ exports.BindingPanel = Montage.create(Component, {
6 6
7 bindings : { value: null }, 7 bindings : { value: null },
8 editView : { value: null }, 8 editView : { value: null },
9 editingClass : { value: 'editing-binding' },
10 _editing: { value: null }, 9 _editing: { value: null },
11 editing: { 10 editing: {
12 get: function() { 11 get: function() {
@@ -24,14 +23,27 @@ exports.BindingPanel = Montage.create(Component, {
24 23
25 displayEditView : { 24 displayEditView : {
26 value: function(bindingArgs) { 25 value: function(bindingArgs) {
26 this.editView.bindingArgs = bindingArgs;
27 this.editing = true; 27 this.editing = true;
28 } 28 }
29 }, 29 },
30 30
31 /* ------------------------- 31 /* -------------------------
32 Draw Cycle 32 Toolbar Button Actions
33 ------------------------- */ 33 ------------------------- */
34 34
35 handleAddAction : {
36 value: function(e) {
37 var newBindingArgs = {
38 sourceObject : this.application.ninja.objectsController.currentObject
39 };
40
41 this.displayEditView(newBindingArgs);
42 }
43 },
44
45
46
35 templateDidLoad : { 47 templateDidLoad : {
36 value: function() { 48 value: function() {
37 Object.defineBinding(this, 'bindings', { 49 Object.defineBinding(this, 'bindings', {
@@ -56,8 +68,10 @@ exports.BindingPanel = Montage.create(Component, {
56 68
57 if(this.editing) { 69 if(this.editing) {
58 this.editView.element.style.setProperty(transStr, 'translate3d(-'+ this._translateDistance + 'px,0,0)'); 70 this.editView.element.style.setProperty(transStr, 'translate3d(-'+ this._translateDistance + 'px,0,0)');
71 this.editView.element.style.setProperty('box-shadow', '0 0 10px rgba(0,0,0,0.2)')
59 } else { 72 } else {
60 this.editView.element.style.removeProperty(transStr); 73 this.editView.element.style.removeProperty(transStr);
74 this.editView.element.style.removeProperty('box-shadow');
61 } 75 }
62 } 76 }
63 } 77 }
diff --git a/js/panels/binding/binding-item.reel/binding-item.js b/js/panels/binding/binding-item.reel/binding-item.js
index 55230fc3..a1017020 100644
--- a/js/panels/binding/binding-item.reel/binding-item.js
+++ b/js/panels/binding/binding-item.reel/binding-item.js
@@ -12,6 +12,10 @@ exports.BindingItem = Montage.create(Component, {
12 sourceObjectLabel : { value: null }, 12 sourceObjectLabel : { value: null },
13 boundObjectLabel : { value: null }, 13 boundObjectLabel : { value: null },
14 14
15 bindingArgs : {
16 value: null
17 },
18
15 _sourceObject : { value: null }, 19 _sourceObject : { value: null },
16 sourceObject : { 20 sourceObject : {
17 get: function() { 21 get: function() {
@@ -73,7 +77,9 @@ exports.BindingItem = Montage.create(Component, {
73 }, 77 },
74 set: function(value) { 78 set: function(value) {
75 if(value === this._oneway) { return; } 79 if(value === this._oneway) { return; }
80
76 this._oneway = value; 81 this._oneway = value;
82
77 this.needsDraw = true; 83 this.needsDraw = true;
78 } 84 }
79 }, 85 },
@@ -82,13 +88,19 @@ exports.BindingItem = Montage.create(Component, {
82 88
83 handleDirectionToggleButtonAction : { 89 handleDirectionToggleButtonAction : {
84 value: function(e) { 90 value: function(e) {
91 var controller = this.application.ninja.objectsController;
92
85 this.oneway = !this.oneway; 93 this.oneway = !this.oneway;
94 controller.editBinding(this.bindingArgs, {
95 oneway: !this.bindingArgs.oneway
96 });
97 controller.currentItem = controller.currentItem;
86 } 98 }
87 }, 99 },
88 100
89 handleEditButtonAction : { 101 handleEditButtonAction : {
90 value: function(e) { 102 value: function(e) {
91 this.parentComponent.parentComponent.displayEditView(); 103 this.parentComponent.parentComponent.displayEditView(this.bindingArgs);
92 } 104 }
93 }, 105 },
94 106
diff --git a/js/panels/binding/edit-binding-view.reel/edit-binding-view.css b/js/panels/binding/edit-binding-view.reel/edit-binding-view.css
index b0249c6c..aa539cd6 100644
--- a/js/panels/binding/edit-binding-view.reel/edit-binding-view.css
+++ b/js/panels/binding/edit-binding-view.reel/edit-binding-view.css
@@ -9,11 +9,14 @@
9 color: #FFF; 9 color: #FFF;
10 font-size: 11px; 10 font-size: 11px;
11 height: 100%; 11 height: 100%;
12 /*left: 100%;*/ 12 left: 100%;
13 /*position: absolute;*/ 13 position: absolute;
14 /*top: 0;*/ 14 top: 0;
15 width: 100%; 15 width: 100%;
16 -webkit-transition: -webkit-transform 140ms ease-in; 16 -webkit-transition-property: -webkit-transform, box-shadow;
17 -webkit-transition-durat