From affafafc4db16e5f918c74dfc919025d4c563cc6 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 31 Jan 2012 17:30:53 -0800 Subject: Updated color code to handle shapes. Signed-off-by: Nivesh Rajbhandari --- js/controllers/color-controller.js | 97 ++++----------------------- js/controllers/elements/element-controller.js | 43 +++++++++++- js/controllers/elements/shapes-controller.js | 2 +- 3 files changed, 55 insertions(+), 87 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/color-controller.js b/js/controllers/color-controller.js index 87180873..925b525d 100644 --- a/js/controllers/color-controller.js +++ b/js/controllers/color-controller.js @@ -175,76 +175,21 @@ exports.ColorController = Montage.create(Component, { }, //////////////////////////////////////////////////////////////////// // - setBackground: { + setColor: { enumerable: true, - value: function (type, background, selection) { - //TODO: Remove hack - var elements, i, hack = [], hackNone = []; + value: function (mode, color, isFill, selection) { + var elements; //The selection is optional, if none, it asks for the currently selected elements if (selection) { elements = selection; } else { elements = this.application.ninja.selectedElements; } - // - for (i=0; elements[i]; i++) { - hack[i] = background; - hackNone[i] = 'none'; - } - // - if (elements && elements.length > 0) { - switch (type) { - case 'image': - ElementsMediator.setProperty(elements, "background-image", hack, {"background-image": background}, "Change", "color-controller"); - ElementsMediator.setProperty(elements, "background-color", hackNone, {"background-color": 'none'}, "Change", "color-controller"); - break; - case 'color': - //TODO: Add logic to handle setting color when image (like gradients) is applied - //TODO: Handle applying to multiple items, currently, we need to create a dummy array of the same value - ElementsMediator.setProperty(elements, "background-image", hackNone, {"background-image": 'none'}, "Change", "color-controller"); - ElementsMediator.setProperty(elements, "background-color", hack, {"background-color": background}, "Change", "color-controller"); - break; - case 'background': - break; - } - // - //console.log(this.getColorObjFromCss('#333')); - } - } - }, - //////////////////////////////////////////////////////////////////// - // - setBorder: { - enumerable: true, - value: function (type, border, selection) { - // - var elements, i, hack = [], hackNone = []; - //The selection is optional, if none, it asks for the currently selected elements - if (selection) { - elements = selection; - } else { - elements = this.application.ninja.selectedElements; - } - // - for (i=0; elements[i]; i++) { - hack[i] = border; - hackNone[i] = 'none'; - } - // - if (elements && elements.length > 0) { - switch (type) { - case 'image': - //TODO: Figure out why color must be removed, might be related to the CSS - ElementsMediator.setProperty(elements, "border-color", hackNone, {"border-color": 'none'}, "Change", "color-controller"); - ElementsMediator.setProperty(elements, "border-image", hack, {"border-image": border}, "Change", "color-controller"); - break; - case 'color': - ElementsMediator.setProperty(elements, "border-image", hackNone, {"border-image": 'none'}, "Change", "color-controller"); - ElementsMediator.setProperty(elements, "border-color", hack, {"border-color": border}, "Change", "color-controller"); - break; - case 'border': - break; - } + if (elements && elements.length) { + var colorInfo = { mode:mode, + color:color + }; + ElementsMediator.setColor(elements, colorInfo, isFill, "Change", "color-controller"); } } }, @@ -264,8 +209,10 @@ exports.ColorController = Montage.create(Component, { color = {value: null, css: 'none'}; } else if (panelMode === 'rgb' && e._event.rgba && mode !== 'gradient') { color = e._event.rgba; + color.webGlColor = e._event.webGlColor; } else if (panelMode === 'hsl' && e._event.hsla && mode !== 'gradient') { color = e._event.hsla; + color.webGlColor = e._event.webGlColor; } else if (mode !== 'gradient'){ color = {value: e._event.hex, css: '#'+e._event.hex}; } else if (mode === 'gradient'){ @@ -280,32 +227,14 @@ exports.ColorController = Montage.create(Component, { // if(e._event.wasSetByCode) return; // - if (mode === 'nocolor') { - //TODO: Add a check instead of setting properties - this.setBackground('image', color.css, false); - this.setBackground('color', color.css, false); - this.setBackground('background', color.css, false); - } else if (mode === 'gradient') { - this.setBackground('image', color.css, false); - } else { - this.setBackground('color', color.css, false); - } + this.setColor(mode, color, true); } else if (input === 'stroke') { // this.stroke = color; // if(e._event.wasSetByCode) return; - // - if (mode === 'nocolor') { - //TODO: Add a check instead of setting properties - this.setBorder('image', color.css, false); - this.setBorder('color', color.css, false); - this.setBorder('border', color.css, false); - } else if (mode === 'gradient') { - this.setBorder('image', color.css, false); - } else { - this.setBorder('color', color.css, false); - } + + this.setColor(mode, color, false); } //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index f254220c..8a0735f7 100644 --- a/js/controllers/elements/element-controller.js +++ b/js/controllers/elements/element-controller.js @@ -83,13 +83,52 @@ var ElementController = exports.ElementController = Montage.create(NJComponent, setColor: { value: function(el, color, isFill) { + var mode = color.mode; if(isFill) { - this.application.ninja.stylesController.setElementStyle(el, "background-color", color.color.css); + if(mode) + { + switch (mode) { + case 'nocolor': + this.setProperty(el, "background-image", "none"); + this.setProperty(el, "background-color", "none"); + break; + case 'gradient': + this.setProperty(el, "background-image", color.color.css); + this.setProperty(el, "background-color", "none"); + break; + default: + this.setProperty(el, "background-image", "none"); + this.setProperty(el, "background-color", color.color.css); + } + } + else + { + this.application.ninja.stylesController.setElementStyle(el, "background-color", color.color.css); + } } else { - this.application.ninja.stylesController.setElementStyle(el, "border-color", color.color.css); + if(mode) + { + switch (mode) { + case 'nocolor': + this.setProperty(el, "border-image", "none"); + this.setProperty(el, "border-color", "none"); + break; + case 'gradient': + this.setProperty(el, "border-image", color.color.css); + this.setProperty(el, "border-color", "none"); + break; + default: + this.setProperty(el, "border-image", "none"); + this.setProperty(el, "border-color", color.color.css); + } + } + else + { + this.application.ninja.stylesController.setElementStyle(el, "border-color", color.color.css); + } } } }, diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index d34644a7..92353f28 100644 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js @@ -168,7 +168,7 @@ exports.ShapesController = Montage.create(CanvasController, { setColor: { value: function(el, color, isFill) { // TODO - Format color for webGL before setting - color = color.webGlColor; + color = color.webGlColor || color.color.webGlColor; if(isFill) { el.elementModel.shapeModel.GLGeomObj.setFillColor(color); -- cgit v1.2.3 From 830b011d94d728882286d72e129f7405134957c7 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Wed, 1 Feb 2012 17:05:07 -0800 Subject: Updated color code in the PI to go through element mediator. Signed-off-by: Nivesh Rajbhandari --- js/controllers/color-controller.js | 3 ++ js/controllers/elements/element-controller.js | 53 +++++++++++++++++++++++++-- js/controllers/elements/shapes-controller.js | 32 ++++++++++++---- 3 files changed, 76 insertions(+), 12 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/color-controller.js b/js/controllers/color-controller.js index 925b525d..e3b15f1c 100644 --- a/js/controllers/color-controller.js +++ b/js/controllers/color-controller.js @@ -218,6 +218,9 @@ exports.ColorController = Montage.create(Component, { } else if (mode === 'gradient'){ color = e._event.value.value; } + color.mode = panelMode; + color.wasSetByCode = true; + color.type = "change"; //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index 8a0735f7..892ac2f2 100644 --- a/js/controllers/elements/element-controller.js +++ b/js/controllers/elements/element-controller.js @@ -69,15 +69,56 @@ var ElementController = exports.ElementController = Montage.create(NJComponent, // Routines to get/set color properties getColor: { value: function(el, isFill) { + var colorObj, + color, + image; + + // Return cached value if one exists if(isFill) { - return this.application.ninja.stylesController.getElementStyle(el, "background-color"); + if(el.elementModel.fill) + { + return el.elementModel.fill; + } +// return this.application.ninja.stylesController.getElementStyle(el, "background-color"); + //TODO: Once logic for color and gradient is established, this needs to be revised + color = this.getProperty(el, "background-color"); + image = this.getProperty(el, "background-image"); } else { // TODO - Need to figure out which border side user wants - return this.application.ninja.stylesController.getElementStyle(el, "border-color"); + if(el.elementModel.stroke) + { + return el.elementModel.stroke; + } + // TODO - Need to figure out which border side user wants +// return this.application.ninja.stylesController.getElementStyle(el, "border-color"); + color = this.getProperty(el, "border-color"); + image = this.getProperty(el, "border-image"); } + + if(color || image) { + if (image && image !== 'none' && image.indexOf('-webkit') >= 0) { + //Gradient + colorObj = this.application.ninja.colorController.getColorObjFromCss(image); + } else { + //Solid + colorObj = this.application.ninja.colorController.getColorObjFromCss(color); + } + } + + // Update cache + if(isFill) + { + el.elementModel.fill = colorObj; + } + else + { + el.elementModel.stroke = colorObj; + } + + return colorObj; } }, @@ -92,7 +133,8 @@ var ElementController = exports.ElementController = Montage.create(NJComponent, case 'nocolor': this.setProperty(el, "background-image", "none"); this.setProperty(el, "background-color", "none"); - break; + el.elementModel.fill = null; + return; case 'gradient': this.setProperty(el, "background-image", color.color.css); this.setProperty(el, "background-color", "none"); @@ -106,6 +148,7 @@ var ElementController = exports.ElementController = Montage.create(NJComponent, { this.application.ninja.stylesController.setElementStyle(el, "background-color", color.color.css); } + el.elementModel.fill = color; } else { @@ -115,7 +158,8 @@ var ElementController = exports.ElementController = Montage.create(NJComponent, case 'nocolor': this.setProperty(el, "border-image", "none"); this.setProperty(el, "border-color", "none"); - break; + el.elementModel.stroke = null; + return; case 'gradient': this.setProperty(el, "border-image", color.color.css); this.setProperty(el, "border-color", "none"); @@ -129,6 +173,7 @@ var ElementController = exports.ElementController = Montage.create(NJComponent, { this.application.ninja.stylesController.setElementStyle(el, "border-color", color.color.css); } + el.elementModel.stroke = color; } } }, diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index 92353f28..1717db94 100644 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js @@ -48,6 +48,8 @@ exports.ShapesController = Montage.create(CanvasController, { switch(p) { case "strokeSize": case "innerRadius": + case "border": + case "background": return this.getShapeProperty(el, p); default: return CanvasController.getProperty(el, p); @@ -154,30 +156,44 @@ exports.ShapesController = Montage.create(CanvasController, { // Routines to get/set color properties getColor: { value: function(el, isFill) { + var color, + css; if(isFill) { - return this.getShapeProperty(el, "fill"); + if(el.elementModel.shapeModel.background) + { + return el.elementModel.shapeModel.background; + } + color = this.getShapeProperty(el, "fill"); } else { - return this.getShapeProperty(el, "stroke"); + if(el.elementModel.shapeModel.border) + { + return el.elementModel.shapeModel.border; + } + color = this.getShapeProperty(el, "stroke"); } + + css = this.application.ninja.colorController.colorModel.webGlToCss(color); + return this.application.ninja.colorController.getColorObjFromCss(css); } }, setColor: { value: function(el, color, isFill) { - // TODO - Format color for webGL before setting - color = color.webGlColor || color.color.webGlColor; + var webGl = color.webGlColor || color.color.webGlColor; if(isFill) { - el.elementModel.shapeModel.GLGeomObj.setFillColor(color); - this.setShapeProperty(el, "fill", color); + el.elementModel.shapeModel.GLGeomObj.setFillColor(webGl); + this.setShapeProperty(el, "fill", webGl); + this.setShapeProperty(el, "background", color); } else { - el.elementModel.shapeModel.GLGeomObj.setStrokeColor(color); - this.setShapeProperty(el, "stroke", color); + el.elementModel.shapeModel.GLGeomObj.setStrokeColor(webGl); + this.setShapeProperty(el, "stroke", webGl); + this.setShapeProperty(el, "border", color); } el.elementModel.shapeModel.GLWorld.render(); } -- cgit v1.2.3 From 01efeff045e7196bab37fc60f7030969ad650d6c Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Wed, 1 Feb 2012 21:14:17 -0800 Subject: Removed border special-casing from PI since the mediator now handles this generically. Updated mediator's set stroke routine to use the setColor routine. Signed-off-by: Nivesh Rajbhandari --- js/controllers/elements/element-controller.js | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index 892ac2f2..9b13e703 100644 --- a/js/controllers/elements/element-controller.js +++ b/js/controllers/elements/element-controller.js @@ -144,10 +144,6 @@ var ElementController = exports.ElementController = Montage.create(NJComponent, this.setProperty(el, "background-color", color.color.css); } } - else - { - this.application.ninja.stylesController.setElementStyle(el, "background-color", color.color.css); - } el.elementModel.fill = color; } else @@ -169,10 +165,6 @@ var ElementController = exports.ElementController = Montage.create(NJComponent, this.setProperty(el, "border-color", color.color.css); } } - else - { - this.application.ninja.stylesController.setElementStyle(el, "border-color", color.color.css); - } el.elementModel.stroke = color; } } @@ -187,8 +179,9 @@ var ElementController = exports.ElementController = Montage.create(NJComponent, setStroke: { value: function(el, stroke) { - var border = stroke.borderWidth + stroke.borderUnits + " " + stroke.borderStyle + " " + stroke.color.color.css; - this.application.ninja.stylesController.setElementStyle(el, "border", border); + this.application.ninja.stylesController.setElementStyle(el, "border-width", stroke.borderWidth + stroke.borderUnits); + this.application.ninja.stylesController.setElementStyle(el, "border-style", stroke.borderStyle); + this.setColor(el, stroke.color, false); } }, -- cgit v1.2.3 From cbcc9dcadaf62b3b0aef380f022bf6c365785627 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Thu, 2 Feb 2012 10:36:05 -0800 Subject: Tree Controller - Initial add --- js/controllers/tree-controller.js | 219 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 219 insertions(+) create mode 100644 js/controllers/tree-controller.js (limited to 'js/controllers') diff --git a/js/controllers/tree-controller.js b/js/controllers/tree-controller.js new file mode 100644 index 00000000..45e4c4ba --- /dev/null +++ b/js/controllers/tree-controller.js @@ -0,0 +1,219 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ +/** + @module montage/ui/controller/tree-controller + @requires montage/core/core + @requires montage/ui/controller/object-controller + @requires montage/core/event/mutable-event + */ +var Montage = require("montage").Montage, + ObjectController = require("montage/ui/controller/object-controller").ObjectController, + ArrayController = require("montage/ui/controller/array-controller").ArrayController, + MutableEvent = require("montage/core/event/mutable-event").MutableEvent; +/** + TODO: Write description like the array controllers: The ArrayController helps with organizing a hierarchical + collection of objects, and managing user selection within that collection. + You can assign a TreeController instance as the contentProvider property for a TreeView object. + @class module:montage/ui/controller/tree-controller.TreeController + @classdesc + @extends module:montage/ui/controller/object-controller.ObjectController +*/ +var TreeController = exports.TreeController = Montage.create(ObjectController, /** @lends module:montage/ui/controller/tree-controller.TreeController# */ { + + rootKey : { + value: null + }, + + branchKey : { + value: 'children' + }, + + _root : { + value : null + }, + root : { + get: function() { + return this._root; + }, + set: function(value) { + this._root = value; + + this.initArrayControllers(); + } + }, + + rootController: { + value: null + }, + + initArrayControllers : { + value: function() { + var self = this; + + ///// Declare function to initialize controller for each node + ///// that is a branch + + function initController(array, depth) { + var controller = Montage.create(ArrayController, { + content : { value: array }, + delegate : { value: self }, + isSelectionEnabled : { value: true }}); + + if(depth === 0) { + self.rootController = controller; + } + + self.branchControllers.push({ + depth : depth, + controller : controller + + }); + } + + ///// Recursive function that finds all branch nodes and initializes + ///// an array controller + + function walk(node, init, depth) { + var children = node[self.branchKey]; + + if(children) { + //init(children, depth); + + children.forEach(function(child) { + walk(child, init, ++depth); + }); + + node['treeNodeType'] = 'branch'; + } else { + node['treeNodeType'] = 'leaf'; + } + } + + walk(this._root, initController, 0); + + } + }, + + /** + @private + */ + _selectedIndexes: { + value: null, + enumerable: false + }, + + /** + Description TODO + @type {Function} + @default null + */ + selectedIndexes: { + get: function() { + + }, + set: function(value) { + + } + }, + + lazyLoad : { + value: false + }, + + branchControllers: { + value: [] + }, + + addBranchController : { + value: function(controller) { + if(this.delegate) { + controller.delegate = this.delegate; + } + + this.branchControllers.push(controller); + } + }, + + /** + @private + */ + _content: { + enumerable: false, + value: null + }, + /** + The content managed by the TreeController. + @type {Function} + @default {String} null + */ + content: { + get: function() { + return this._content; + }, + set: function(value) { + if (this._content === value) { + return; + } + + this._content = value; + + //TODO for right now assume that any content change invalidates the selection completely; we'll need to address this of course + this.selectedObjects = null; + + if (this.rootKey) { + if (value[this.rootKey]) { + this.root = value[this.rootKey]; + } else { + console.log('No root key found in content data'); + } + } else { + this.root = value; + } + + + } + }, + + addObjects : { + value: function() { + + var objects = Array.prototype.slice.call(arguments), + i, + objectCount = objects.length, + selectedContentIndexes, firstIndex; + + for (i = 0; i < objectCount; i++) { + this.content.push(objects[i]); + } + + if (this.selectObjectsOnAddition) { + selectedContentIndexes = []; + firstIndex = this.content.length-objectCount; + for (i = 0; i < objectCount; i++) { + selectedContentIndexes[i] = firstIndex++; + } + this.selectedContentIndexes = selectedContentIndexes; + this.selectedObjects = objects; + } + + if (this.clearFilterFunctionOnAddition) { + this.filterFunction = null; + } + + if (this.automaticallyOrganizeObjects) { + this.organizeObjects(); + } + + } + }, + + insertChildBefore : { value : function() {} }, + + insertChildAfter : { value : function() {} } + + + +}); -- cgit v1.2.3 From 5c5f4eabdc4befe3fb6da44bc8ad5fef20642f21 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Thu, 2 Feb 2012 14:58:21 -0800 Subject: Tree Controller - Clean out unused code --- js/controllers/tree-controller.js | 48 ++++++--------------------------------- 1 file changed, 7 insertions(+), 41 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/tree-controller.js b/js/controllers/tree-controller.js index 45e4c4ba..2b2e910c 100644 --- a/js/controllers/tree-controller.js +++ b/js/controllers/tree-controller.js @@ -53,37 +53,15 @@ var TreeController = exports.TreeController = Montage.create(ObjectController, / value: function() { var self = this; - ///// Declare function to initialize controller for each node - ///// that is a branch - - function initController(array, depth) { - var controller = Montage.create(ArrayController, { - content : { value: array }, - delegate : { value: self }, - isSelectionEnabled : { value: true }}); - - if(depth === 0) { - self.rootController = controller; - } - - self.branchControllers.push({ - depth : depth, - controller : controller - - }); - } - ///// Recursive function that finds all branch nodes and initializes - ///// an array controller + ///// sets the tree node type to "branch" or "leaf" function walk(node, init, depth) { - var children = node[self.branchKey]; - - if(children) { - //init(children, depth); + var branch = node[self.branchKey]; - children.forEach(function(child) { - walk(child, init, ++depth); + if(branch) { + branch.forEach(function(node) { + walk(node, init, ++depth); }); node['treeNodeType'] = 'branch'; @@ -92,7 +70,7 @@ var TreeController = exports.TreeController = Montage.create(ObjectController, / } } - walk(this._root, initController, 0); + walk(this._root, 0); } }, @@ -119,10 +97,6 @@ var TreeController = exports.TreeController = Montage.create(ObjectController, / } }, - lazyLoad : { - value: false - }, - branchControllers: { value: [] }, @@ -160,7 +134,6 @@ var TreeController = exports.TreeController = Montage.create(ObjectController, / this._content = value; - //TODO for right now assume that any content change invalidates the selection completely; we'll need to address this of course this.selectedObjects = null; if (this.rootKey) { @@ -173,7 +146,6 @@ var TreeController = exports.TreeController = Montage.create(ObjectController, / this.root = value; } - } }, @@ -208,12 +180,6 @@ var TreeController = exports.TreeController = Montage.create(ObjectController, / } } - }, - - insertChildBefore : { value : function() {} }, - - insertChildAfter : { value : function() {} } - - + } }); -- cgit v1.2.3 From 486d9a31a85dd833a1c798049a00403756703034 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Mon, 6 Feb 2012 11:35:49 -0800 Subject: Support use WebGL checkbox in the PI. Signed-off-by: Nivesh Rajbhandari --- js/controllers/elements/shapes-controller.js | 1 + 1 file changed, 1 insertion(+) (limited to 'js/controllers') diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index 5efbccd0..48072309 100644 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js @@ -76,6 +76,7 @@ exports.ShapesController = Montage.create(CanvasController, { case "fillMaterial": case "border": case "background": + case "useWebGl": return this.getShapeProperty(el, p); default: return CanvasController.getProperty(el, p); -- cgit v1.2.3 From 9d1c9d10436c0e0b38115b0025b40b1e838b1350 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Wed, 1 Feb 2012 16:50:59 -0800 Subject: Styles Controller - First stab at group styling Split "createOverrideRule" into two methods --> now has createOverrideSelector. Also took first stab at creating a group style. --- js/controllers/styles-controller.js | 102 ++++++++++++++++++++++++++++++------ 1 file changed, 86 insertions(+), 16 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js index afd298c9..8fc90e7d 100644 --- a/js/controllers/styles-controller.js +++ b/js/controllers/styles-controller.js @@ -171,7 +171,7 @@ var stylesController = exports.StylesController = Montage.create(Component, { if(argType === 'string') { ruleText += '{' + declaration + '}'; } else if(argType === 'object') { - ruleText += '{' + nj.cssFromObject(declaration) + '}'; + ruleText += '{' + this.cssFromObject(declaration) + '}'; } stylesheet.insertRule(ruleText, index); @@ -199,25 +199,42 @@ var stylesController = exports.StylesController = Montage.create(Component, { ///// Locally-scoped function to de-clutter variable declarations function getSelector(el, rule) { - return this._getMostSpecificSelectorForElement(el, rule[this.CONST.SPECIFICITY_KEY]).selector; } var selectorToOverride = getSelector.bind(this)(element, ruleToOverride), - tokens = selectorToOverride.split(/\s/), - newClass = this.generateClassName(element.nodeName), - lastToken, pseudoSplit, base, pseudo, newToken, newSelector, rule; + overrideData, rule; + + ///// Get the overriding selector and className + overrideData = this.createOverrideSelector(selectorToOverride, element.nodeName); + + ///// Create new rule with selector and insert it after the rule we're overriding + rule = this.addRule(overrideData.selector + ' { }', this.getRuleIndex(ruleToOverride)+1); + + return { + className : overrideData.className, + rule : rule + }; + + } + }, + + createOverrideSelector : { + value: function(selectorToOverride, classPrefix, className) { + var tokens = selectorToOverride.split(/\s/), + newClass = className || this.generateClassName(classPrefix, true), + lastToken, pseudoSplit, base, pseudo, newToken, newSelector; ///// Creating an overriding selector by replacing the last ///// class, attribute or type selector in passed-in rule's selector - + ///// Grab the last token lastToken = tokens[tokens.length-1]; pseudoSplit = lastToken.split(':'); ///// The last token can have pseudo class. Let's preserve it base = pseudoSplit[0]; pseudo = (pseudoSplit[1]) ? ':'+pseudoSplit[1] : ''; - + ///// Now, all we want to do is replace the last token with a ///// generated class name, except if the last token is an ID selector, ///// in which case we append the generated class name to the ID selector @@ -231,18 +248,15 @@ var stylesController = exports.StylesController = Montage.create(Component, { ///// Append the generated class newToken += '.' + newClass + pseudo; } - + ///// Now we can build the new selector by replacing the last token tokens[tokens.length-1] = newToken; newSelector = tokens.join(' '); - - rule = this.addRule(newSelector + ' { }', this.getRuleIndex(ruleToOverride)+1); - + return { className : newClass, - rule : rule + selector : newSelector }; - } }, @@ -370,7 +384,7 @@ var stylesController = exports.StylesController = Montage.create(Component, { ///// from which an overriding rule can be created. getDominantRuleForGroup : { - value : function(elements, property) { + value : function(elements, property, forceOverride) { var selectorsToOverride = [], commonRules, dominantRules, useImportant; @@ -639,7 +653,7 @@ var stylesController = exports.StylesController = Montage.create(Component, { }, ///// Get Most Specific Selector For Element - ///// Given a selector+specificty array, find the most specific + ///// Given a selector+specificity array, find the most specific ///// selector for the passed-in element _getMostSpecificSelectorForElement : { @@ -721,7 +735,11 @@ var stylesController = exports.StylesController = Montage.create(Component, { ///// Calculate specificity ///// Returns the specificity value of passed-in selector ///// WARNING: Do not pass in grouped selectors! - ///// Helpful for determining precedence of style rules + ///// Helpful for determining precedence of style rules + ///// Calculation javascript code courtesy of David Owens: + ///// http://gbradley.com/2009/10/02/css-specificity-in-javascript + ///// Used with author's permission + calculateSpecificity : { value : function(selector) { var s = selector.replace(/\([^\)]+\)/,''), @@ -922,6 +940,43 @@ var stylesController = exports.StylesController = Montage.create(Component, { } } }, + + setGroupStyles : { + value : function(elements, styles) { + var properties = Object.keys(styles), + newClass = this.generateClassName(null, true), + selectors; + + ///// TODO: move this: Locally-scoped function to de-clutter variable declarations + function getSelector(el, rule) { + return this._getMostSpecificSelectorForElement(el, rule[this.CONST.SPECIFICITY_KEY]).selector; + } + + selectors = elements.map(function(el) { + ///// for each element, we want to find the most specific selector + var matchingRules = this.getMatchingRules(el, true); + + this.addClass(el, newClass); + + if(matchingRules.length === 0) { + return null; + } + + var mostSpecificRule = matchingRules[0], // TODO: iterate over properties to find most specific + selectorToOverride = getSelector.bind(this)(el, mostSpecificRule), + override = this.createOverrideSelector(selectorToOverride, null, newClass); + + return override.selector; + + }, this); + + selectors.filter(function(item) { + return item !== null; + }); + + this.addRule(selectors.join(', '), styles); + } + }, ///// Get Element Style ///// Gets the style value that is currently applied to the element @@ -1058,6 +1113,21 @@ var stylesController = exports.StylesController = Montage.create(Component, { } }, + ///// CSS From Object + ///// Returns css text from object with key/value pairs + ///// representing css styles + + cssFromObject : { + value : function(obj) { + var cssText = ''; + ///// For each key/value pair, create css text + for(var prop in obj) { + cssText += prop + ':' + obj[prop] + ';'; + } + return cssText; + } + }, + /* ----------------- Element model (rule cache) related methods ----------------- */ ///// Get Cached Rule For Property -- cgit v1.2.3 From 5737864d1d55d96e3cc3c1bc9b38ec58303b3981 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Mon, 6 Feb 2012 13:35:30 -0800 Subject: Allow users to switch between 2d and webGL mode. Note that this doesn't currently work. Signed-off-by: Nivesh Rajbhandari --- js/controllers/elements/shapes-controller.js | 58 ++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) (limited to 'js/controllers') diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index 48072309..22ba66b3 100644 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js @@ -56,6 +56,10 @@ exports.ShapesController = Montage.create(CanvasController, { el.elementModel.shapeModel.GLWorld.setViewportFromCanvas(el); el.elementModel.shapeModel.GLGeomObj.buildBuffers(); break; + case "useWebGl": + this.toggleWebGlMode(el, value); + el.elementModel.shapeModel.GLGeomObj.buildBuffers(); + break; default: CanvasController.setProperty(el, p, value); } @@ -276,6 +280,60 @@ exports.ShapesController = Montage.create(CanvasController, { { return (el.elementModel && el.elementModel.isShape); } + }, + + toggleWebGlMode: { + value: function(el, useWebGl) + { + if(useWebGl) + { + this.convertToWebGlWorld(el); + } + else + { + this.convertTo2DWorld(el); + } + } + }, + + convertToWebGlWorld: { + value: function(el) + { + if(el.elementModel.shapeModel.useWebGl) + { + return; + } + var world, + worldData = el.elementModel.shapeModel.GLWorld.export(); + if(worldData) + { + world = new GLWorld(el, true); + el.elementModel.shapeModel.GLWorld = world; + el.elementModel.shapeModel.useWebGl = true; + world.import(worldData); + } + + } + }, + + convertTo2DWorld: { + value: function(el) + { + if(!el.elementModel.shapeModel.useWebGl) + { + return; + } + var world, + worldData = el.elementModel.shapeModel.GLWorld.export(); + if(worldData) + { + world = new GLWorld(el, false); + el.elementModel.shapeModel.GLWorld = world; + el.elementModel.shapeModel.useWebGl = false; + world.import(worldData); + } + + } } }); -- cgit v1.2.3 From f94b0c5ada403379b3ff8a900c2a2aabcecce49e Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Mon, 6 Feb 2012 14:03:40 -0800 Subject: Add enabled property for ComboBox to support enabling/disabling materials dropdowns in the PI. Signed-off-by: Nivesh Rajbhandari --- js/controllers/elements/shapes-controller.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index 22ba66b3..74c88084 100644 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js @@ -57,8 +57,9 @@ exports.ShapesController = Montage.create(CanvasController, { el.elementModel.shapeModel.GLGeomObj.buildBuffers(); break; case "useWebGl": - this.toggleWebGlMode(el, value); - el.elementModel.shapeModel.GLGeomObj.buildBuffers(); +// this.toggleWebGlMode(el, value); +// el.elementModel.shapeModel.GLGeomObj.buildBuffers(); + el.elementModel.shapeModel.useWebGl = value; break; default: CanvasController.setProperty(el, p, value); -- cgit v1.2.3 From 75486be2839494c9b54833aff8f5eef3f9542151 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Mon, 6 Feb 2012 15:41:48 -0800 Subject: Support toggling between 2d and 3d canvas context. This requires us to create a new canvas with all the same values as the canvas being replaced and copying over all the shape data. Signed-off-by: Nivesh Rajbhandari --- js/controllers/elements/shapes-controller.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index 74c88084..ed45710d 100644 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js @@ -5,7 +5,8 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot */ var Montage = require("montage/core/core").Montage, - CanvasController = require("js/controllers/elements/canvas-controller").CanvasController; + CanvasController = require("js/controllers/elements/canvas-controller").CanvasController, + njModule = require("js/lib/NJUtils"); exports.ShapesController = Montage.create(CanvasController, { @@ -57,9 +58,11 @@ exports.ShapesController = Montage.create(CanvasController, { el.elementModel.shapeModel.GLGeomObj.buildBuffers(); break; case "useWebGl": -// this.toggleWebGlMode(el, value); -// el.elementModel.shapeModel.GLGeomObj.buildBuffers(); - el.elementModel.shapeModel.useWebGl = value; + var canvas = njModule.NJUtils.makeNJElement("canvas", "Canvas", "shape", el.className, true); + this.application.ninja.elementMediator.replaceElement(el, canvas); + el = canvas; + this.toggleWebGlMode(el, value); + el.elementModel.shapeModel.GLGeomObj.buildBuffers(); break; default: CanvasController.setProperty(el, p, value); -- cgit v1.2.3 From 92ae17bc800cf82cdbd1482ef1af1a5fd7bd632a Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Mon, 6 Feb 2012 16:35:12 -0800 Subject: Force layout canvas and SelectionController to update their info when a 2d canvas is replaced by a 3d canvas (and vice-versa). Signed-off-by: Nivesh Rajbhandari --- js/controllers/elements/shapes-controller.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'js/controllers') diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index ed45710d..3f1ccc3d 100644 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js @@ -59,7 +59,11 @@ exports.ShapesController = Montage.create(CanvasController, { break; case "useWebGl": var canvas = njModule.NJUtils.makeNJElement("canvas", "Canvas", "shape", el.className, true); + canvas.width = el.width; + canvas.height = el.height; this.application.ninja.elementMediator.replaceElement(el, canvas); + NJevent("elementDeleted", el); + this.application.ninja.selectionController.selectElement(canvas); el = canvas; this.toggleWebGlMode(el, value); el.elementModel.shapeModel.GLGeomObj.buildBuffers(); -- cgit v1.2.3 From 9dc2f9d72364bb3a8ddaef56eaf7d5c22b134e59 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Mon, 6 Feb 2012 16:55:34 -0800 Subject: Styles Controller - Add code to remove cache items from history (not just nullifying them) --- js/controllers/styles-controller.js | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js index 8fc90e7d..6ba24aa6 100644 --- a/js/controllers/styles-controller.js +++ b/js/controllers/styles-controller.js @@ -736,7 +736,6 @@ var stylesController = exports.StylesController = Montage.create(Component, { ///// Returns the specificity value of passed-in selector ///// WARNING: Do not pass in grouped selectors! ///// Helpful for determining precedence of style rules - ///// Calculation javascript code courtesy of David Owens: ///// http://gbradley.com/2009/10/02/css-specificity-in-javascript ///// Used with author's permission @@ -1177,15 +1176,24 @@ var stylesController = exports.StylesController = Montage.create(Component, { _clearCache: { value: function(element) { - var itemsToClear = this._cacheHistory; + var itemsToNullify = this._cacheHistory, + itemsToRemove = [], + i; + + ///// If clearing the cache for an element, filter by element + ///// and keep track of indices to remove from cache if(element) { - itemsToClear = itemsToClear.filter(function(item) { - return item.element === element; + itemsToNullify = itemsToNullify.filter(function(item, index) { + if(item.element === element) { + itemsToRemove.push(index); + return true; + } + return false; }); } - itemsToClear.forEach(function(item) { + itemsToNullify.forEach(function(item) { //var identifier = item.element.nodeName; //identifier += '#'+item.element.id || '.'+item.element.className; //console.log("clearing cache for \"" + item.property +"\" and element \"" + identifier+ ""); @@ -1194,6 +1202,17 @@ var stylesController = exports.StylesController = Montage.create(Component, { } }); + ///// Remove the nullified items from the cache + ///// Start at the end to not mess up index references + for(i = itemsToRemove.length-1; i >= 0; i--) { + this._cacheHistory.splice(itemsToRemove[i], 1); + } + + if(!element) { + this._cacheHistory = null; + this._cacheHistory = []; + } + } }, _removeCachedRuleForProperty : { -- cgit v1.2.3 From bb8e0289ff170fd1a5256b99259c6ee5d3fdea17 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Mon, 6 Feb 2012 16:56:57 -0800 Subject: Styles Controller - Correct author attribution for specificity calculation --- js/controllers/styles-controller.js | 1 + 1 file changed, 1 insertion(+) (limited to 'js/controllers') diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js index 6ba24aa6..1dd91c8d 100644 --- a/js/controllers/styles-controller.js +++ b/js/controllers/styles-controller.js @@ -736,6 +736,7 @@ var stylesController = exports.StylesController = Montage.create(Component, { ///// Returns the specificity value of passed-in selector ///// WARNING: Do not pass in grouped selectors! ///// Helpful for determining precedence of style rules + ///// Calculation javascript code courtesy of Graham Bradley: ///// http://gbradley.com/2009/10/02/css-specificity-in-javascript ///// Used with author's permission -- cgit v1.2.3 From b89ede5ba6e2389e623c9e15d4cb4329044eefb6 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Mon, 6 Feb 2012 16:57:33 -0800 Subject: Styles Controller - Add some methods for modifying css keyframe rules --- js/controllers/styles-controller.js | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'js/controllers') diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js index 1dd91c8d..21024125 100644 --- a/js/controllers/styles-controller.js +++ b/js/controllers/styles-controller.js @@ -804,7 +804,34 @@ var stylesController = exports.StylesController = Montage.create(Component, { return browserValues; } }, - + + ///// Set Keyframe Style + ///// For a given CSSKeyframesRule, we may add a style to the keyframe at + ///// given index. + + setKeyframeStyle : { + value : function(rule, keyframeIndex, property, value, useImportant) { + return this.setStyle(rule.cssRules[keyframeIndex], property, value, useImportant); + } + }, + + ///// Set Keyframe Styles + ///// For a given CSSKeyframesRule, we may add styles to the keyframe at + ///// given index. + + setKeyframeStyle : { + value : function(rule, keyframeIndex, property, value, useImportant) { + return this.setStyles(rule.cssRules[keyframeIndex], property, value, useImportant); + } + }, + + insertKeyframe : { + value : function() { + + } + }, + + ///// Delete style ///// Removes the property from the style declaration/rule ///// Returns the rule -- cgit v1.2.3 From 0df27aef631bd797b14c84b04c6f20b15966eabb Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Thu, 2 Feb 2012 10:36:05 -0800 Subject: Tree Controller - Initial add --- js/controllers/tree-controller.js | 219 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 219 insertions(+) create mode 100644 js/controllers/tree-controller.js (limited to 'js/controllers') diff --git a/js/controllers/tree-controller.js b/js/controllers/tree-controller.js new file mode 100644 index 00000000..45e4c4ba --- /dev/null +++ b/js/controllers/tree-controller.js @@ -0,0 +1,219 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ +/** + @module montage/ui/controller/tree-controller + @requires montage/core/core + @requires montage/ui/controller/object-controller + @requires montage/core/event/mutable-event + */ +var Montage = require("montage").Montage, + ObjectController = require("montage/ui/controller/object-controller").ObjectController, + ArrayController = require("montage/ui/controller/array-controller").ArrayController, + MutableEvent = require("montage/core/event/mutable-event").MutableEvent; +/** + TODO: Write description like the array controllers: The ArrayController helps with organizing a hierarchical + collection of objects, and managing user selection within that collection. + You can assign a TreeController instance as the contentProvider property for a TreeView object. + @class module:montage/ui/controller/tree-controller.TreeController + @classdesc + @extends module:montage/ui/controller/object-controller.ObjectController +*/ +var TreeController = exports.TreeController = Montage.create(ObjectController, /** @lends module:montage/ui/controller/tree-controller.TreeController# */ { + + rootKey : { + value: null + }, + + branchKey : { + value: 'children' + }, + + _root : { + value : null + }, + root : { + get: function() { + return this._root; + }, + set: function(value) { + this._root = value; + + this.initArrayControllers(); + } + }, + + rootController: { + value: null + }, + + initArrayControllers : { + value: function() { + var self = this; + + ///// Declare function to initialize controller for each node + ///// that is a branch + + function initController(array, depth) { + var controller = Montage.create(ArrayController, { + content : { value: array }, + delegate : { value: self }, + isSelectionEnabled : { value: true }}); + + if(depth === 0) { + self.rootController = controller; + } + + self.branchControllers.push({ + depth : depth, + controller : controller + + }); + } + + ///// Recursive function that finds all branch nodes and initializes + ///// an array controller + + function walk(node, init, depth) { + var children = node[self.branchKey]; + + if(children) { + //init(children, depth); + + children.forEach(function(child) { + walk(child, init, ++depth); + }); + + node['treeNodeType'] = 'branch'; + } else { + node['treeNodeType'] = 'leaf'; + } + } + + walk(this._root, initController, 0); + + } + }, + + /** + @private + */ + _selectedIndexes: { + value: null, + enumerable: false + }, + + /** + Description TODO + @type {Function} + @default null + */ + selectedIndexes: { + get: function() { + + }, + set: function(value) { + + } + }, + + lazyLoad : { + value: false + }, + + branchControllers: { + value: [] + }, + + addBranchController : { + value: function(controller) { + if(this.delegate) { + controller.delegate = this.delegate; + } + + this.branchControllers.push(controller); + } + }, + + /** + @private + */ + _content: { + enumerable: false, + value: null + }, + /** + The content managed by the TreeController. + @type {Function} + @default {String} null + */ + content: { + get: function() { + return this._content; + }, + set: function(value) { + if (this._content === value) { + return; + } + + this._content = value; + + //TODO for right now assume that any content change invalidates the selection completely; we'll need to address this of course + this.selectedObjects = null; + + if (this.rootKey) { + if (value[this.rootKey]) { + this.root = value[this.rootKey]; + } else { + console.log('No root key found in content data'); + } + } else { + this.root = value; + } + + + } + }, + + addObjects : { + value: function() { + + var objects = Array.prototype.slice.call(arguments), + i, + objectCount = objects.length, + selectedContentIndexes, firstIndex; + + for (i = 0; i < objectCount; i++) { + this.content.push(objects[i]); + } + + if (this.selectObjectsOnAddition) { + selectedContentIndexes = []; + firstIndex = this.content.length-objectCount; + for (i = 0; i < objectCount; i++) { + selectedContentIndexes[i] = firstIndex++; + } + this.selectedContentIndexes = selectedContentIndexes; + this.selectedObjects = objects; + } + + if (this.clearFilterFunctionOnAddition) { + this.filterFunction = null; + } + + if (this.automaticallyOrganizeObjects) { + this.organizeObjects(); + } + + } + }, + + insertChildBefore : { value : function() {} }, + + insertChildAfter : { value : function() {} } + + + +}); -- cgit v1.2.3 From 57562aace901f12215895133dc1e7a6fd4daf2a2 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Thu, 2 Feb 2012 14:58:21 -0800 Subject: Tree Controller - Clean out unused code --- js/controllers/tree-controller.js | 48 ++++++--------------------------------- 1 file changed, 7 insertions(+), 41 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/tree-controller.js b/js/controllers/tree-controller.js index 45e4c4ba..2b2e910c 100644 --- a/js/controllers/tree-controller.js +++ b/js/controllers/tree-controller.js @@ -53,37 +53,15 @@ var TreeController = exports.TreeController = Montage.create(ObjectController, / value: function() { var self = this; - ///// Declare function to initialize controller for each node - ///// that is a branch - - function initController(array, depth) { - var controller = Montage.create(ArrayController, { - content : { value: array }, - delegate : { value: self }, - isSelectionEnabled : { value: true }}); - - if(depth === 0) { - self.rootController = controller; - } - - self.branchControllers.push({ - depth : depth, - controller : controller - - }); - } - ///// Recursive function that finds all branch nodes and initializes - ///// an array controller + ///// sets the tree node type to "branch" or "leaf" function walk(node, init, depth) { - var children = node[self.branchKey]; - - if(children) { - //init(children, depth); + var branch = node[self.branchKey]; - children.forEach(function(child) { - walk(child, init, ++depth); + if(branch) { + branch.forEach(function(node) { + walk(node, init, ++depth); }); node['treeNodeType'] = 'branch'; @@ -92,7 +70,7 @@ var TreeController = exports.TreeController = Montage.create(ObjectController, / } } - walk(this._root, initController, 0); + walk(this._root, 0); } }, @@ -119,10 +97,6 @@ var TreeController = exports.TreeController = Montage.create(ObjectController, / } }, - lazyLoad : { - value: false - }, - branchControllers: { value: [] }, @@ -160,7 +134,6 @@ var TreeController = exports.TreeController = Montage.create(ObjectController, / this._content = value; - //TODO for right now assume that any content change invalidates the selection completely; we'll need to address this of course this.selectedObjects = null; if (this.rootKey) { @@ -173,7 +146,6 @@ var TreeController = exports.TreeController = Montage.create(ObjectController, / this.root = value; } - } }, @@ -208,12 +180,6 @@ var TreeController = exports.TreeController = Montage.create(ObjectController, / } } - }, - - insertChildBefore : { value : function() {} }, - - insertChildAfter : { value : function() {} } - - + } }); -- cgit v1.2.3 From 8ad767b61460984a4031ba630f76ac8247a61857 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 7 Feb 2012 11:42:10 -0800 Subject: Fixed PI to support WebGL materials. Signed-off-by: Nivesh Rajbhandari --- js/controllers/elements/shapes-controller.js | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index 3f1ccc3d..21373aca 100644 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js @@ -68,6 +68,24 @@ exports.ShapesController = Montage.create(CanvasController, { this.toggleWebGlMode(el, value); el.elementModel.shapeModel.GLGeomObj.buildBuffers(); break; + case "str