diff options
Diffstat (limited to 'js/components/layout/stage-mode.reel/stage-mode.js')
-rw-r--r-- | js/components/layout/stage-mode.reel/stage-mode.js | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/js/components/layout/stage-mode.reel/stage-mode.js b/js/components/layout/stage-mode.reel/stage-mode.js new file mode 100644 index 00000000..cb42276b --- /dev/null +++ b/js/components/layout/stage-mode.reel/stage-mode.js | |||
@@ -0,0 +1,52 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
5 | </copyright> */ | ||
6 | |||
7 | var Montage = require("montage/core/core").Montage, | ||
8 | Component = require("montage/ui/component").Component; | ||
9 | |||
10 | exports.StageMode = Montage.create(Component, { | ||
11 | |||
12 | _livePreview: { | ||
13 | value: null | ||
14 | }, | ||
15 | |||
16 | livePreview: { | ||
17 | get: function() { | ||
18 | return this._livePreview; | ||
19 | }, | ||
20 | set: function(value) { | ||
21 | if(value !== this._livePreview) { | ||
22 | this._livePreview = value; | ||
23 | this.needsDraw = true; | ||
24 | } | ||
25 | } | ||
26 | }, | ||
27 | |||
28 | prepareForDraw: { | ||
29 | value: function() { | ||
30 | this.element.addEventListener("click", this, false); | ||
31 | } | ||
32 | }, | ||
33 | |||
34 | draw: { | ||
35 | value: function() { | ||
36 | if(this._livePreview) { | ||
37 | this.element.classList.remove("editMode"); | ||
38 | this.element.classList.add("liveMode"); | ||
39 | |||
40 | } else { | ||
41 | this.element.classList.remove("liveMode"); | ||
42 | this.element.classList.add("editMode"); | ||
43 | } | ||
44 | } | ||
45 | }, | ||
46 | |||
47 | handleClick: { | ||
48 | value: function(event) { | ||
49 | this.livePreview = !this.livePreview; | ||
50 | } | ||
51 | } | ||
52 | }); \ No newline at end of file | ||