diff options
Diffstat (limited to 'js/stage/binding-view.reel/binding-view.js')
-rwxr-xr-x | js/stage/binding-view.reel/binding-view.js | 103 |
1 files changed, 64 insertions, 39 deletions
diff --git a/js/stage/binding-view.reel/binding-view.js b/js/stage/binding-view.reel/binding-view.js index d17735b2..8ffc45c1 100755 --- a/js/stage/binding-view.reel/binding-view.js +++ b/js/stage/binding-view.reel/binding-view.js | |||
@@ -13,7 +13,7 @@ var Montage = require("montage/core/core").Montage, | |||
13 | 13 | ||
14 | exports.BindingView = Montage.create(Component, { | 14 | exports.BindingView = Montage.create(Component, { |
15 | //private Properties | 15 | //private Properties |
16 | _selectedElement: { | 16 | _selectedComponent: { |
17 | value: null | 17 | value: null |
18 | }, | 18 | }, |
19 | _bindables: { | 19 | _bindables: { |
@@ -38,12 +38,22 @@ exports.BindingView = Montage.create(Component, { | |||
38 | 38 | ||
39 | 39 | ||
40 | //Public Properties | 40 | //Public Properties |
41 | selectedElement: { | 41 | selectedComponent: { |
42 | get: function() { | 42 | get: function() { |
43 | return this._selectedElement; | 43 | return this._selectedComponent; |
44 | }, | 44 | }, |
45 | set: function(val) { | 45 | set: function(val) { |
46 | this._selectedElement = val; | 46 | this._selectedComponent = val; |
47 | this.application.ninja.objectsController.currentObject = this.selectedComponent; | ||
48 | var arrBindings = this.application.ninja.objectsController.currentObjectBindings; | ||
49 | arrBindings.forEach(function(obj) { | ||
50 | |||
51 | }.bind(this)); | ||
52 | // Get Bindings that exist; | ||
53 | |||
54 | |||
55 | //Get Properties of Elements in bindings; | ||
56 | |||
47 | this.needsDraw = true; | 57 | this.needsDraw = true; |
48 | } | 58 | } |
49 | }, | 59 | }, |
@@ -73,13 +83,19 @@ exports.BindingView = Montage.create(Component, { | |||
73 | }, | 83 | }, |
74 | 84 | ||
75 | //Methods | 85 | //Methods |
76 | 86 | canvas: { | |
77 | 87 | get: function() { | |
88 | return this._canvas; | ||
89 | }, | ||
90 | set: function(val) { | ||
91 | this._canvas = val; | ||
92 | } | ||
93 | }, | ||
78 | 94 | ||
79 | //Montage Draw Cycle | 95 | //Montage Draw Cycle |
80 | prepareForDraw: { | 96 | prepareForDraw: { |
81 | value: function() { | 97 | value: function() { |
82 | this._canvas = this.application.ninja.stage.drawingCanvas; | 98 | //this._canvas = this.application.ninja.stage.drawingCanvas; |
83 | this._context = this._canvas.getContext('2d'); | 99 | this._context = this._canvas.getContext('2d'); |
84 | this.application.ninja.stage._iframeContainer.addEventListener("scroll", this, false); | 100 | this.application.ninja.stage._iframeContainer.addEventListener("scroll", this, false); |
85 | } | 101 | } |
@@ -87,39 +103,42 @@ exports.BindingView = Montage.create(Component, { | |||
87 | 103 | ||
88 | draw: { | 104 | draw: { |
89 | value: function() { | 105 | value: function() { |
90 | if(this.selectedElement !== null) { | 106 | if(this.selectedComponent !== null) { |
91 | this.bindables = [ | 107 | // this.bindables = [ |
92 | { | 108 | // { |
93 | "title": "Input1", | 109 | // "title": "Input1", |
94 | "properties": [ | 110 | // "properties": [ |
95 | {"title":"Value", | 111 | // {"title":"Value", |
96 | "bindings": [ | 112 | // "bindings": [ |
97 | {"direction": "<-", "boundObject":"Checkbox1", "boundProperty": "Value"} | 113 | // {"direction": "<-", "boundObject":"Checkbox1", "boundProperty": "Value"} |
98 | ] | 114 | // ] |
99 | }, | 115 | // }, |
100 | {"title": "Width", "bindings": []} | 116 | // {"title": "Width", "bindings": []} |
101 | ], | 117 | // ], |
102 | "x": 20, | 118 | // "x": 20, |
103 | "y": 20 | 119 | // "y": 20 |
104 | }, | 120 | // }, |
105 | { | 121 | // { |
106 | "title": "Checkbox1", | 122 | // "title": "Checkbox1", |
107 | "properties": [ | 123 | // "properties": [ |
108 | {"title":"Group" , "bindings": []}, | 124 | // {"title":"Group" , "bindings": []}, |
109 | {"title":"Value", | 125 | // {"title":"Value", |
110 | "bindings": [ | 126 | // "bindings": [ |
111 | {"direction": "->", "boundObject":"Input1", "boundProperty": "Value"} | 127 | // {"direction": "->", "boundObject":"Input1", "boundProperty": "Value"} |
112 | ] | 128 | // ] |
113 | } | 129 | // } |
114 | ], | 130 | // ], |
115 | "x": 120, | 131 | // "x": 120, |
116 | "y": 120 | 132 | // "y": 120 |
117 | } | 133 | // } |
118 | ]; | 134 | // ]; |
119 | this.drawBlueLine(100,100,200,200) | 135 | this.canvas.width = this.application.ninja.stage.drawingCanvas.offsetWidth; |
136 | this.canvas.height = this.application.ninja.stage.drawingCanvas.offsetHeight; | ||
137 | this.clearCanvas(); | ||
138 | this.drawBlueLine(110,53,210,173); | ||
120 | 139 | ||
121 | } else { | 140 | } else { |
122 | this.bindables = []; | 141 | //this.bindables = []; |
123 | } | 142 | } |
124 | 143 | ||
125 | } | 144 | } |
@@ -128,7 +147,7 @@ exports.BindingView = Montage.create(Component, { | |||
128 | drawBlueLine: { | 147 | drawBlueLine: { |
129 | value: function(fromX,fromY,toX,toY) { | 148 | value: function(fromX,fromY,toX,toY) { |
130 | this._context.lineWidth = 4; // Set Line Thickness | 149 | this._context.lineWidth = 4; // Set Line Thickness |
131 | this._context.strokeStyle = "#00F" | 150 | this._context.strokeStyle = "#5e9eff" |
132 | 151 | ||
133 | this._context.beginPath(); // Start Drawing Line | 152 | this._context.beginPath(); // Start Drawing Line |
134 | this._context.moveTo(fromX, fromY); | 153 | this._context.moveTo(fromX, fromY); |
@@ -137,6 +156,12 @@ exports.BindingView = Montage.create(Component, { | |||
137 | } | 156 | } |
138 | }, | 157 | }, |
139 | 158 | ||
159 | clearCanvas: { | ||
160 | value: function() { | ||
161 | this._context.clearRect(0,0,this._canvas.offsetWidth,this._canvas.offsetHeight); | ||
162 | } | ||
163 | }, | ||
164 | |||
140 | handleMousedown: { | 165 | handleMousedown: { |
141 | value: function(event) { | 166 | value: function(event) { |
142 | 167 | ||