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/tools/LineTool.js | 4 ++++ js/tools/OvalTool.js | 8 ++++++++ js/tools/RectTool.js | 8 ++++++++ 3 files changed, 20 insertions(+) (limited to 'js/tools') diff --git a/js/tools/LineTool.js b/js/tools/LineTool.js index 042ba0b2..a0d5a182 100644 --- a/js/tools/LineTool.js +++ b/js/tools/LineTool.js @@ -225,6 +225,10 @@ exports.LineTool = Montage.create(ShapeTool, { canvas.elementModel.pi = "LinePi"; canvas.elementModel.shapeModel.strokeSize = this.options.strokeSize.value + " " + this.options.strokeSize.units; canvas.elementModel.shapeModel.stroke = strokeColor; + if(strokeColor) + { + canvas.elementModel.shapeModel.border = this.application.ninja.colorController.colorToolbar.stroke; + } canvas.elementModel.shapeModel.strokeMaterial = strokeMaterial; canvas.elementModel.shapeModel.strokeMaterialIndex = strokeIndex; diff --git a/js/tools/OvalTool.js b/js/tools/OvalTool.js index e0f1f03f..2fa5411b 100644 --- a/js/tools/OvalTool.js +++ b/js/tools/OvalTool.js @@ -75,6 +75,14 @@ exports.OvalTool = Montage.create(ShapeTool, { canvas.elementModel.shapeModel.strokeSize = this.options.strokeSize.value + " " + this.options.strokeSize.units; canvas.elementModel.shapeModel.stroke = strokeColor; canvas.elementModel.shapeModel.fill = fillColor; + if(strokeColor) + { + canvas.elementModel.shapeModel.border = this.application.ninja.colorController.colorToolbar.stroke; + } + if(fillColor) + { + canvas.elementModel.shapeModel.background = this.application.ninja.colorController.colorToolbar.fill; + } canvas.elementModel.shapeModel.innerRadius = this.options.innerRadius.value + " " + this.options.innerRadius.units; diff --git a/js/tools/RectTool.js b/js/tools/RectTool.js index fbf1693e..94d80b53 100644 --- a/js/tools/RectTool.js +++ b/js/tools/RectTool.js @@ -94,6 +94,14 @@ exports.RectTool = Montage.create(ShapeTool, { canvas.elementModel.shapeModel.strokeSize = this.options.strokeSize.value + " " + this.options.strokeSize.units; canvas.elementModel.shapeModel.stroke = strokeColor; canvas.elementModel.shapeModel.fill = fillColor; + if(strokeColor) + { + canvas.elementModel.shapeModel.border = this.application.ninja.colorController.colorToolbar.stroke; + } + if(fillColor) + { + canvas.elementModel.shapeModel.background = this.application.ninja.colorController.colorToolbar.fill; + } canvas.elementModel.shapeModel.tlRadius = this.options.TLRadiusControl.value + " " + this.options.TLRadiusControl.units; canvas.elementModel.shapeModel.trRadius = this.options.TRRadiusControl.value + " " + this.options.TRRadiusControl.units; -- 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/tools/FillTool.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'js/tools') diff --git a/js/tools/FillTool.js b/js/tools/FillTool.js index 477966da..fabcec69 100644 --- a/js/tools/FillTool.js +++ b/js/tools/FillTool.js @@ -54,10 +54,24 @@ exports.FillTool = Montage.create(ModifierToolBase, { value: function(event) { this.isDrawing = true; - if(this._canColor) + if(this._canColor && this.application.ninja.selectedElements.length) { - var color = this.application.ninja.colorController.colorToolbar.fill; - ElementsMediator.setColor(this.application.ninja.selectedElements, color, true, "Change", "fillTool"); + var color = this.application.ninja.colorController.colorToolbar.fill, + colorInfo; + if(color && color.color) + { + colorInfo = { mode:color.colorMode, + color:color.color + }; + ElementsMediator.setColor(this.application.ninja.selectedElements, colorInfo, true, "Change", "fillTool"); + } + else + { + colorInfo = { mode:"nocolor", + color:color.color + }; + ElementsMediator.setColor(this.application.ninja.selectedElements, colorInfo, true, "Change", "fillTool"); + } } } } -- cgit v1.2.3 From 4b8eb7442b41db7e06b639ba4a31bb7664209159 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Fri, 3 Feb 2012 15:23:08 -0800 Subject: Update element planes after shapes are created so stage grid updates. Signed-off-by: Nivesh Rajbhandari --- js/tools/LineTool.js | 1 + js/tools/ShapeTool.js | 1 + 2 files changed, 2 insertions(+) (limited to 'js/tools') diff --git a/js/tools/LineTool.js b/js/tools/LineTool.js index a0d5a182..17157f23 100644 --- a/js/tools/LineTool.js +++ b/js/tools/LineTool.js @@ -99,6 +99,7 @@ exports.LineTool = Montage.create(ShapeTool, { } this.RenderShape(w, h, drawData.planeMat, drawData.midPt, canvas, slope, xAdj, yAdj); + NJevent("elementAdded", canvas); } this.endDraw(event); diff --git a/js/tools/ShapeTool.js b/js/tools/ShapeTool.js index 9a4399b4..4ccb7a8d 100644 --- a/js/tools/ShapeTool.js +++ b/js/tools/ShapeTool.js @@ -83,6 +83,7 @@ exports.ShapeTool = Montage.create(DrawingTool, { } } this.RenderShape(drawData.width, drawData.height, drawData.planeMat, drawData.midPt, canvas); + NJevent("elementAdded", canvas); } this.endDraw(event); -- 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/tools/LineTool.js | 1 + js/tools/OvalTool.js | 1 + js/tools/RectTool.js | 1 + 3 files changed, 3 insertions(+) (limited to 'js/tools') diff --git a/js/tools/LineTool.js b/js/tools/LineTool.js index 17157f23..6a948fd8 100644 --- a/js/tools/LineTool.js +++ b/js/tools/LineTool.js @@ -238,6 +238,7 @@ exports.LineTool = Montage.create(ShapeTool, { canvas.elementModel.shapeModel.strokeStyle = strokeStyle; canvas.elementModel.shapeModel.GLGeomObj = line; + canvas.elementModel.shapeModel.useWebGl = this.options.use3D; } else { diff --git a/js/tools/OvalTool.js b/js/tools/OvalTool.js index 2fa5411b..446c6754 100644 --- a/js/tools/OvalTool.js +++ b/js/tools/OvalTool.js @@ -95,6 +95,7 @@ exports.OvalTool = Montage.create(ShapeTool, { canvas.elementModel.shapeModel.strokeStyle = strokeStyle; canvas.elementModel.shapeModel.GLGeomObj = oval; + canvas.elementModel.shapeModel.useWebGl = this.options.use3D; } else { diff --git a/js/tools/RectTool.js b/js/tools/RectTool.js index 94d80b53..6109ee4d 100644 --- a/js/tools/RectTool.js +++ b/js/tools/RectTool.js @@ -117,6 +117,7 @@ exports.RectTool = Montage.create(ShapeTool, { canvas.elementModel.shapeModel.strokeStyle = strokeStyle; canvas.elementModel.shapeModel.GLGeomObj = rect; + canvas.elementModel.shapeModel.useWebGl = this.options.use3D; } else { -- cgit v1.2.3 From 486842239c71e7964f38a09aacda4970f2a82e1a Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 7 Feb 2012 10:58:14 -0800 Subject: Updated tools and PI to get/set materials by binding to appModel's materials property. This requires us to add FlatMaterial to the list of materials in the MaterialsLibrary. Signed-off-by: Nivesh Rajbhandari --- js/tools/LineTool.js | 7 +++---- js/tools/OvalTool.js | 14 ++++++-------- js/tools/RectTool.js | 14 ++++++-------- 3 files changed, 15 insertions(+), 20 deletions(-) (limited to 'js/tools') diff --git a/js/tools/LineTool.js b/js/tools/LineTool.js index 6a948fd8..99c374a7 100644 --- a/js/tools/LineTool.js +++ b/js/tools/LineTool.js @@ -203,10 +203,10 @@ exports.LineTool = Montage.create(ShapeTool, { // for default stroke and fill/no materials var strokeMaterial = null; - var strokeIndex = parseInt(this.options.strokeMaterial); - if(strokeIndex > 0) + var strokeM = this.options.strokeMaterial; + if(strokeM) { - strokeMaterial = Object.create(MaterialsLibrary.getMaterialAt(strokeIndex-1)); + strokeMaterial = Object.create(MaterialsLibrary.getMaterial(strokeM)); } var world = this.getGLWorld(canvas, this.options.use3D); @@ -232,7 +232,6 @@ exports.LineTool = Montage.create(ShapeTool, { } canvas.elementModel.shapeModel.strokeMaterial = strokeMaterial; - canvas.elementModel.shapeModel.strokeMaterialIndex = strokeIndex; canvas.elementModel.shapeModel.strokeStyleIndex = strokeStyleIndex; canvas.elementModel.shapeModel.strokeStyle = strokeStyle; diff --git a/js/tools/OvalTool.js b/js/tools/OvalTool.js index 446c6754..14655312 100644 --- a/js/tools/OvalTool.js +++ b/js/tools/OvalTool.js @@ -43,16 +43,16 @@ exports.OvalTool = Montage.create(ShapeTool, { var strokeMaterial = null; var fillMaterial = null; - var strokeIndex = parseInt(this.options.strokeMaterial); - if(strokeIndex > 0) + var strokeM = this.options.strokeMaterial; + if(strokeM) { - strokeMaterial = Object.create(MaterialsLibrary.getMaterialAt(strokeIndex-1)); + strokeMaterial = Object.create(MaterialsLibrary.getMaterial(strokeM)); } - var fillIndex = parseInt(this.options.fillMaterial); - if(fillIndex > 0) + var fillM = this.options.fillMaterial; + if(fillM) { - fillMaterial = Object.create(MaterialsLibrary.getMaterialAt(fillIndex-1)); + fillMaterial = Object.create(MaterialsLibrary.getMaterial(fillM)); } @@ -88,8 +88,6 @@ exports.OvalTool = Montage.create(ShapeTool, { canvas.elementModel.shapeModel.strokeMaterial = strokeMaterial; canvas.elementModel.shapeModel.fillMaterial = fillMaterial; - canvas.elementModel.shapeModel.strokeMaterialIndex = strokeIndex; - canvas.elementModel.shapeModel.fillMaterialIndex = fillIndex; canvas.elementModel.shapeModel.strokeStyleIndex = strokeStyleIndex; canvas.elementModel.shapeModel.strokeStyle = strokeStyle; diff --git a/js/tools/RectTool.js b/js/tools/RectTool.js index 6109ee4d..31ac7faa 100644 --- a/js/tools/RectTool.js +++ b/js/tools/RectTool.js @@ -62,16 +62,16 @@ exports.RectTool = Montage.create(ShapeTool, { var strokeMaterial = null; var fillMaterial = null; - var strokeIndex = parseInt(this.options.strokeMaterial); - if(strokeIndex > 0) + var strokeM = this.options.strokeMaterial; + if(strokeM) { - strokeMaterial = Object.create(MaterialsLibrary.getMaterialAt(strokeIndex-1)); + strokeMaterial = Object.create(MaterialsLibrary.getMaterial(strokeM)); } - var fillIndex = parseInt(this.options.fillMaterial); - if(fillIndex > 0) + var fillM = this.options.fillMaterial; + if(fillM) { - fillMaterial = Object.create(MaterialsLibrary.getMaterialAt(fillIndex-1)); + fillMaterial = Object.create(MaterialsLibrary.getMaterial(fillM)); } var world = this.getGLWorld(canvas, this.options.use3D); @@ -110,8 +110,6 @@ exports.RectTool = Montage.create(ShapeTool, { canvas.elementModel.shapeModel.strokeMaterial = strokeMaterial; canvas.elementModel.shapeModel.fillMaterial = fillMaterial; - canvas.elementModel.shapeModel.strokeMaterialIndex = strokeIndex; - canvas.elementModel.shapeModel.fillMaterialIndex = fillIndex; canvas.elementModel.shapeModel.strokeStyleIndex = strokeStyleIndex; canvas.elementModel.shapeModel.strokeStyle = strokeStyle; -- cgit v1.2.3 From 65145cebdf4cde2767cbd0489ddcea5863c2ca9e Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 7 Feb 2012 14:53:46 -0800 Subject: IKNINJA-964 - Fixed inconsistent element name in PI/CSS panel. Signed-off-by: Valerio Virgillito --- js/tools/TagTool.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'js/tools') diff --git a/js/tools/TagTool.js b/js/tools/TagTool.js index c527edf3..73a0ae5c 100644 --- a/js/tools/TagTool.js +++ b/js/tools/TagTool.js @@ -158,15 +158,15 @@ exports.TagTool = Montage.create(DrawingTool, { selectedTag = this.options.selectedElement; if(selectedTag === "divTool") { - newTag = NJUtils.makeNJElement("div", "Div", "block"); + newTag = NJUtils.makeNJElement("div", "div", "block"); } else if(selectedTag === "imageTool") { - newTag = NJUtils.makeNJElement("image", "Image", "image"); + newTag = NJUtils.makeNJElement("image", "image", "image"); } else if(selectedTag === "videoTool") { - newTag = NJUtils.makeNJElement("video", "Video", "video", { + newTag = NJUtils.makeNJElement("video", "video", "video", { innerHTML: "Your browser does not support the VIDEO element." }); } else if(selectedTag === "canvasTool") { - newTag = NJUtils.makeNJElement("canvas", "Canvas", "canvas"); + newTag = NJUtils.makeNJElement("canvas", "canvas", "canvas"); } else if(selectedTag === "customTool") { newTag = document.createElement(this.options.customName.value); newTag.Ninja = {}; -- cgit v1.2.3 From 9a404b8a717d0aac0eabb828a4d3cdc8c9c3eed8 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 7 Feb 2012 17:42:04 -0800 Subject: IKNINJA - 1084: Fixing the custom tag. Signed-off-by: Valerio Virgillito --- js/tools/TagTool.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'js/tools') diff --git a/js/tools/TagTool.js b/js/tools/TagTool.js index 73a0ae5c..e3f49bbe 100644 --- a/js/tools/TagTool.js +++ b/js/tools/TagTool.js @@ -168,9 +168,7 @@ exports.TagTool = Montage.create(DrawingTool, { } else if(selectedTag === "canvasTool") { newTag = NJUtils.makeNJElement("canvas", "canvas", "canvas"); } else if(selectedTag === "customTool") { - newTag = document.createElement(this.options.customName.value); - newTag.Ninja = {}; - newTag.Ninja.selectionType = this.options.customName.value; + newTag = NJUtils.makeNJElement(this.options.customName.value, this.options.customName.value, "block"); } /* SWF Tag tool - Not used for now. Will revisit this at a later time. else if(selectedTag === "flashTool") { -- cgit v1.2.3