diff options
Diffstat (limited to 'js/stage/binding-view.reel/binding-view.js')
-rwxr-xr-x | js/stage/binding-view.reel/binding-view.js | 67 |
1 files changed, 62 insertions, 5 deletions
diff --git a/js/stage/binding-view.reel/binding-view.js b/js/stage/binding-view.reel/binding-view.js index a0ca0c4f..d17735b2 100755 --- a/js/stage/binding-view.reel/binding-view.js +++ b/js/stage/binding-view.reel/binding-view.js | |||
@@ -23,6 +23,16 @@ exports.BindingView = Montage.create(Component, { | |||
23 | value:[] | 23 | value:[] |
24 | }, | 24 | }, |
25 | 25 | ||
26 | _bindingViewCanvas: { | ||
27 | value:null | ||
28 | }, | ||
29 | _canvas: { | ||
30 | value:null | ||
31 | }, | ||
32 | _context : { | ||
33 | value: null | ||
34 | }, | ||
35 | |||
26 | //Public Objects | 36 | //Public Objects |
27 | hudRepeater: { value: null }, | 37 | hudRepeater: { value: null }, |
28 | 38 | ||
@@ -53,13 +63,25 @@ exports.BindingView = Montage.create(Component, { | |||
53 | this._nonVisualComponents = val; | 63 | this._nonVisualComponents = val; |
54 | } | 64 | } |
55 | }, | 65 | }, |
66 | bindingViewCanvas: { | ||
67 | get: function() { | ||
68 | return this._bindingViewCanvas; | ||
69 | }, | ||
70 | set: function(val) { | ||
71 | this._bindingViewCanvas = val; | ||
72 | } | ||
73 | }, | ||
56 | 74 | ||
57 | //Methods | 75 | //Methods |
58 | 76 | ||
77 | |||
78 | |||
59 | //Montage Draw Cycle | 79 | //Montage Draw Cycle |
60 | prepareForDraw: { | 80 | prepareForDraw: { |
61 | value: function() { | 81 | value: function() { |
62 | 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); | ||
63 | } | 85 | } |
64 | }, | 86 | }, |
65 | 87 | ||
@@ -70,8 +92,12 @@ exports.BindingView = Montage.create(Component, { | |||
70 | { | 92 | { |
71 | "title": "Input1", | 93 | "title": "Input1", |
72 | "properties": [ | 94 | "properties": [ |
73 | {"title":"Value"}, | 95 | {"title":"Value", |
74 | {"title": "Width"} | 96 | "bindings": [ |
97 | {"direction": "<-", "boundObject":"Checkbox1", "boundProperty": "Value"} | ||
98 | ] | ||
99 | }, | ||
100 | {"title": "Width", "bindings": []} | ||
75 | ], | 101 | ], |
76 | "x": 20, | 102 | "x": 20, |
77 | "y": 20 | 103 | "y": 20 |
@@ -79,16 +105,47 @@ exports.BindingView = Montage.create(Component, { | |||
79 | { | 105 | { |
80 | "title": "Checkbox1", | 106 | "title": "Checkbox1", |
81 | "properties": [ | 107 | "properties": [ |
82 | {"title":"Group"}, | 108 | {"title":"Group" , "bindings": []}, |
83 | {"title": "Value"} | 109 | {"title":"Value", |
110 | "bindings": [ | ||
111 | {"direction": "->", "boundObject":"Input1", "boundProperty": "Value"} | ||
112 | ] | ||
113 | } | ||
84 | ], | 114 | ], |
85 | "x": 120, | 115 | "x": 120, |
86 | "y": 120 | 116 | "y": 120 |
87 | } | 117 | } |
88 | ]; | 118 | ]; |
119 | this.drawBlueLine(100,100,200,200) | ||
120 | |||
89 | } else { | 121 | } else { |
90 | this.bindables = []; | 122 | this.bindables = []; |
91 | } | 123 | } |
124 | |||
125 | } | ||
126 | }, | ||
127 | |||
128 | drawBlueLine: { | ||
129 | value: function(fromX,fromY,toX,toY) { | ||
130 | this._context.lineWidth = 4; // Set Line Thickness | ||
131 | this._context.strokeStyle = "#00F" | ||
132 | |||
133 | this._context.beginPath(); // Start Drawing Line | ||
134 | this._context.moveTo(fromX, fromY); | ||
135 | this._context.lineTo(toX, toY); | ||
136 | this._context.stroke(); | ||
137 | } | ||
138 | }, | ||
139 | |||
140 | handleMousedown: { | ||
141 | value: function(event) { | ||
142 | |||
143 | } | ||
144 | }, | ||
145 | |||
146 | handleScroll: { | ||
147 | value: function() { | ||
148 | this.needsDraw = true; | ||
92 | } | 149 | } |
93 | }, | 150 | }, |
94 | 151 | ||