diff options
author | hwc487 | 2012-06-29 09:32:42 -0700 |
---|---|---|
committer | hwc487 | 2012-06-29 09:32:42 -0700 |
commit | 1c01f1012576dace5f886456f2207e19be366431 (patch) | |
tree | ecc03194eea98f0544e80d3051a6e6545d0a97b9 | |
parent | 6cbeb36736e5a012fa1688db78d5981c2e61d95b (diff) | |
parent | ecd9e3b3b09695e3e7115c04e75add5a20c5c6fe (diff) | |
download | ninja-1c01f1012576dace5f886456f2207e19be366431.tar.gz |
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into GridFixes
21 files changed, 284 insertions, 131 deletions
diff --git a/js/clipboard/internal-ops/elements-clipboard-agent.js b/js/clipboard/internal-ops/elements-clipboard-agent.js index cd8de46e..1a4bfdba 100644 --- a/js/clipboard/internal-ops/elements-clipboard-agent.js +++ b/js/clipboard/internal-ops/elements-clipboard-agent.js | |||
@@ -232,7 +232,8 @@ var ElementsClipboardAgent = exports.ElementsClipboardAgent = Montage.create(Com | |||
232 | canvas.height = sourceCanvas.height; | 232 | canvas.height = sourceCanvas.height; |
233 | //end - clone copied canvas | 233 | //end - clone copied canvas |
234 | 234 | ||
235 | if (!canvas.getAttribute( "data-RDGE-id" )) canvas.setAttribute( "data-RDGE-id", document.application.njUtils.generateRandom() ); | 235 | //genenerate data-RDGE-id only for shapes |
236 | if (sourceCanvas.elementModel.shapeModel && !canvas.getAttribute( "data-RDGE-id" )) canvas.setAttribute( "data-RDGE-id", document.application.njUtils.generateRandom() ); | ||
236 | 237 | ||
237 | if(sourceCanvas.ownerDocument.defaultView.getComputedStyle(sourceCanvas).getPropertyValue("position") === "absolute"){ | 238 | if(sourceCanvas.ownerDocument.defaultView.getComputedStyle(sourceCanvas).getPropertyValue("position") === "absolute"){ |
238 | styles = canvas.elementModel.data || {}; | 239 | styles = canvas.elementModel.data || {}; |
@@ -275,7 +276,8 @@ var ElementsClipboardAgent = exports.ElementsClipboardAgent = Montage.create(Com | |||
275 | canvas.width = styles.width; | 276 | canvas.width = styles.width; |
276 | canvas.height = styles.height; | 277 | canvas.height = styles.height; |
277 | 278 | ||
278 | if (!canvas.getAttribute( "data-RDGE-id" )) canvas.setAttribute( "data-RDGE-id", document.application.njUtils.generateRandom() ); | 279 | //genenerate data-RDGE-id only for shapes |
280 | if (worldJson && !canvas.getAttribute( "data-RDGE-id" )) canvas.setAttribute( "data-RDGE-id", document.application.njUtils.generateRandom() ); | ||
279 | 281 | ||
280 | this.pastePositioned(canvas, styles, false/*from copy*/); | 282 | this.pastePositioned(canvas, styles, false/*from copy*/); |
281 | 283 | ||
diff --git a/js/components/layout/stage-mode.reel/stage-mode.js b/js/components/layout/stage-mode.reel/stage-mode.js index cb42276b..b772d688 100755 --- a/js/components/layout/stage-mode.reel/stage-mode.js +++ b/js/components/layout/stage-mode.reel/stage-mode.js | |||
@@ -9,17 +9,17 @@ var Montage = require("montage/core/core").Montage, | |||
9 | 9 | ||
10 | exports.StageMode = Montage.create(Component, { | 10 | exports.StageMode = Montage.create(Component, { |
11 | 11 | ||
12 | _livePreview: { | 12 | _chromePreview: { |
13 | value: null | 13 | value: null |
14 | }, | 14 | }, |
15 | 15 | ||
16 | livePreview: { | 16 | chromePreview: { |
17 | get: function() { | 17 | get: function() { |
18 | return this._livePreview; | 18 | return this._chromePreview; |
19 | }, | 19 | }, |
20 | set: function(value) { | 20 | set: function(value) { |
21 | if(value !== this._livePreview) { | 21 | if(value !== this._chromePreview) { |
22 | this._livePreview = value; | 22 | this._chromePreview = value; |
23 | this.needsDraw = true; | 23 | this.needsDraw = true; |
24 | } | 24 | } |
25 | } | 25 | } |
@@ -46,7 +46,7 @@ exports.StageMode = Montage.create(Component, { | |||
46 | 46 | ||
47 | handleClick: { | 47 | handleClick: { |
48 | value: function(event) { | 48 | value: function(event) { |
49 | this.livePreview = !this.livePreview; | 49 | this.chromePreview = !this.chromePreview; |
50 | } | 50 | } |
51 | } | 51 | } |
52 | }); \ No newline at end of file | 52 | }); \ No newline at end of file |
diff --git a/js/controllers/objects-controller.js b/js/controllers/objects-controller.js index 6557c14e..6ca869ba 100644 --- a/js/controllers/objects-controller.js +++ b/js/controllers/objects-controller.js | |||
@@ -27,7 +27,7 @@ var objectsController = exports.ObjectsController = Montage.create(Montage, { | |||
27 | setTimeout(function() { | 27 | setTimeout(function() { |
28 | this.bindToModelObjects(); | 28 | this.bindToModelObjects(); |
29 | }.bind(this), 1000); | 29 | }.bind(this), 1000); |
30 | 30 | this.currentObjectBindings = []; | |
31 | this._currentDocument = doc; | 31 | this._currentDocument = doc; |
32 | }, | 32 | }, |
33 | enumerable : false | 33 | enumerable : false |
@@ -150,9 +150,9 @@ var objectsController = exports.ObjectsController = Montage.create(Montage, { | |||
150 | var properties = []; | 150 | var properties = []; |
151 | 151 | ||
152 | for(var key in object) { | 152 | for(var key in object) { |
153 | if(object.hasOwnProperty(key)) { | 153 | //if(object.hasOwnProperty(key)) { |
154 | properties.push(key); | 154 | properties.push(key); |
155 | } | 155 | //} |
156 | } | 156 | } |
157 | 157 | ||
158 | if(excludeUnderscoreProperties) { | 158 | if(excludeUnderscoreProperties) { |
diff --git a/js/controllers/presets-controller.js b/js/controllers/presets-controller.js index 4c177189..65a56a74 100644 --- a/js/controllers/presets-controller.js +++ b/js/controllers/presets-controller.js | |||
@@ -53,6 +53,8 @@ exports.PresetsController = Montage.create(Component, { | |||
53 | //// TODO: replace this hack when webkit supports transitionStart event (see above) | 53 | //// TODO: replace this hack when webkit supports transitionStart event (see above) |
54 | window.clearTimeout(el.njTimeout); | 54 | window.clearTimeout(el.njTimeout); |
55 | 55 | ||
56 | this._dispatchChange(); | ||
57 | |||
56 | el.classList.remove(this.transitionClass); | 58 | el.classList.remove(this.transitionClass); |
57 | el.removeEventListener("webkitTransitionEnd", this, true); | 59 | el.removeEventListener("webkitTransitionEnd", this, true); |
58 | } | 60 | } |
@@ -107,6 +109,10 @@ exports.PresetsController = Montage.create(Component, { | |||
107 | } | 109 | } |
108 | }, this); | 110 | }, this); |
109 | 111 | ||
112 | if(!useTransition) { | ||
113 | this._dispatchChange(); | ||
114 | } | ||
115 | |||
110 | } | 116 | } |
111 | }, | 117 | }, |
112 | 118 | ||
@@ -126,5 +132,19 @@ exports.PresetsController = Montage.create(Component, { | |||
126 | 132 | ||
127 | return keysString; | 133 | return keysString; |
128 | } | 134 | } |
135 | }, | ||
136 | |||
137 | _dispatchChange : { | ||
138 | value: function(property, value) { | ||
139 | this.application.ninja.stage.updatedStage = true; | ||
140 | NJevent('elementChange', { | ||
141 | type : 'presetChange', | ||
142 | data: { | ||
143 | "prop": property, | ||
144 | "value": value | ||
145 | }, | ||
146 | redraw: null | ||
147 | }); | ||
148 | } | ||
129 | } | 149 | } |
130 | }); \ No newline at end of file | 150 | }); \ No newline at end of file |
diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js index 0f847653..e25ed20c 100755 --- a/js/controllers/styles-controller.js +++ b/js/controllers/styles-controller.js | |||
@@ -213,6 +213,9 @@ var stylesController = exports.StylesController = Montage.create(Component, { | |||
213 | 213 | ||
214 | stylesheet.insertRule(ruleText, index); | 214 | stylesheet.insertRule(ruleText, index); |
215 | 215 | ||
216 | ///// Invalidate cache because rule dominance is affected | ||
217 | this._clearCache(); | ||
218 | |||
216 | this.styleSheetModified(stylesheet); | 219 | this.styleSheetModified(stylesheet); |
217 | 220 | ||
218 | rule = stylesheet.rules[index]; | 221 | rule = stylesheet.rules[index]; |
@@ -775,7 +778,7 @@ var stylesController = exports.StylesController = Montage.create(Component, { | |||
775 | var a = this._getMostSpecificSelectorForElement(element, rule1[this.CONST.SPECIFICITY_KEY]), | 778 | var a = this._getMostSpecificSelectorForElement(element, rule1[this.CONST.SPECIFICITY_KEY]), |
776 | b = this._getMostSpecificSelectorForElement(element, rule2[this.CONST.SPECIFICITY_KEY]), | 779 | b = this._getMostSpecificSelectorForElement(element, rule2[this.CONST.SPECIFICITY_KEY]), |
777 | win = element.ownerDocument.defaultView, | 780 | win = element.ownerDocument.defaultView, |
778 | order; | 781 | order, sheetAIndex, sheetBIndex, ruleAIndex, ruleBIndex; |
779 | 782 | ||
780 | order = this.compareSpecificity(a.specificity, b.specificity); | 783 | order = this.compareSpecificity(a.specificity, b.specificity); |
781 | 784 | ||
@@ -786,9 +789,9 @@ var stylesController = exports.StylesController = Montage.create(Component, { | |||
786 | /// If tied again (same sheet), determine which is further down in the sheet | 789 | /// If tied again (same sheet), determine which is further down in the sheet |
787 | if(sheetAIndex === sheetBIndex) { | 790 | if(sheetAIndex === sheetBIndex) { |
788 | ruleAIndex = this.getRuleIndex(rule1); ruleBIndex = this.getRuleIndex(rule2); | 791 | ruleAIndex = this.getRuleIndex(rule1); ruleBIndex = this.getRuleIndex(rule2); |
789 | return ruleAIndex < ruleBIndex ? 1 : (ruleAIndex > ruleBIndex) ? -1 : 0; | 792 | return ruleAIndex < ruleBIndex ? false : (ruleAIndex > ruleBIndex) ? true : false; |
790 | } else { | 793 | } else { |
791 | return sheetAIndex < sheetBIndex ? 1 : (sheetAIndex > sheetBIndex) ? -1 : 0; | 794 | return sheetAIndex < sheetBIndex ? false : (sheetAIndex > sheetBIndex) ? true : false; |
792 | } | 795 | } |
793 | } | 796 | } |
794 |