diff options
Diffstat (limited to 'js/stage/binding-view.reel/binding-hud.reel/binding-hud.js')
-rwxr-xr-x | js/stage/binding-view.reel/binding-hud.reel/binding-hud.js | 53 |
1 files changed, 49 insertions, 4 deletions
diff --git a/js/stage/binding-view.reel/binding-hud.reel/binding-hud.js b/js/stage/binding-view.reel/binding-hud.reel/binding-hud.js index 029a1a39..14347a32 100755 --- a/js/stage/binding-view.reel/binding-hud.reel/binding-hud.js +++ b/js/stage/binding-view.reel/binding-hud.reel/binding-hud.js | |||
@@ -12,13 +12,30 @@ var Montage = require("montage/core/core").Montage, | |||
12 | Component = require("montage/ui/component").Component; | 12 | Component = require("montage/ui/component").Component; |
13 | 13 | ||
14 | exports.BindingHud = Montage.create(Component, { | 14 | exports.BindingHud = Montage.create(Component, { |
15 | title: { | 15 | _bindingArgs: { |
16 | value: "default" | 16 | value: null |
17 | }, | ||
18 | |||
19 | titleElement: { | ||
20 | value: null | ||
21 | }, | ||
22 | |||
23 | bindingArgs: { | ||
24 | get: function() { | ||
25 | return this._bindingArgs; | ||
26 | }, | ||
27 | set: function(val) { | ||
28 | this._bindingArgs = val; | ||
29 | this.title = this.bindingArgs.sourceObject.identifier; | ||
30 | this.x = this._bindingArgs.sourceObject.element.offsetLeft; | ||
31 | this.y = this._bindingArgs.sourceObject.element.offsetTop; | ||
32 | this.needsDraw = true; | ||
33 | console.log("Binding Args Set", val); | ||
34 | } | ||
17 | }, | 35 | }, |
36 | |||
18 | properties: { | 37 | properties: { |
19 | value: [ | 38 | value: [ |
20 | {"title": "myProperty1"}, | ||
21 | {"title":"myproperty2"} | ||
22 | ] | 39 | ] |
23 | }, | 40 | }, |
24 | 41 | ||
@@ -30,10 +47,38 @@ exports.BindingHud = Montage.create(Component, { | |||
30 | value: 100 | 47 | value: 100 |
31 | }, | 48 | }, |
32 | 49 | ||
50 | _title: { | ||
51 | value: "default" | ||
52 | }, | ||
53 | |||
54 | title: { | ||
55 | get: function() { | ||
56 | return this._title; | ||
57 | }, | ||
58 | set: function(val) { | ||
59 | this._title = val; | ||
60 | } | ||
61 | }, | ||
62 | |||
63 | prepareForDraw: { | ||
64 | value: function() { | ||
65 | var arrProperties = this.application.ninja.objectsController.getEnumerableProperties(this._bindingArgs.sourceObject, true); | ||
66 | arrProperties.forEach(function(obj) { | ||
67 | var objBound = false; | ||
68 | if(this._bindingArgs._boundObjectPropertyPath === obj) { | ||
69 | objBound = true; | ||
70 | } | ||
71 | this.properties.push({"title":obj, "bound": objBound}); | ||
72 | }.bind(this)); | ||
73 | } | ||
74 | }, | ||
75 | |||
33 | draw: { | 76 | draw: { |
34 | value: function() { | 77 | value: function() { |
78 | this.titleElement.innerHTML = this.title; | ||
35 | this.element.style.top = this.y + "px"; | 79 | this.element.style.top = this.y + "px"; |
36 | this.element.style.left = this.x + "px"; | 80 | this.element.style.left = this.x + "px"; |
81 | console.log("hud",this); | ||
37 | } | 82 | } |
38 | } | 83 | } |
39 | }); \ No newline at end of file | 84 | }); \ No newline at end of file |