diff options
author | Armen Kesablyan | 2012-06-15 16:28:58 -0700 |
---|---|---|
committer | Armen Kesablyan | 2012-06-15 16:28:58 -0700 |
commit | 2fcb74d0b204ce2999b70fa9a46fc58a558344d8 (patch) | |
tree | 951a3814b8b9303163271d76c53d213ac0487481 /js/stage/objects-tray.reel/objects-tray.js | |
parent | d7456b5d8f5231b7cb6df31081474cfcd5900a84 (diff) | |
parent | 057afac9e7b99a3c4339003cca19ec3962d5fa13 (diff) | |
download | ninja-2fcb74d0b204ce2999b70fa9a46fc58a558344d8.tar.gz |
Merge pull request #15 from ericguzman/binding
Binding
Diffstat (limited to 'js/stage/objects-tray.reel/objects-tray.js')
-rw-r--r-- | js/stage/objects-tray.reel/objects-tray.js | 44 |
1 files changed, 41 insertions, 3 deletions
diff --git a/js/stage/objects-tray.reel/objects-tray.js b/js/stage/objects-tray.reel/objects-tray.js index ee1ecd06..c046a3bb 100644 --- a/js/stage/objects-tray.reel/objects-tray.js +++ b/js/stage/objects-tray.reel/objects-tray.js | |||
@@ -12,6 +12,25 @@ 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.ObjectsTray = Montage.create(Component, { | 14 | exports.ObjectsTray = Montage.create(Component, { |
15 | hideClass : { value: 'hide-objects-tray'}, | ||
16 | _workspaceMode : { value: null }, | ||
17 | workspaceMode : { | ||
18 | get : function() { return this._workspaceMode; }, | ||
19 | set : function(value) { | ||
20 | if(value === this._workspaceMode) { return; } | ||
21 | |||
22 | var toHide = (value !== 'binding'); | ||
23 | |||
24 | setTimeout(function() { | ||
25 | this.hide = toHide; | ||
26 | }.bind(this), 200); | ||
27 | |||
28 | this._workspaceMode = value; | ||
29 | |||
30 | this.needsDraw = true; | ||
31 | } | ||
32 | }, | ||
33 | |||
15 | _objects: { value: null }, | 34 | _objects: { value: null }, |
16 | objects: { | 35 | objects: { |
17 | get: function() { | 36 | get: function() { |
@@ -23,6 +42,18 @@ exports.ObjectsTray = Montage.create(Component, { | |||
23 | } | 42 | } |
24 | }, | 43 | }, |
25 | 44 | ||
45 | _hide : { value: null }, | ||
46 | hide : { | ||
47 | get : function() { return this._hide; }, | ||
48 | set : function(value) { | ||
49 | if(value === this._hide) { return; } | ||
50 | |||
51 | this._hide = value; | ||
52 | |||
53 | this.needsDraw = true; | ||
54 | } | ||
55 | }, | ||
56 | |||
26 | 57 | ||
27 | templateDidLoad: { | 58 | templateDidLoad: { |
28 | value: function() { | 59 | value: function() { |
@@ -33,6 +64,12 @@ exports.ObjectsTray = Montage.create(Component, { | |||
33 | prepareForDraw : { | 64 | prepareForDraw : { |
34 | value: function() { | 65 | value: function() { |
35 | 66 | ||
67 | Object.defineBinding(this, 'workspaceMode', { | ||
68 | "boundObject": this.application.ninja, | ||
69 | "boundObjectPropertyPath": "workspaceMode", | ||
70 | "oneway": true | ||
71 | }); | ||
72 | |||
36 | Object.defineBinding(this, 'objects', { | 73 | Object.defineBinding(this, 'objects', { |
37 | "boundObject": this.application.ninja.objectsController, | 74 | "boundObject": this.application.ninja.objectsController, |
38 | "boundObjectPropertyPath": "objects", | 75 | "boundObjectPropertyPath": "objects", |
@@ -43,9 +80,10 @@ exports.ObjectsTray = Montage.create(Component, { | |||
43 | }, | 80 | }, |
44 | draw : { | 81 | draw : { |
45 | value: function() { | 82 | value: function() { |
46 | console.log("objects panel draw"); | 83 | if(this.hide) { |
47 | if(this.objects) { | 84 | this.element.classList.add(this.hideClass); |
48 | 85 | } else { | |
86 | this.element.classList.remove(this.hideClass); | ||
49 | } | 87 | } |
50 | } | 88 | } |
51 | } | 89 | } |