From 7e0c709b4f0557d0f8fd6da8a47dc26172513cc8 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Mon, 30 Jan 2012 09:54:55 -0800 Subject: Checkbox and Combobox change/changing events were not setting wasSetByCode property correctly, causing our PI to dispatch events at improper times. Signed-off-by: Nivesh Rajbhandari --- js/components/combobox.reel/combobox.js | 2 +- js/components/radio.reel/radio.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'js') diff --git a/js/components/combobox.reel/combobox.js b/js/components/combobox.reel/combobox.js index f262bb06..a68a7d6b 100644 --- a/js/components/combobox.reel/combobox.js +++ b/js/components/combobox.reel/combobox.js @@ -67,7 +67,7 @@ exports.Combobox = Montage.create(Component, { var e = document.createEvent("CustomEvent"); e.initEvent("change", true, true); e.type = "change"; - e._wasSetByCode = this._wasSetByCode; + e.wasSetByCode = this._wasSetByCode; e.value = this._value; this.dispatchEvent(e); diff --git a/js/components/radio.reel/radio.js b/js/components/radio.reel/radio.js index 954da3c4..c661ec11 100644 --- a/js/components/radio.reel/radio.js +++ b/js/components/radio.reel/radio.js @@ -41,7 +41,7 @@ exports.RadioGroup = Montage.create(Component, { e = document.createEvent("CustomEvent"); e.initEvent("change", true, true); e.type = "change"; - e._wasSetByCode = this._wasSetByCode; + e.wasSetByCode = this._wasSetByCode; e.selectedIndex = i; e.selectedItem = value; this.dispatchEvent(e); @@ -77,7 +77,7 @@ exports.RadioGroup = Montage.create(Component, { { value:function(event) { - this._wasSetByCode = event._event._wasSetByCode; + this._wasSetByCode = event._event.wasSetByCode; this.selectedItem = event._event.value; } } @@ -126,7 +126,7 @@ exports.Radio = Montage.create(Component, { var e = document.createEvent("CustomEvent"); e.initEvent("change", true, true); e.type = "change"; - e._wasSetByCode = this._wasSetByCode; + e.wasSetByCode = this._wasSetByCode; e.value = this; this.dispatchEvent(e); -- cgit v1.2.3 From 4a3793e9cc498219d246e543a55b543e1b4fb708 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Mon, 30 Jan 2012 11:21:15 -0800 Subject: CSSPanel Updates - Add new original CSS error icon --- js/panels/CSSPanel/CSSPanelBase.reel/CSSPanelBase.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js') diff --git a/js/panels/CSSPanel/CSSPanelBase.reel/CSSPanelBase.css b/js/panels/CSSPanel/CSSPanelBase.reel/CSSPanelBase.css index ff70b5b6..27d19e58 100644 --- a/js/panels/CSSPanel/CSSPanelBase.reel/CSSPanelBase.css +++ b/js/panels/CSSPanel/CSSPanelBase.reel/CSSPanelBase.css @@ -400,7 +400,7 @@ .nj-css-error:not(.nj-css-no-error) { background-repeat: no-repeat; background-position: 3px 2px; - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAAXNSR0IArs4c6QAAAMtJREFUGJV1kM0KAXEUxc/SWh7MM0zJE3gQCxM2EpJ8bEiNjWHhBWYjYkUkRdQoGde5f2Q03PrV6ZzTrXuB0MgQiU0ba0U1/k3gwBYXoqj+WeKG2LaBgwxYJEbTixa7yMyLLPlLw6xATS9SXDWx25cZ7sYG1ep9b3OR8h3cTyUWtyMylnMNcqGn2WdbHQs94FqFnPtxg2r1NHsfkTx0EMiEG7IMpy2D0fSOPWbsgD/zzEtoik323hP75THTDvJpVHIW5I1t4aaEPe08AF+CuEXWXJtHAAAAAElFTkSuQmCC); + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAALCAYAAABGbhwYAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw%2FeHBhY2tldCBiZWdpbj0i77u%2FIiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8%2BIDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYxIDY0LjE0MDk0OSwgMjAxMC8xMi8wNy0xMDo1NzowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNS4xIE1hY2ludG9zaCIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDowMzYyMERFNTQwNzMxMUUxQTREQ0IxQTRGNEI2MTE3RiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDowMzYyMERFNjQwNzMxMUUxQTREQ0IxQTRGNEI2MTE3RiI%2BIDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjAzNjIwREUzNDA3MzExRTFBNERDQjFBNEY0QjYxMTdGIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjAzNjIwREU0NDA3MzExRTFBNERDQjFBNEY0QjYxMTdGIi8%2BIDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY%2BIDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8%2Bc4fwegAAAWpJREFUeNo8kLtLA0EQxr%2B9l3lcDAaCBsEqEOysBFEQsRAsRVCEpBREsbIUSxtBrAxEewsrK8VHQIhK%2FoIUUVJIQFFjYi65XDZ36%2Bz5GFgWZr75fjPDhBD4C%2BucjWgaphjQdTgK%2FfPi5a%2FGpPDtjEVjERyqKlag%2FlY8gHPsfzSwPbQgbDyfIs6vURa3EKK8Jf6jmhUy51yiWDlBUDED2NF0JKGQS3IPVn4ATXqIL0EYJgwD42YQG4quE45EggOtCwbWrUM1Ej%2F0jkXDAYaOtOa6iIH2YSQOBugPj4KN3aFdnIThkprynoeUYjtwIRO0hCLxiU3wp12odgl0AXhUa3VQ0xoWCqEApiNhEpFzt7Tm%2F4Tzo9kGvtq4UjNzqJB1mswURvNoqayP57V7KcB7HfZnE8v%2BHYtZtmiGcBzqQ1TSZUPP85HVlo1MfCaX94WPpSO83qwO6wbWCTtBQocoD70eDgZncw3Z%2BC3AAFMzlxlnnpevAAAAAElFTkSuQmCC); opacity: 0.5; } .nj-editing.nj-css-error { -- cgit v1.2.3 From 51b4e61d6c6df5e88e9a5dfcdfd7944e2a3f64e7 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Mon, 30 Jan 2012 13:25:15 -0800 Subject: Syncing stage view when rotating stage. Signed-off-by: Nivesh Rajbhandari --- js/helper-classes/3D/draw-utils.js | 25 +++++++++++++++++++++++++ js/models/properties-3d.js | 2 ++ js/stage/layout.js | 14 +++++++++++--- js/stage/stage.reel/stage.js | 2 +- js/tools/SelectionTool.js | 1 - 5 files changed, 39 insertions(+), 5 deletions(-) (limited to 'js') diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index 3fd6e8fc..c26a5cd1 100644 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js @@ -107,6 +107,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { this.eventManager.addEventListener("elementAdded", this, false); this.eventManager.addEventListener("elementDeleted", this, false); + this.eventManager.addEventListener("elementChange", this, false); } }, @@ -124,6 +125,27 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { }, + handleElementChange: { + value: function(event) { + var els = event.detail.data.els; + if(els) + { + var len = els.length, + i = 0, + item, + el; + + for(i=0; i < len; i++) { + item = els[i]; + el = item._element || item; + el.elementModel.props3D.elementPlane.init(); + } + + this.drawWorkingPlane(); + } + } + }, + /////////////////////////////////////////////////////////////////////// // Methods /////////////////////////////////////////////////////////////////////// @@ -150,6 +172,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { plane.setElement( elt ); plane.init(); this._planesArray.push( plane ); + elt.elementModel.props3D.elementPlane = plane; } }, @@ -166,6 +189,8 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { // Then remove the element this._eltArray.splice(i, 1); + + // TODO - May need to delete props3D and elementPlane as well return; } } diff --git a/js/models/properties-3d.js b/js/models/properties-3d.js index 6d65bc91..3c809f06 100644 --- a/js/models/properties-3d.js +++ b/js/models/properties-3d.js @@ -36,6 +36,8 @@ exports.Properties3D = Montage.create(Component, { perspectiveDist : { value : 1400, enumerable: true}, perspectiveMode : { value : null, enumerable: true}, + elementPlane : { value : null, enumerable: true}, + init : { value : function(elt) { diff --git a/js/stage/layout.js b/js/stage/layout.js index 625c09ad..89fa44f3 100644 --- a/js/stage/layout.js +++ b/js/stage/layout.js @@ -112,6 +112,7 @@ exports.Layout = Montage.create(Component, { } this.draw(); // Not a reel yet :) + this.draw3DInfo(false); } @@ -128,9 +129,16 @@ exports.Layout = Montage.create(Component, { }, draw3DInfo: { - value: function() { - drawUtils.updatePlanes(); - if(this.stage.appModel.show3dGrid) drawUtils.drawWorkingPlane(); + value: function(updatePlanes) { + if(updatePlanes) + { + drawUtils.updatePlanes(); + } + if(this.stage.appModel.show3dGrid) + { + this.application.ninja.stage.stageDeps.snapManager.updateWorkingPlaneFromView(); + drawUtils.drawWorkingPlane(); + } drawUtils.draw3DCompass(); } }, diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index 3e0b852e..31d0f8c2 100644 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js @@ -175,7 +175,7 @@ exports.Stage = Montage.create(Component, { } else if(this.updatedStage) { this.layout.draw(); - this.layout.draw3DInfo(); + this.layout.draw3DInfo(true); } } }, diff --git a/js/tools/SelectionTool.js b/js/tools/SelectionTool.js index 5f2a959f..862b2e88 100644 --- a/js/tools/SelectionTool.js +++ b/js/tools/SelectionTool.js @@ -180,7 +180,6 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, { this._handleMode = null; this._delta = null; this.DrawHandles(); - console.log( "move: (" + dx + ", " + dy + ")" ); } this.endDraw(event); -- cgit v1.2.3 From 8b8b9bc1cd033b483f3a5c57acc75dfb56e099a4 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Mon, 30 Jan 2012 14:21:59 -0800 Subject: Fixed grid not drawing bug when switching from front to top and side. Signed-off-by: Nivesh Rajbhandari --- js/stage/stage.reel/stage.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'js') diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index 31d0f8c2..8c4efd58 100644 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js @@ -814,8 +814,8 @@ exports.Stage = Montage.create(Component, { setStageView: { value: function(side) { var mat, - workingPlane = null, - currentDoc = this.application.ninja.currentDocument.documentRoot; + currentDoc = this.application.ninja.currentDocument.documentRoot, + isDrawingGrid = this.application.ninja.appModel.show3dGrid; // Stage 3d Props. currentDoc.elementModel.props3D.ResetTranslationValues(); currentDoc.elementModel.props3D.ResetRotationValues(); @@ -826,7 +826,7 @@ exports.Stage = Montage.create(Component, { mat = Matrix.RotationX(Math.PI * 270.0/180.0); drawUtils.drawXY = drawUtils.drawYZ = false; - drawUtils.drawXZ = drawUtils.isDrawingGrid(); + drawUtils.drawXZ = isDrawingGrid; workingPlane = [0,1,0,0]; break; @@ -834,7 +834,7 @@ exports.Stage = Montage.create(Component, { mat = Matrix.RotationY(Math.PI * 270/180); drawUtils.drawXY = drawUtils.drawXZ = false; - drawUtils.drawYZ = drawUtils.isDrawingGrid(); + drawUtils.drawYZ = isDrawingGrid; workingPlane = [1,0,0,0]; break; @@ -842,7 +842,7 @@ exports.Stage = Montage.create(Component, { mat = Matrix.I(4); drawUtils.drawYZ = drawUtils.drawXZ = false; - drawUtils.drawXY = drawUtils.isDrawingGrid(); + drawUtils.drawXY = isDrawingGrid; workingPlane = [0,0,1,0]; break; } -- cgit v1.2.3 From b125c02c3d2e28cc9364d16e23791cd6b540f17c Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Mon, 30 Jan 2012 15:18:50 -0800 Subject: IKNINJA-1083 Fixing minor bug with no color breaking on null alpha value. --- js/panels/Color/colorchippopup.reel/colorchippopup.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js') diff --git a/js/panels/Color/colorchippopup.reel/colorchippopup.js b/js/panels/Color/colorchippopup.reel/colorchippopup.js index 03e14b28..05bcb447 100644 --- a/js/panels/Color/colorchippopup.reel/colorchippopup.js +++ b/js/panels/Color/colorchippopup.reel/colorchippopup.js @@ -109,7 +109,7 @@ exports.ColorChipPopup = Montage.create(Component, { this.cc_hexinput.labelFunction = this._hexLabel.bind(this); this.cc_hexinput.inputFunction = this._hexInput.bind(this); // - if (this.application.ninja.colorController.colorView.currentChip && this.application.ninja.colorController.colorView.currentChip.colorValue.a) { + if (this.application.ninja.colorController.colorView.currentChip && this.application.ninja.colorController.colorView.currentChip.colorValue && this.application.ninja.colorController.colorView.currentChip.colorValue.a) { this.combo.slider.value = Math.round(this.application.ninja.colorController.colorView.currentChip.colorValue.a*100); } else { this.combo.slider.value = 100; -- cgit v1.2.3 From b88ebb47d82fc1ffebea49c3bf182aaf3c9419af Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Mon, 30 Jan 2012 15:53:11 -0800 Subject: Fixed issue with elements not drawing in the correct plane. When first adding an element, force the 3d model to update with the element's webkit transform values. Signed-off-by: Nivesh Rajbhandari --- js/controllers/elements/element-controller.js | 59 +++++++++++++-------------- js/mediators/element-mediator.js | 5 +++ js/models/properties-3d.js | 4 +- 3 files changed, 36 insertions(+), 32 deletions(-) (limited to 'js') diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index f254220c..30469db0 100644 --- a/js/controllers/elements/element-controller.js +++ b/js/controllers/elements/element-controller.js @@ -127,36 +127,35 @@ var ElementController = exports.ElementController = Montage.create(NJComponent, } else { - // TODO - for now, just return the identity matrix - return Matrix.I(4); -// var mat; -// -// if (elt) -// { -// var xformStr = ElementsMediator.getProperty(elt, "-webkit-transform"); -// if (xformStr) -// mat = this.transformStringToMat( xformStr ); -// if (!mat) -// mat = Matrix.I(4); -// -// if (elt.style && elt.style.zoom) -// { -// var zoom = Number(elt.style.zoom); -// if (zoom != 1) -// { -// var zoomMat = Matrix.create( [ -// [ zoom, 0, 0, 0], -// [ 0, zoom, 0, 0], -// [ 0, 0, zoom, 0], -// [ 0, 0, 0, 1] -// ] ); -// glmat4.multiply( zoomMat, mat, mat ); -// } -// } -// } -// -// elt.elementModel.props3D.matrix3d = mat; -// return mat; + var mat; + + if (el) + { + var xformStr = this.application.ninja.elementMediator.getProperty(el, "-webkit-transform"); + if (xformStr) + mat = this.transformStringToMat( xformStr ); + if (!mat) + mat = Matrix.I(4); + + var zoom = this.application.ninja.elementMediator.getProperty(el, "zoom"); + if (zoom) + { + zoom = Number(zoom); + if (zoom != 1) + { + var zoomMat = Matrix.create( [ + [ zoom, 0, 0, 0], + [ 0, zoom, 0, 0], + [ 0, 0, zoom, 0], + [ 0, 0, 0, 1] + ] ); + glmat4.multiply( zoomMat, mat, mat ); + } + } + } + + el.elementModel.props3D.matrix3d = mat; + return mat; } } }, diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js index 91b09475..a6f31703 100644 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js @@ -92,6 +92,11 @@ exports.ElementMediator = Montage.create(NJComponent, { _addElement: { value: function(el, rules, noEvent) { ElementController.addElement(el, rules); + var p3d = this.get3DProperties(el); + if(p3d) + { + el.elementModel.controller["set3DProperties"](el, [p3d], 0, true); + } if(!noEvent) NJevent("elementAdded", el); } }, diff --git a/js/models/properties-3d.js b/js/models/properties-3d.js index 3c809f06..cf4a045f 100644 --- a/js/models/properties-3d.js +++ b/js/models/properties-3d.js @@ -22,7 +22,7 @@ exports.Properties3D = Montage.create(Component, { _world : {value : null, enumerable:true}, // keep a referenceto the GLWorld (if any) // Keep track of 3d properties - matrix3d : {value : [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1], enumerable: true}, + matrix3d : {value : null, enumerable: true}, xAngle : {value : 0, enumerable: true}, yAngle : {value : 0, enumerable: true}, @@ -33,7 +33,7 @@ exports.Properties3D = Montage.create(Component, { z3D : {value : 0, enumerable: true}, //TODO - not sure if this should be part of the tool or stage or a utility - perspectiveDist : { value : 1400, enumerable: true}, + perspectiveDist : { value : null, enumerable: true}, perspectiveMode : { value : null, enumerable: true}, elementPlane : { value : null, enumerable: true}, -- cgit v1.2.3 From cbdc001ea4afd054e7a9e1b4e54629254a68376b Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Mon, 30 Jan 2012 16:14:43 -0800 Subject: Removing unused Properties3D file since those values are now saved with the models. Signed-off-by: Nivesh Rajbhandari --- js/helper-classes/Properties3D.js | 82 --------------------------------------- 1 file changed, 82 deletions(-) delete mode 100644 js/helper-classes/Properties3D.js (limited to 'js') diff --git a/js/helper-classes/Properties3D.js b/js/helper-classes/Properties3D.js deleted file mode 100644 index 42499877..00000000 --- a/js/helper-classes/Properties3D.js +++ /dev/null @@ -1,82 +0,0 @@ -/* -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. -
*/ - -/* Class that holds all 3d properties per element. -*/ - -exports.Properties3D = Object.create(Object.prototype, { - m_element : {value : null, writable:true, enumerable:true, configurable:true}, - -// m_upVector : {value : Vector.create( [0,1,0] ), writable: true, enumerable: true, configurable: true}, - m_azimuth : {value : 0.0, writable: true, enumerable: true, configurable: true}, - m_altitude : {value : 0.0, writable: true, enumerable: true, configurable: true}, - - m_transformCtr : {value : null, writable: true, enumerable: true, configurable: true}, -// m_targetPos : {value : Vector.create( [0,0,0] ), writable: true, enumerable: true, configurable: true}, - - m_endAzimuth : {value : 0, writable: true, enumerable: true, configurable: true}, - m_endAltitude : {value : 0, writable: true, enumerable: true, configurable: true}, - -// m_objStartPos : {value : Vector.create( [0,0,0] ), writable: true, enumerable: true, configurable: true}, - - //TODO - not sure if this should be part of the tool or stage or a utility - perspectiveDist : { value : 1400, writable: true, enumerable: true, configurable: true}, - - // keep a referenceto the GLWorld (if any) - _world : {value : null, writable:true, enumerable:true, configurable:true}, - - // keep a flag indicating the element is in the 2D snap cache - _eltIsIn2DSnapCache : { value: false, writable: true, enumerable: true, configurable: true}, - - Init : { - value : function(elt) - { - this.m_element = elt; - - this.m_azimuth = 0.0; - this.m_altitude = 0.0; - - this.m_endAzimuth = 0.0; - this.m_endAltitude = 0.0; - -// this.m_upVector = Vector.create( [0,1,0] ); -// this.m_viewDir = Vector.create( [0,0,1] ); -// this.m_endUpVector = Vector.create( [0,1,0] ); - - this.m_transformCtr = null; -// this.m_targetPos = Vector.create( [0,0,0] ); - -// this.m_objStartPos = Vector.create( [0,0,0] ); - - this.perspectiveDist = 1400; - } - }, - - ResetRotationValues : { - value : function(elt) - { -// this.m_upVector = Vector.create( [0,1,0] ); -// this.m_viewDir = Vector.create( [0,0,1] ); - - this.m_azimuth = 0.0; - this.m_altitude = 0.0; - - this.m_endAzimuth = 0.0; - this.m_endAltitude = 0.0; - - this.m_transformCtr = null; -// this.m_targetPos = Vector.create( [0,0,0] ); - } - }, - - ResetTranslationValues : { - value : function(elt) - { -// this.m_objStartPos = Vector.create( [0,0,0] ); - this.perspectiveDist = 1400; - } - } -}); \ No newline at end of file -- cgit v1.2.3 From d6e80f16b70034ba8cc7193f4359f764ce28f68b Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Mon, 30 Jan 2012 16:20:45 -0800 Subject: Forgot to remove a require in previous checkin. Signed-off-by: Nivesh Rajbhandari --- js/tools/drawing-tool-base.js | 1 - 1 file changed, 1 deletion(-) (limited to 'js') diff --git a/js/tools/drawing-tool-base.js b/js/tools/drawing-tool-base.js index 6fc34911..cd895102 100644 --- a/js/tools/drawing-tool-base.js +++ b/js/tools/drawing-tool-base.js @@ -10,7 +10,6 @@ var Component = require("montage/ui/component").Component; var snapManager = require("js/helper-classes/3D/snap-manager").SnapManager; var viewUtils = require("js/helper-classes/3D/view-utils").ViewUtils; var vecUtils = require("js/helper-classes/3D/vec-utils").VecUtils; -var Properties3D = require("js/helper-classes/Properties3D").Properties3D; var drawUtils = require("js/helper-classes/3D/draw-utils").DrawUtils; exports.DrawingToolBase = Montage.create(Montage, { -- cgit v1.2.3 From 086ade64bb2f5bcc7b6126b5e83c4efccc10ef43 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 31 Jan 2012 08:35:59 +0800 Subject: Adding a version json object to Ninja Versions object to start keeping track of versions for Ninja, Montage and eventually other dependencies. Loaded before montage to use in the splash screen. Signed-off-by: Valerio Virgillito --- js/ninja.reel/ninja.js | 1 + 1 file changed, 1 insertion(+) (limited to 'js') diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js index bc31e0e1..75ec7fcc 100644 --- a/js/ninja.reel/ninja.js +++ b/js/ninja.reel/ninja.js @@ -36,6 +36,7 @@ exports.Ninja = Montage.create(Component, { prepareForDraw: { value: function() { + console.log("Loading Ninja --> ", window.ninjaVersion.ninja.version); this.application.ninja = this; -- cgit v1.2.3 From a4fcd3237432a361e9a07c7fe3d75128e6c99d1c Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 31 Jan 2012 08:36:31 +0800 Subject: Code cleanup - Removed extra log. Signed-off-by: Valerio Virgillito --- js/preloader/Preloader.js | 1 - 1 file changed, 1 deletion(-) (limited to 'js') diff --git a/js/preloader/Preloader.js b/js/preloader/Preloader.js index f137f4b6..93d71e8f 100755 --- a/js/preloader/Preloader.js +++ b/js/preloader/Preloader.js @@ -136,7 +136,6 @@ exports.Preloader = Montage.create(Component, { deserializedFromTemplate: { value: function() { - console.log("Start Preloading"); this.filesTotal = this.ninjaJsRequire.length + this.ninjaCssRequire.length; -- cgit v1.2.3 From e53f325cf80694d5895cc36c36d1f66c5a44e1d9 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Mon, 30 Jan 2012 11:21:15 -0800 Subject: CSSPanel Updates - Add new original CSS error icon --- js/panels/CSSPanel/CSSPanelBase.reel/CSSPanelBase.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js') diff --git a/js/panels/CSSPanel/CSSPanelBase.reel/CSSPanelBase.css b/js/panels/CSSPanel/CSSPanelBase.reel/CSSPanelBase.css index ff70b5b6..27d19e58 100644 --- a/js/panels/CSSPanel/CSSPanelBase.reel/CSSPanelBase.css +++ b/js/panels/CSSPanel/CSSPanelBase.reel/CSSPanelBase.css @@ -400,7 +400,7 @@ .nj-css-error:not(.nj-css-no-error) { background-repeat: no-repeat; background-position: 3px 2px; - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAAXNSR0IArs4c6QAAAMtJREFUGJV1kM0KAXEUxc/SWh7MM0zJE3gQCxM2EpJ8bEiNjWHhBWYjYkUkRdQoGde5f2Q03PrV6ZzTrXuB0MgQiU0ba0U1/k3gwBYXoqj+WeKG2LaBgwxYJEbTixa7yMyLLPlLw6xATS9SXDWx25cZ7sYG1ep9b3OR8h3cTyUWtyMylnMNcqGn2WdbHQs94FqFnPtxg2r1NHsfkTx0EMiEG7IMpy2D0fSOPWbsgD/zzEtoik323hP75THTDvJpVHIW5I1t4aaEPe08AF+CuEXWXJtHAAAAAElFTkSuQmCC); + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAALCAYAAABGbhwYAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw%2FeHBhY2tldCBiZWdpbj0i77u%2FIiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8%2BIDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYxIDY0LjE0MDk0OSwgMjAxMC8xMi8wNy0xMDo1NzowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNS4xIE1hY2ludG9zaCIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDowMzYyMERFNTQwNzMxMUUxQTREQ0IxQTRGNEI2MTE3RiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDowMzYyMERFNjQwNzMxMUUxQTREQ0IxQTRGNEI2MTE3RiI%2BIDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjAzNjIwREUzNDA3MzExRTFBNERDQjFBNEY0QjYxMTdGIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjAzNjIwREU0NDA3MzExRTFBNERDQjFBNEY0QjYxMTdGIi8%2BIDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY%2BIDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8%2Bc4fwegAAAWpJREFUeNo8kLtLA0EQxr%2B9l3lcDAaCBsEqEOysBFEQsRAsRVCEpBREsbIUSxtBrAxEewsrK8VHQIhK%2FoIUUVJIQFFjYi65XDZ36%2Bz5GFgWZr75fjPDhBD4C%2BucjWgaphjQdTgK%2FfPi5a%2FGpPDtjEVjERyqKlag%2FlY8gHPsfzSwPbQgbDyfIs6vURa3EKK8Jf6jmhUy51yiWDlBUDED2NF0JKGQS3IPVn4ATXqIL0EYJgwD42YQG4quE45EggOtCwbWrUM1Ej%2F0jkXDAYaOtOa6iIH2YSQOBugPj4KN3aFdnIThkprynoeUYjtwIRO0hCLxiU3wp12odgl0AXhUa3VQ0xoWCqEApiNhEpFzt7Tm%2F4Tzo9kGvtq4UjNzqJB1mswURvNoqayP57V7KcB7HfZnE8v%2BHYtZtmiGcBzqQ1TSZUPP85HVlo1MfCaX94WPpSO83qwO6wbWCTtBQocoD70eDgZncw3Z%2BC3AAFMzlxlnnpevAAAAAElFTkSuQmCC); opacity: 0.5; } .nj-editing.nj-css-error { -- cgit v1.2.3 From df018322f823392fd7da56a42cddcab5473b0f0a Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 31 Jan 2012 08:57:57 +0800 Subject: Adding the version to the main Ninja reel component. Signed-off-by: Valerio Virgillito --- js/ninja.reel/ninja.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'js') diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js index 75ec7fcc..465533cd 100644 --- a/js/ninja.reel/ninja.js +++ b/js/ninja.reel/ninja.js @@ -13,6 +13,10 @@ exports.Ninja = Montage.create(Component, { _appLoaded: { value: false }, _preload: { value: false }, + ninjaVersion: { + value: window.ninjaVersion.ninja.version + }, + toolsData: { value: null }, appData: { value: AppData }, @@ -36,7 +40,7 @@ exports.Ninja = Montage.create(Component, { prepareForDraw: { value: function() { - console.log("Loading Ninja --> ", window.ninjaVersion.ninja.version); + console.log("Loading Ninja --> ", this.ninjaVersion); this.application.ninja = this; -- cgit v1.2.3 From 4aac9e06107e9f8fa32f2dcd2f0addb382fc1f6c Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Mon, 30 Jan 2012 16:35:59 -0800 Subject: Adding a version json object to Ninja Versions object to start keeping track of versions for Ninja, Montage and eventually other dependencies. Loaded before montage to use in the splash screen. Signed-off-by: Valerio Virgillito --- js/ninja.reel/ninja.js | 1 + 1 file changed, 1 insertion(+) (limited to 'js') diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js index bc31e0e1..75ec7fcc 100644 --- a/js/ninja.reel/ninja.js +++ b/js/ninja.reel/ninja.js @@ -36,6 +36,7 @@ exports.Ninja = Montage.create(Component, { prepareForDraw: { value: function() { + console.log("Loading Ninja --> ", window.ninjaVersion.ninja.version); this.application.ninja = this; -- cgit v1.2.3 From b9881840e83acbc2d816a9ede66f7fc2d3c3de59 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Mon, 30 Jan 2012 16:36:31 -0800 Subject: Code cleanup - Removed extra log. Signed-off-by: Valerio Virgillito --- js/preloader/Preloader.js | 1 - 1 file changed, 1 deletion(-) (limited to 'js') diff --git a/js/preloader/Preloader.js b/js/preloader/Preloader.js index f137f4b6..93d71e8f 100755 --- a/js/preloader/Preloader.js +++ b/js/preloader/Preloader.js @@ -136,7 +136,6 @@ exports.Preloader = Montage.create(Component, { deserializedFromTemplate: { value: function() { - console.log("Start Preloading"); this.filesTotal = this.ninjaJsRequire.length + this.ninjaCssRequire.length; -- cgit v1.2.3 From 43d53af9cade33cff20601dfbce8a16d7212fe20 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 31 Jan 2012 08:57:57 +0800 Subject: Adding the version to the main Ninja reel component. Signed-off-by: Valerio Virgillito --- js/ninja.reel/ninja.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'js') diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js index 75ec7fcc..465533cd 100644 --- a/js/ninja.reel/ninja.js +++ b/js/ninja.reel/ninja.js @@ -13,6 +13,10 @@ exports.Ninja = Montage.create(Component, { _appLoaded: { value: false }, _preload: { value: false }, + ninjaVersion: { + value: window.ninjaVersion.ninja.version + }, + toolsData: { value: null }, appData: { value: AppData }, @@ -36,7 +40,7 @@ exports.Ninja = Montage.create(Component, { prepareForDraw: { value: function() { - console.log("Loading Ninja --> ", window.ninjaVersion.ninja.version); + console.log("Loading Ninja --> ", this.ninjaVersion); this.application.ninja = this; -- cgit v1.2.3 From 6066b9bda2990c9d6b4311d221b0d0c773b20f60 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 31 Jan 2012 10:28:39 -0800 Subject: Merging Jose's colorchip change. Signed-off-by: Nivesh Rajbhandari --- js/panels/Color/colorchippopup.reel/colorchippopup.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js') diff --git a/js/panels/Color/colorchippopup.reel/colorchippopup.js b/js/panels/Color/colorchippopup.reel/colorchippopup.js index 03e14b28..05bcb447 100644 --- a/js/panels/Color/colorchippopup.reel/colorchippopup.js +++ b/js/panels/Color/colorchippopup.reel/colorchippopup.js @@ -109,7 +109,7 @@ exports.ColorChipPopup = Montage.create(Component, { this.cc_hexinput.labelFunction = this._hexLabel.bind(this); this.cc_hexinput.inputFunction = this._hexInput.bind(this); // - if (this.application.ninja.colorController.colorView.currentChip && this.application.ninja.colorController.colorView.currentChip.colorValue.a) { + if (this.application.ninja.colorController.colorView.currentChip && this.application.ninja.colorController.colorView.currentChip.colorValue && this.application.ninja.colorController.colorView.currentChip.colorValue.a) { this.combo.slider.value = Math.round(this.application.ninja.colorController.colorView.currentChip.colorValue.a*100); } else { this.combo.slider.value = 100; -- cgit v1.2.3 From 12371bb25ca51286c19a426611d9b7db369bec87 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 31 Jan 2012 11:09:21 -0800 Subject: Support stage in PI's 3d section. Signed-off-by: Nivesh Rajbhandari --- .../sections/three-d-view.reel/three-d-view.js | 63 ++++++++++++++-------- 1 file changed, 41 insertions(+), 22 deletions(-) (limited to 'js') diff --git a/js/panels/properties/sections/three-d-view.reel/three-d-view.js b/js/panels/properties/sections/three-d-view.reel/three-d-view.js index 38dbb110..dda9f993 100644 --- a/js/panels/properties/sections/three-d-view.reel/three-d-view.js +++ b/js/panels/properties/sections/three-d-view.reel/three-d-view.js @@ -40,19 +40,16 @@ exports.ThreeD = Montage.create(Component, { else { this.inGlobalMode = true; - if(this.application.ninja.selectedElements.length) + var item = this.item; + if(item) { - var item = this.application.ninja.selectedElements[0]._element; - if(item) - { - this.x3D = item.elementModel.props3D.x3D; - this.y3D = item.elementModel.props3D.y3D; - this.z3D = item.elementModel.props3D.z3D; - - this.xAngle = item.elementModel.props3D.xAngle; - this.yAngle = item.elementModel.props3D.yAngle; - this.zAngle = item.elementModel.props3D.zAngle; - } + this.x3D = item.elementModel.props3D.x3D; + this.y3D = item.elementModel.props3D.y3D; + this.z3D = item.elementModel.props3D.z3D; + + this.xAngle = item.elementModel.props3D.xAngle; + this.yAngle = item.elementModel.props3D.yAngle; + this.zAngle = item.elementModel.props3D.zAngle; } } } @@ -98,6 +95,10 @@ exports.ThreeD = Montage.create(Component, { } }, + item: { + value: null + }, + handleChange: { value: function(event) { if(event.wasSetByCode) { @@ -106,7 +107,7 @@ exports.ThreeD = Montage.create(Component, { this.apply3DProperties(event.currentTarget.identifier, event.currentTarget, - this.application.ninja.selectedElements[0]._element, + this.item, this.inGlobalMode, false); } @@ -120,7 +121,7 @@ exports.ThreeD = Montage.create(Component, { this.apply3DProperties(event.currentTarget.identifier, event.currentTarget, - this.application.ninja.selectedElements[0]._element, + this.item, this.inGlobalMode, true); } @@ -128,9 +129,8 @@ exports.ThreeD = Montage.create(Component, { apply3DProperties : { value : function(prop, value, item, inGlobalMode, isChanging){ - // TODO - May want to use mediator instead - var curMat = item.elementModel.props3D.matrix3d; - var delta = value.value - item.elementModel.props3D[prop]; + var curMat = this.application.ninja.elementMediator.getMatrix(item); + var delta = value.value - this.application.ninja.elementMediator.get3DProperty(item, prop); var xFormMat = Matrix.I(4); switch (prop) @@ -183,12 +183,31 @@ exports.ThreeD = Montage.create(Component, { templateDidLoad : { value: function() { - Object.defineBinding(this, "axisMode", { - boundObject: this.axisModeGroupControl, - boundObjectPropertyPath: "selectedIndex", - oneway: false - }); + Object.defineBinding(this, "axisMode", { + boundObject: this.axisModeGroupControl, + boundObjectPropertyPath: "selectedIndex", + oneway: false + }); + + Object.defineBinding(this, "item", { + boundObject: this, + boundObjectPropertyPath: "application.ninja.selectedElements", + boundValueMutator: this._getSelectedItem + }); + } + }, + _getSelectedItem: { + value: function(els) + { + if(els.length) + { + return els[0]._element || els[0]; + } + else + { + return this.boundObject.application.ninja.currentDocument.documentRoot; + } } }, -- cgit v1.2.3 From 1d8af9fb2be85c33ce6a846f97360ba2ee17ea23 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 31 Jan 2012 01:54:55 +0800 Subject: Checkbox and Combobox change/changing events were not setting wasSetByCode property correctly, causing our PI to dispatch events at improper times. Signed-off-by: Nivesh Rajbhandari --- js/components/combobox.reel/combobox.js | 2 +- js/components/radio.reel/radio.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'js') diff --git a/js/components/combobox.reel/combobox.js b/js/components/combobox.reel/combobox.js index f262bb06..a68a7d6b 100644 --- a/js/components/combobox.reel/combobox.js +++ b/js/components/combobox.reel/combobox.js @@ -67,7 +67,7 @@ exports.Combobox = Montage.create(Component, { var e = document.createEvent("CustomEvent"); e.initEvent("change", true, true); e.type = "change"; - e._wasSetByCode = this._wasSetByCode; + e.wasSetByCode = this._wasSetByCode; e.value = this._value; this.dispatchEvent(e); diff --git a/js/components/radio.reel/radio.js b/js/components/radio.reel/radio.js index 954da3c4..c661ec11 100644 --- a/js/components/radio.reel/radio.js +++ b/js/components/radio.reel/radio.js @@ -41,7 +41,7 @@ exports.RadioGroup = Montage.create(Component, { e = document.createEvent("CustomEvent"); e.initEvent("change", true, true); e.type = "change"; - e._wasSetByCode = this._wasSetByCode; + e.wasSetByCode = this._wasSetByCode; e.selectedIndex = i; e.selectedItem = value; this.dispatchEvent(e); @@ -77,7 +77,7 @@ exports.RadioGroup = Montage.create(Component, { { value:function(event) { - this._wasSetByCode = event._event._wasSetByCode; + this._wasSetByCode = event._event.wasSetByCode; this.selectedItem = event._event.value; } } @@ -126,7 +126,7 @@ exports.Radio = Montage.create(Component, { var e = document.createEvent("CustomEvent"); e.initEvent("change", true, true); e.type = "change"; - e._wasSetByCode = this._wasSetByCode; + e.wasSetByCode = this._wasSetByCode; e.value = this; this.dispatchEvent(e); -- cgit v1.2.3 From c0f43749523f4720ca4c8942fa9ac17753d93a67 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 31 Jan 2012 15:01:04 -0800 Subject: Fixing 3d section of the PI. Signed-off-by: Nivesh Rajbhandari --- js/controllers/elements/element-controller.js | 2 +- .../sections/three-d-view.reel/three-d-view.html | 12 +++++----- .../sections/three-d-view.reel/three-d-view.js | 27 ++++++++++++++++++++-- 3 files changed, 32 insertions(+), 9 deletions(-) (limited to 'js') diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index 30469db0..f2b54014 100644 --- a/js/controllers/elements/element-controller.js +++ b/js/controllers/elements/element-controller.js @@ -206,7 +206,7 @@ var ElementController = exports.ElementController = Montage.create(NJComponent, el.elementModel.props3D.matrix3d = mat; el.elementModel.props3D.perspectiveDist = dist; -// if(update3DModel) + if(update3DModel) { this._update3DProperties(el, mat, dist); } diff --git a/js/panels/properties/sections/three-d-view.reel/three-d-view.html b/js/panels/properties/sections/three-d-view.reel/three-d-view.html index 1e24cb55..11a5b3f2 100644 --- a/js/panels/properties/sections/three-d-view.reel/three-d-view.html +++ b/js/panels/properties/sections/three-d-view.reel/three-d-view.html @@ -39,7 +39,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot "value": { "boundObject": {"@": "owner"}, "boundObjectPropertyPath": "x3D", - "oneway": false + "oneway": true } }, "listeners": [ @@ -68,7 +68,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot "value": { "boundObject": {"@": "owner"}, "boundObjectPropertyPath": "y3D", - "oneway": false + "oneway": true } }, "listeners": [ @@ -97,7 +97,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot "value": { "boundObject": {"@": "owner"}, "boundObjectPropertyPath": "z3D", - "oneway": false + "oneway": true } }, "listeners": [ @@ -128,7 +128,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot "value": { "boundObject": {"@": "owner"}, "boundObjectPropertyPath": "xAngle", - "oneway": false + "oneway": true } }, "listeners": [ @@ -159,7 +159,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot "value": { "boundObject": {"@": "owner"}, "boundObjectPropertyPath": "yAngle", - "oneway": false + "oneway": true } }, "listeners": [ @@ -190,7 +190,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot "value": { "boundObject": {"@": "owner"}, "boundObjectPropertyPath": "zAngle", - "oneway": false + "oneway": true } }, "listeners": [ diff --git a/js/panels/properties/sections/three-d-view.reel/three-d-view.js b/js/panels/properties/sections/three-d-view.reel/three-d-view.js index dda9f993..96053490 100644 --- a/js/panels/properties/sections/three-d-view.reel/three-d-view.js +++ b/js/panels/properties/sections/three-d-view.reel/three-d-view.js @@ -99,6 +99,14 @@ exports.ThreeD = Montage.create(Component, { value: null }, + _curMat: { + value: null + }, + + _curProp: { + value: null + }, + handleChange: { value: function(event) { if(event.wasSetByCode) { @@ -110,6 +118,9 @@ exports.ThreeD = Montage.create(Component, { this.item, this.inGlobalMode, false); + + this._curMat = null; + this._curProp = null; } }, @@ -129,8 +140,20 @@ exports.ThreeD = Montage.create(Component, { apply3DProperties : { value : function(prop, value, item, inGlobalMode, isChanging){ - var curMat = this.application.ninja.elementMediator.getMatrix(item); - var delta = value.value - this.application.ninja.elementMediator.get3DProperty(item, prop); + if(!this._curMat) + { + this._curMat = this.application.ninja.elementMediator.getMatrix(item); + } + var curMat = this._curMat; + var delta = value.value; + if(inGlobalMode) + { + if(!this._curProp) + { + this._curProp = this.application.ninja.elementMediator.get3DProperty(item, prop); + } + delta -= this._curProp; + } var xFormMat = Matrix.I(4); switch (prop) -- cgit v1.2.3 From b01b586a26ae47d329bdd5fe005051513711fab7 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 31 Jan 2012 15:11:04 -0800 Subject: Fixing the bread-crumb background The CSS cleanup added a background to the bottom panel container which broke the bread-crumb background. Fixing by adding the background directly to the bread-crumb component. Signed-off-by: Valerio Virgillito --- js/components/layout/bread-crumb.reel/bread-crumb.css | 1 + 1 file changed, 1 insertion(+) (limited to 'js') diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.css b/js/components/layout/bread-crumb.reel/bread-crumb.css index f84c6e80..cc984609 100644 --- a/js/components/layout/bread-crumb.reel/bread-crumb.css +++ b/js/components/layout/bread-crumb.reel/bread-crumb.css @@ -5,6 +5,7 @@ */ .bread_crumb{ + background-color: #282828; border-style: double; height: 26px; } -- cgit v1.2.3 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 +- js/mediators/element-mediator.js | 2 +- js/models/color-model.js | 4 +- 5 files changed, 59 insertions(+), 89 deletions(-) (limited to 'js') 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); diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js index 91b09475..4c34e668 100644 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js @@ -457,7 +457,7 @@ exports.ElementMediator = Montage.create(NJComponent, { if(!currentValue) { var that = this; currentValue = els.map(function(item) { - return that.getColor(item._element); + return that.getColor(item._element, isFill); }); } diff --git a/js/models/color-model.js b/js/models/color-model.js index 7e5fee1f..b06281f8 100644 --- a/js/models/color-model.js +++ b/js/models/color-model.js @@ -415,8 +415,10 @@ exports.ColorModel = Montage.create(Component, { colorEvent.alpha = this.alpha.value; if (this.hsl) colorEvent.hsla = {h: this.hsl.h, s: this.hsl.s, l: this.hsl.l, a: this.alpha.value, css: 'hsla('+this.hsl.h+', '+this.hsl.s+'%, '+this.hsl.l+'%, '+this.alpha.value+')'}; - if (this.rgb) + if (this.rgb) { colorEvent.rgba = {r: this.rgb.r, g: this.rgb.g, b: this.rgb.b, a: this.alpha.value, css: 'rgba('+ this.rgb.r +', '+this.rgb.g+', '+this.rgb.b+', '+this.alpha.value+')'}; + colorEvent.webGlColor = [this.rgb.r/255, this.rgb.g/255, this.rgb.b/255, this.alpha.value]; + } if (this.hex) colorEvent.hex = this.hex; //Standard values that apply to any event -- cgit v1.2.3 From 5233508614656c529d6c596f7e2f2c24adce9b69 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Mon, 30 Jan 2012 15:18:50 -0800 Subject: IKNINJA-1083 Fixing minor bug with no color breaking on null alpha value. --- js/panels/Color/colorchippopup.reel/colorchippopup.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js') diff --git a/js/panels/Color/colorchippopup.reel/colorchippopup.js b/js/panels/Color/colorchippopup.reel/colorchippopup.js index 03e14b28..05bcb447 100644 --- a/js/panels/Color/colorchippopup.reel/colorchippopup.js +++ b/js/panels/Color/colorchippopup.reel/colorchippopup.js @@ -109,7 +109,7 @@ exports.ColorChipPopup = Montage.create(Component, { this.cc_hexinput.labelFunction = this._hexLabel.bind(this); this.cc_hexinput.inputFunction = this._hexInput.bind(this); // - if (this.application.ninja.colorController.colorView.currentChip && this.application.ninja.colorController.colorView.currentChip.colorValue.a) { + if (this.application.ninja.colorController.colorView.currentChip && this.application.ninja.colorController.colorView.currentChip.colorValue && this.application.ninja.colorController.colorView.currentChip.colorValue.a) { this.combo.slider.value = Math.round(this.application.ninja.colorController.colorView.currentChip.colorValue.a*100); } else { this.combo.slider.value = 100; -- cgit v1.2.3 From 2e24eaa71b260fd11632d8a124874b238c9aa82a Mon Sep 17 00:00:00 2001 From: Jon Reid Date: Wed, 1 Feb 2012 16:02:37 -0800 Subject: Delete unneeded compass log file (IKNINJA 1101). Update base styles for better colors on HTML buttons. Change project panel so it shows no project by default. --- js/panels/Project/projectpanelbase.reel/ProjectPanelBase.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js') diff --git a/js/panels/Project/projectpanelbase.reel/ProjectPanelBase.js b/js/panels/Project/projectpanelbase.reel/ProjectPanelBase.js index 31582153..e5173005 100644 --- a/js/panels/Project/projectpanelbase.reel/ProjectPanelBase.js +++ b/js/panels/Project/projectpanelbase.reel/ProjectPanelBase.js @@ -577,11 +577,11 @@ exports.ProjectPanelBase = (require("montage/core/core").Montage).create(require arrLinkedScrollersLength = arrLinkedScrollers.length, i = 0, that = this; - + /* if (this.firstTimeDraw) { this.hasActiveProject="large"; } - + */ if (!this.hasActiveProject) { -- cgit v1.2.3 From f07bbfaa60c3fb7c2412c5aa97b49d114d6a88ea Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 1 Feb 2012 16:43:08 -0800 Subject: Adding njUtils as a component and adding it to the application object Signed-off-by: Valerio Virgillito --- js/lib/nj-utils.js | 214 +++++++++++++++++++++++++++++++++++++++++++++++ js/ninja.reel/ninja.html | 8 +- js/ninja.reel/ninja.js | 2 + 3 files changed, 223 insertions(+), 1 deletion(-) create mode 100644 js/lib/nj-utils.js (limited to 'js') diff --git a/js/lib/nj-utils.js b/js/lib/nj-utils.js new file mode 100644 index 00000000..59ea6095 --- /dev/null +++ b/js/lib/nj-utils.js @@ -0,0 +1,214 @@ +/* +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. +
*/ + +var Montage = require("montage/core/core").Montage, + Component = require("montage/ui/component").Component, + ElementModel = require("js/models/element-model").ElementModel, + Properties3D = require("js/models/properties-3d").Properties3D, + ShapeModel = require("js/models/shape-model").ShapeModel, + ControllerFactory = require("js/controllers/elements/controller-factory").ControllerFactory; + +exports.NJUtils = Montage.create( Component, { + + + + /* =============== DOM Access ================ */ + + ///// Quick "getElementById" + $ : { + value: function(id) { + return document.getElementById(id); + } + }, + + ///// Quick "getElementsByClassName" which also returns as an Array + ///// Can return as NodeList by passing true as second argument + $$ : { + value: function(className, asNodeList) { + var list = document.getElementsByClassName(className); + return (asNodeList) ? list : this.toArray(list); + } + }, + + ///// Get child nodes of element + ///// Omit filter to only return element nodes + ///// Pass in filter function to minimize collection, or + ///// set to true to include all nodes + children : { + value : function(el, filter) { + var f = filter || function(item) { + return item.nodeType === 1; + }; + return this.toArr