diff options
author | Armen Kesablyan | 2012-06-02 20:54:30 -0700 |
---|---|---|
committer | Armen Kesablyan | 2012-06-02 20:54:30 -0700 |
commit | 7655e32da5bcdf7b205afc1908c9b7bcc661b0d4 (patch) | |
tree | c5192853a61480a7e2957349a3d5b5021ff0036e /js/stage/binding-view.reel/binding-view.js | |
parent | 10d97af27fca224752ad04551ca5c41982222d1f (diff) | |
download | ninja-7655e32da5bcdf7b205afc1908c9b7bcc661b0d4.tar.gz |
binding canvas
Signed-off-by: Armen Kesablyan <armen@motorola.com>
Diffstat (limited to 'js/stage/binding-view.reel/binding-view.js')
-rwxr-xr-x | js/stage/binding-view.reel/binding-view.js | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/js/stage/binding-view.reel/binding-view.js b/js/stage/binding-view.reel/binding-view.js index 90e6a5e3..d17735b2 100755 --- a/js/stage/binding-view.reel/binding-view.js +++ b/js/stage/binding-view.reel/binding-view.js | |||
@@ -26,6 +26,12 @@ exports.BindingView = Montage.create(Component, { | |||
26 | _bindingViewCanvas: { | 26 | _bindingViewCanvas: { |
27 | value:null | 27 | value:null |
28 | }, | 28 | }, |
29 | _canvas: { | ||
30 | value:null | ||
31 | }, | ||
32 | _context : { | ||
33 | value: null | ||
34 | }, | ||
29 | 35 | ||
30 | //Public Objects | 36 | //Public Objects |
31 | hudRepeater: { value: null }, | 37 | hudRepeater: { value: null }, |
@@ -73,7 +79,9 @@ exports.BindingView = Montage.create(Component, { | |||
73 | //Montage Draw Cycle | 79 | //Montage Draw Cycle |
74 | prepareForDraw: { | 80 | prepareForDraw: { |
75 | value: function() { | 81 | value: function() { |
76 | 82 | this._canvas = this.application.ninja.stage.drawingCanvas; | |
83 | this._context = this._canvas.getContext('2d'); | ||
84 | this.application.ninja.stage._iframeContainer.addEventListener("scroll", this, false); | ||
77 | } | 85 | } |
78 | }, | 86 | }, |
79 | 87 | ||
@@ -87,8 +95,9 @@ exports.BindingView = Montage.create(Component, { | |||
87 | {"title":"Value", | 95 | {"title":"Value", |
88 | "bindings": [ | 96 | "bindings": [ |
89 | {"direction": "<-", "boundObject":"Checkbox1", "boundProperty": "Value"} | 97 | {"direction": "<-", "boundObject":"Checkbox1", "boundProperty": "Value"} |
90 | ]}, | 98 | ] |
91 | {"title": "Width"} | 99 | }, |
100 | {"title": "Width", "bindings": []} | ||
92 | ], | 101 | ], |
93 | "x": 20, | 102 | "x": 20, |
94 | "y": 20 | 103 | "y": 20 |
@@ -96,28 +105,47 @@ exports.BindingView = Montage.create(Component, { | |||
96 | { | 105 | { |
97 | "title": "Checkbox1", | 106 | "title": "Checkbox1", |
98 | "properties": [ | 107 | "properties": [ |
99 | {"title":"Group"}, | 108 | {"title":"Group" , "bindings": []}, |
100 | {"title": "Value"} | 109 | {"title":"Value", |
110 | "bindings": [ | ||
111 | {"direction": "->", "boundObject":"Input1", "boundProperty": "Value"} | ||
112 | ] | ||
113 | } | ||
101 | ], | 114 | ], |
102 | "x": 120, | 115 | "x": 120, |
103 | "y": 120 | 116 | "y": 120 |
104 | } | 117 | } |
105 | ]; | 118 | ]; |
119 | this.drawBlueLine(100,100,200,200) | ||
120 | |||
106 | } else { | 121 | } else { |
107 | this.bindables = []; | 122 | this.bindables = []; |
108 | } | 123 | } |
124 | |||
109 | } | 125 | } |
110 | }, | 126 | }, |
111 | 127 | ||
112 | drawBlueLine: { | 128 | drawBlueLine: { |
113 | value: function(fromX,fromY,toX,toY) { | 129 | value: function(fromX,fromY,toX,toY) { |
130 | this._context.lineWidth = 4; // Set Line Thickness | ||
131 | this._context.strokeStyle = "#00F" | ||
114 | 132 | ||
133 | this._context.beginPath(); // Start Drawing Line | ||
134 | this._context.moveTo(fromX, fromY); | ||
135 | this._context.lineTo(toX, toY); | ||
136 | this._context.stroke(); | ||
115 | } | 137 | } |
116 | }, | 138 | }, |
117 | 139 | ||
118 | handleMousedown: { | 140 | handleMousedown: { |
119 | value: function(event) { | 141 | value: function(event) { |
120 | debugger; | 142 | |
143 | } | ||
144 | }, | ||
145 | |||
146 | handleScroll: { | ||
147 | value: function() { | ||
148 | this.needsDraw = true; | ||
121 | } | 149 | } |
122 | }, | 150 | }, |
123 | 151 | ||