diff options
author | Eric Guzman | 2012-04-05 17:26:03 -0700 |
---|---|---|
committer | Eric Guzman | 2012-04-05 17:26:03 -0700 |
commit | 72061f2cf3858f48a90f8cb21c5e7d766cb9552b (patch) | |
tree | 537fb2f27bf621efab06ab3b3609c5545cd445a1 /js/panels/css-panel/style-sheet.reel/style-sheet.js | |
parent | 313e0336cc72a1dc773bfa0e3d41b2993339f9af (diff) | |
download | ninja-72061f2cf3858f48a90f8cb21c5e7d766cb9552b.tar.gz |
Style Sheets - Style update for edit view
Diffstat (limited to 'js/panels/css-panel/style-sheet.reel/style-sheet.js')
-rw-r--r-- | js/panels/css-panel/style-sheet.reel/style-sheet.js | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/js/panels/css-panel/style-sheet.reel/style-sheet.js b/js/panels/css-panel/style-sheet.reel/style-sheet.js index 2396d625..4f9ad21f 100644 --- a/js/panels/css-panel/style-sheet.reel/style-sheet.js +++ b/js/panels/css-panel/style-sheet.reel/style-sheet.js | |||
@@ -8,36 +8,42 @@ var Montage = require("montage/core/core").Montage, | |||
8 | Component = require("montage/ui/component").Component; | 8 | Component = require("montage/ui/component").Component; |
9 | 9 | ||
10 | exports.StyleSheet = Montage.create(Component, { | 10 | exports.StyleSheet = Montage.create(Component, { |
11 | deserializedFromTemplate : { | 11 | _translateDistance: { |
12 | value: function() { | 12 | value: null |
13 | console.log("style sheet view - deserialized"); | ||
14 | } | ||
15 | }, | 13 | }, |
14 | |||
16 | willDraw : { | 15 | willDraw : { |
17 | value: function() { | 16 | value: function() { |
18 | console.log("style sheet view - will draw"); | 17 | console.log("style sheet view - will draw"); |
19 | 18 | ||
20 | if(this.editing) { | 19 | if(this.editing) { |
21 | document.body.addEventListener('click', this, false); | 20 | document.body.addEventListener('mousedown', this, false); |
21 | this._translateDistance = this._element.offsetWidth - this.editButton._element.offsetWidth; | ||
22 | |||
22 | } else { | 23 | } else { |
23 | document.body.removeEventListener('click', this, false); | 24 | document.body.removeEventListener('mousedown', this, false); |
24 | } | 25 | } |
25 | } | 26 | } |
26 | }, | 27 | }, |
27 | draw : { | 28 | draw : { |
28 | value: function() { | 29 | value: function() { |
30 | var transStr = '-webkit-transform'; | ||
29 | console.log("styles sheet view - draw"); | 31 | console.log("styles sheet view - draw"); |
30 | 32 | ||
31 | this.mediaInput.value = this._source.media.mediaText; | 33 | this.mediaInput.value = this._source.media.mediaText; |
32 | 34 | ||
33 | if(this.editing) { | 35 | if(this.editing) { |
34 | this.editView.classList.add('expanded'); | 36 | this.editView.classList.add('expanded'); |
37 | this.editView.style.setProperty(transStr, 'translate3d(-'+ this._translateDistance + 'px,0,0)'); | ||
35 | } else { | 38 | } else { |
36 | this.editView.classList.remove('expanded'); | 39 | this.editView.classList.remove('expanded'); |
40 | this.editView.style.removeProperty(transStr); | ||
37 | } | 41 | } |
38 | } | 42 | } |
39 | }, | 43 | }, |
40 | 44 | ||
45 | |||
46 | |||
41 | handleEditButtonAction: { | 47 | handleEditButtonAction: { |
42 | value: function(e) { | 48 | value: function(e) { |
43 | console.log('handle edit button action'); | 49 | console.log('handle edit button action'); |
@@ -57,10 +63,10 @@ exports.StyleSheet = Montage.create(Component, { | |||
57 | } | 63 | } |
58 | }, | 64 | }, |
59 | 65 | ||
60 | handleClick : { | 66 | handleMousedown : { |
61 | value: function(e) { | 67 | value: function(e) { |
62 | console.log("handle click"); | 68 | console.log("handle mousedown"); |
63 | if(e.target !== this.editView) { | 69 | if(e.target !== this.editView && e.target !== this.editButton) { |
64 | this.editing = false; | 70 | this.editing = false; |
65 | } | 71 | } |
66 | } | 72 | } |
@@ -89,7 +95,7 @@ exports.StyleSheet = Montage.create(Component, { | |||
89 | return this._source; | 95 | return this._source; |
90 | }, | 96 | }, |
91 | set: function(sheet) { | 97 | set: function(sheet) { |
92 | console.log('sheet being set'); | 98 | console.log('sheet being set: ', sheet.ownerNode); |
93 | if(sheet.href) { | 99 | if(sheet.href) { |
94 | this.name = sheet.href.substring(sheet.href.lastIndexOf('/')+1); | 100 | this.name = sheet.href.substring(sheet.href.lastIndexOf('/')+1); |
95 | } else { | 101 | } else { |