From 1a759361b82127f9d5c1428dc889fffdf2daaf86 Mon Sep 17 00:00:00 2001
From: John Mayhew
Date: Thu, 3 May 2012 15:11:56 -0700
Subject: First round of moving color chips into the sub tools. Shape and Pen
tool now have chips in the sub tool bar. Still need to complete adding chips
to the Brush tool and finalizing the subtool bar layout to our spec for all
of the subtools.
---
js/tools/BrushTool.js | 2 +-
js/tools/LineTool.js | 6 +++---
js/tools/OvalTool.js | 4 ++--
js/tools/PenTool.js | 4 ++--
js/tools/RectTool.js | 4 ++--
5 files changed, 10 insertions(+), 10 deletions(-)
(limited to 'js/tools')
diff --git a/js/tools/BrushTool.js b/js/tools/BrushTool.js
index ded56ecc..7e5e0630 100644
--- a/js/tools/BrushTool.js
+++ b/js/tools/BrushTool.js
@@ -132,7 +132,7 @@ exports.BrushTool = Montage.create(ShapeTool, {
if (this._selectedBrushStroke === null){
this._selectedBrushStroke = new BrushStroke();
var colorArray=[0,0,0,0];
- var color = this.application.ninja.colorController.colorToolbar.fill.color;
+ var color = this.options.fill.color;
if (color){
colorArray = [color.r/255, color.g/255, color.b/255, color.a];
} else {
diff --git a/js/tools/LineTool.js b/js/tools/LineTool.js
index 3e9167fd..92352880 100755
--- a/js/tools/LineTool.js
+++ b/js/tools/LineTool.js
@@ -44,8 +44,8 @@ exports.LineTool = Montage.create(ShapeTool, {
}
this._strokeSize = ShapesController.GetValueInPixels(this.options.strokeSize.value, this.options.strokeSize.units, null);
- if (this.application.ninja.colorController.colorToolbar.stroke.color)
- this._strokeColor = this.application.ninja.colorController.colorToolbar.stroke.color.css;
+ if (this.options.stroke.color)
+ this._strokeColor = this.options.stroke.color.css;
else
this._strokeColor = [0,0,0,1];
this.startDraw(event);
@@ -214,7 +214,7 @@ exports.LineTool = Montage.create(ShapeTool, {
var left = Math.round(midPt[0] - 0.5*w);
var top = Math.round(midPt[1] - 0.5*h);
- var strokeColor = this.application.ninja.colorController.colorToolbar.stroke.webGlColor;
+ var strokeColor = this.options.stroke.webGlColor;
// for default stroke and fill/no materials
var strokeMaterial = null;
diff --git a/js/tools/OvalTool.js b/js/tools/OvalTool.js
index 6edec811..f1da3a46 100755
--- a/js/tools/OvalTool.js
+++ b/js/tools/OvalTool.js
@@ -39,8 +39,8 @@ exports.OvalTool = Montage.create(ShapeTool, {
var innerRadius = this.options.innerRadius.value / 100;
- var strokeColor = this.application.ninja.colorController.colorToolbar.stroke.webGlColor;
- var fillColor = this.application.ninja.colorController.colorToolbar.fill.webGlColor;
+ var strokeColor = this.options.stroke.webGlColor;
+ var fillColor = this.options.fill.webGlColor;
// for default stroke and fill/no materials
var strokeMaterial = null;
diff --git a/js/tools/PenTool.js b/js/tools/PenTool.js
index 8ecc9f79..83d0c8d2 100755
--- a/js/tools/PenTool.js
+++ b/js/tools/PenTool.js
@@ -240,7 +240,7 @@ exports.PenTool = Montage.create(ShapeTool, {
this._selectedSubpath.setStrokeWidth(strokeSize);
var colorArray=[];
- var color = this.application.ninja.colorController.colorToolbar.stroke.color;
+ var color = this.options.stroke.color;
if (color){
colorArray = [color.r/255, color.g/255, color.b/255, color.a];
}else {
@@ -248,7 +248,7 @@ exports.PenTool = Montage.create(ShapeTool, {
}
this._selectedSubpath.setStrokeColor(colorArray);
- color = this.application.ninja.colorController.colorToolbar.fill.color;
+ color = this.options.fill.color;
if (color){
colorArray = [color.r/255, color.g/255, color.b/255, color.a];
} else {
diff --git a/js/tools/RectTool.js b/js/tools/RectTool.js
index 0c14a559..d4951db8 100755
--- a/js/tools/RectTool.js
+++ b/js/tools/RectTool.js
@@ -59,8 +59,8 @@ exports.RectTool = Montage.create(ShapeTool, {
var blRadius = ShapesController.GetValueInPixels(this.options.BLRadiusControl.value, this.options.BLRadiusControl.units, h);
var brRadius = ShapesController.GetValueInPixels(this.options.BRRadiusControl.value, this.options.BRRadiusControl.units, h);
- var strokeColor = this.application.ninja.colorController.colorToolbar.stroke.webGlColor;
- var fillColor = this.application.ninja.colorController.colorToolbar.fill.webGlColor;
+ var strokeColor = this.options.stroke.webGlColor;
+ var fillColor = this.options.fill.webGlColor;
// for default stroke and fill/no materials
var strokeMaterial = null;
var fillMaterial = null;
--
cgit v1.2.3
From 29ad6355ef60cfb3b3fc7f780504f3ed30845883 Mon Sep 17 00:00:00 2001
From: John Mayhew
Date: Mon, 7 May 2012 14:30:47 -0700
Subject: More implementation of moving color chips to the individual subtools.
Removed the tool color bar
Added new icons for inkbottle
Removed Pencil tool
Removed Inkbottle tool
Added chips to the pen, brush and tag tools
Aligned controls in several subtools
---
js/tools/PencilTool.js | 32 --------------------------------
1 file changed, 32 deletions(-)
delete mode 100755 js/tools/PencilTool.js
(limited to 'js/tools')
diff --git a/js/tools/PencilTool.js b/js/tools/PencilTool.js
deleted file mode 100755
index 349eb1e8..00000000
--- a/js/tools/PencilTool.js
+++ /dev/null
@@ -1,32 +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.
- */
-
-var Montage = require("montage/core/core").Montage,
- DrawingTool = require("js/tools/drawing-tool").DrawingTool;
-
-exports.PencilTool = Montage.create(DrawingTool, {
- drawingFeedback: { value: { mode: "Draw2D", type: "" } },
-
- HandleLeftButtonDown: {
- value: function(event) {
- NJevent("enableStageMove");
-
- }
- },
-
- HandleMouseMove: {
- value: function(event) {
- this.doDraw(event);
- }
- },
-
- HandleLeftButtonUp: {
- value: function(event) {
- this.endDraw(event);
- NJevent("disableStageMove");
- }
- }
-});
\ No newline at end of file
--
cgit v1.2.3
From ba64dfa1d64969e290f15459a826171468fe3550 Mon Sep 17 00:00:00 2001
From: John Mayhew
Date: Thu, 10 May 2012 15:10:58 -0700
Subject: put color chips in the inkbottle and fill tool
---
js/tools/FillTool.js | 7 +++----
js/tools/InkBottleTool.js | 2 +-
js/tools/PenTool.js | 2 +-
3 files changed, 5 insertions(+), 6 deletions(-)
(limited to 'js/tools')
diff --git a/js/tools/FillTool.js b/js/tools/FillTool.js
index 87a093ff..66dd9305 100755
--- a/js/tools/FillTool.js
+++ b/js/tools/FillTool.js
@@ -72,9 +72,9 @@ exports.FillTool = Montage.create(ModifierToolBase, {
value: function(event) {
this.isDrawing = true;
- if(this._canColor && this.application.ninja.selectedElements.length)
- {
- var color = this.application.ninja.colorController.colorToolbar.fill,
+ if(this._canColor && this.application.ninja.selectedElements.length) {
+
+ var color = this.options.fill,
colorInfo;
if(color && color.color)
{
@@ -92,5 +92,4 @@ exports.FillTool = Montage.create(ModifierToolBase, {
}
}
}
-
});
\ No newline at end of file
diff --git a/js/tools/InkBottleTool.js b/js/tools/InkBottleTool.js
index fd17f4d6..2c03d133 100755
--- a/js/tools/InkBottleTool.js
+++ b/js/tools/InkBottleTool.js
@@ -69,7 +69,7 @@ exports.InkBottleTool = Montage.create(ModifierToolBase, {
if(this._canColor && this.application.ninja.selectedElements.length)
{
- var color = this.application.ninja.colorController.colorToolbar.stroke,
+ var color = this.options.stroke,
colorInfo;
if(color && color.color)
{
diff --git a/js/tools/PenTool.js b/js/tools/PenTool.js
index e70bed27..10eb03c9 100755
--- a/js/tools/PenTool.js
+++ b/js/tools/PenTool.js
@@ -592,7 +592,7 @@ exports.PenTool = Montage.create(ShapeTool, {
var strokeColor = subpath.getStrokeColor();
newCanvas.elementModel.shapeModel.stroke = strokeColor;
if(strokeColor) {
- newCanvas.elementModel.shapeModel.border = this.application.ninja.colorController.colorToolbar.stroke;
+ newCanvas.elementModel.shapeModel.border = this.options.stroke;
}
newCanvas.elementModel.shapeModel.GLGeomObj = subpath;
newCanvas.elementModel.shapeModel.useWebGl = false;//this.options.use3D;
--
cgit v1.2.3
From dcbdd4d4be9a02e792bce445ab360b72d66fa326 Mon Sep 17 00:00:00 2001
From: Valerio Virgillito
Date: Tue, 15 May 2012 15:41:16 -0700
Subject: Add color to tag tool
Signed-off-by: Valerio Virgillito
---
js/tools/TagTool.js | 5 +++++
1 file changed, 5 insertions(+)
(limited to 'js/tools')
diff --git a/js/tools/TagTool.js b/js/tools/TagTool.js
index 5e9c792b..5520fa89 100755
--- a/js/tools/TagTool.js
+++ b/js/tools/TagTool.js
@@ -92,6 +92,11 @@ exports.TagTool = Montage.create(DrawingTool, {
// Create the styles
styles = document.application.njUtils.stylesFromDraw(element, ~~drawData.width, ~~drawData.height, drawData);
+ // Add color
+ if(this.options.getProperty("fill.colorMode") !== "nocolor") {
+ styles['background-color'] = this.options.getProperty("fill.color.css");
+ }
+
// Add the element and styles
this.application.ninja.elementMediator.addElements(element, styles);
}
--
cgit v1.2.3
From f9f8fdc3000042ba5b4504d91870dc9a32ef25eb Mon Sep 17 00:00:00 2001
From: Valerio Virgillito
Date: Wed, 16 May 2012 01:00:22 -0700
Subject: Squashed master into dom-architecture
Signed-off-by: Valerio Virgillito
---
js/tools/LineTool.js | 3 ++-
js/tools/OvalTool.js | 2 +-
js/tools/RectTool.js | 2 +-
js/tools/TextTool.js | 40 ++++++++++++++--------------------------
4 files changed, 18 insertions(+), 29 deletions(-)
(limited to 'js/tools')
diff --git a/js/tools/LineTool.js b/js/tools/LineTool.js
index 5941b464..198d7e69 100755
--- a/js/tools/LineTool.js
+++ b/js/tools/LineTool.js
@@ -234,7 +234,8 @@ exports.LineTool = Montage.create(ShapeTool, {
var xOffset = ((left - canvas.offsetLeft + w/2) - canvas.width/2);
var yOffset = (canvas.height/2 - (top - canvas.offsetTop + h/2));
- var line = new Line(world, xOffset, yOffset, w, h, slope, strokeSize, strokeColor, strokeMaterial, strokeStyle, xAdj, yAdj);
+ var line = Object.create(Line, {});
+ line.init(world, xOffset, yOffset, w, h, slope, strokeSize, strokeColor, strokeMaterial, strokeStyle, xAdj, yAdj);
world.addObject(line);
world.render();
diff --git a/js/tools/OvalTool.js b/js/tools/OvalTool.js
index 6edec811..e9dc66bb 100755
--- a/js/tools/OvalTool.js
+++ b/js/tools/OvalTool.js
@@ -68,7 +68,7 @@ exports.OvalTool = Montage.create(ShapeTool, {
var xOffset = ((left - canvas.offsetLeft + w/2) - canvas.width/2);
var yOffset = -(canvas.height/2 - (top - canvas.offsetTop + h/2));
- var oval = new Circle(); //GLCircle();
+ var oval = Object.create(Circle, {});
oval.init(world, xOffset, yOffset, w, h, strokeSize, strokeColor, fillColor, innerRadius, strokeMaterial, fillMaterial, strokeStyle);
world.addObject(oval);
diff --git a/js/tools/RectTool.js b/js/tools/RectTool.js
index 0c14a559..0a3c8200 100755
--- a/js/tools/RectTool.js
+++ b/js/tools/RectTool.js
@@ -87,7 +87,7 @@ exports.RectTool = Montage.create(ShapeTool, {
var xOffset = ((left - canvas.offsetLeft + w/2) - canvas.width/2);
var yOffset = (canvas.height/2 - (top - canvas.offsetTop + h/2));
- var rect = new Rectangle();
+ var rect = Object.create(Rectangle, {});
rect.init(world, xOffset, yOffset, w, h, strokeSize, strokeColor, fillColor,
tlRadius, trRadius, blRadius, brRadius, strokeMaterial, fillMaterial, strokeStyle);
diff --git a/js/tools/TextTool.js b/js/tools/TextTool.js
index a58aacc6..024a92ce 100755
--- a/js/tools/TextTool.js
+++ b/js/tools/TextTool.js
@@ -5,13 +5,18 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
*/
var Montage = require("montage/core/core").Montage,
- DrawingTool = require("js/tools/drawing-tool").DrawingTool;
+ DrawingTool = require("js/tools/drawing-tool").DrawingTool,
RichTextEditor = require("node_modules/labs/rich-text-editor.reel").RichTextEditor,
ElementsMediator = require("js/mediators/element-mediator").ElementMediator;
exports.TextTool = Montage.create(DrawingTool, {
+ drawingFeedback: {
+ value: { mode: "Draw3D", type: "rectangle" }
+ },
- _selectedElement: { value : null },
+ _selectedElement: {
+ value : null
+ },
selectedElement: {
get: function() {
@@ -35,9 +40,6 @@ exports.TextTool = Montage.create(DrawingTool, {
}
}
},
-
-
- drawingFeedback: { value: { mode: "Draw3D", type: "rectangle" } },
HandleLeftButtonDown: {
value: function(event) {
@@ -81,15 +83,7 @@ exports.TextTool = Montage.create(DrawingTool, {
return;
}
- var drawData, selectedItem;
-
if(this._hasDraw) {
- drawData = this.getDrawingData();
-
- if(drawData) {
- //this.insertElement(drawData);
- }
-
this._hasDraw = false;
this.endDraw(event);
} else {
@@ -113,6 +107,8 @@ exports.TextTool = Montage.create(DrawingTool, {
drawTextTool: {
value: function() {
+ var self = this;
+
this.application.ninja.stage.textTool.value = this.selectedElement.innerHTML;
if(this.application.ninja.stage.textTool.value === "") { this.application.ninja.stage.textTool.value = " "; }
this.selectedElement.innerHTML = "";
@@ -125,35 +121,27 @@ exports.TextTool = Montage.create(DrawingTool, {
this.application.ninja.stage.textTool.element.style.width = this.selectedElement.offsetWidth + "px";
this.application.ninja.stage.textTool.element.style.height = this.selectedElement.offsetHeight + "px";
-
// Set font styling (Size, Style, Weight)
-
- me = this;
this.application.ninja.stage.textTool.didDraw = function() {
- me.applyElementStyles(me.selectedElement, me.application.ninja.stage.textTool.element, ["overflow"]);
- me.applyElementStyles(me.selectedElement, me.application.ninja.stage.textTool.element.firstChild, ["font","padding-left","padding-top","padding-right","padding-bottom", "color"]);
+ self.applyElementStyles(self.selectedElement, self.application.ninja.stage.textTool.element, ["overflow"]);
+ self.applyElementStyles(self.selectedElement, self.application.ninja.stage.textTool.element.firstChild, ["font","padding-left","padding-top","padding-right","padding-bottom", "color"]);
var range = document.createRange(),
sel = window.getSelection();
sel.removeAllRanges();
- range.selectNodeContents(this.application.ninja.stage.textTool.element.firstChild);
+ range.selectNodeContents(self.application.ninja.stage.textTool.element.firstChild);
sel.addRange(range);
this.didDraw = function() {};
}
}
},
+ /*
HandleDoubleClick: {
value: function(e) {
//this.application.ninja.selectedElements[0].setAttribute("contenteditable", true);
-
- //if (!this.application.ninja.textTool) {
-
- //}
-
-
-
}
},
+ */
Configure: {
value: function(wasSelected) {
--
cgit v1.2.3
From db749e10fdff655c2f3b8336a8cc58bf4f389e2c Mon Sep 17 00:00:00 2001
From: Nivesh Rajbhandari
Date: Thu, 17 May 2012 10:47:53 -0700
Subject: IKNinja-1628 - Can't draw shapes inside canvas after double-clicking
into canvas.
Signed-off-by: Nivesh Rajbhandari
---
js/tools/ShapeTool.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'js/tools')
diff --git a/js/tools/ShapeTool.js b/js/tools/ShapeTool.js
index 0562dbc2..367ab78d 100755
--- a/js/tools/ShapeTool.js
+++ b/js/tools/ShapeTool.js
@@ -72,7 +72,7 @@ exports.ShapeTool = Montage.create(DrawingTool, {
if(!canvas.elementModel.shapeModel) {
canvas.elementModel.shapeModel = Montage.create(ShapeModel);
}
- this.application.ninja.elementMediator.addElements(canvas, canvas.elementModel.data);
+ this.RenderShape(drawData.width, drawData.height, drawData.planeMat, drawData.midPt, canvas);
}
}
--
cgit v1.2.3