aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xjs/controllers/color-controller.js14
-rwxr-xr-xjs/controllers/elements/element-controller.js13
-rwxr-xr-xjs/controllers/elements/image-controller.js2
-rwxr-xr-xjs/controllers/elements/shapes-controller.js12
-rwxr-xr-xjs/data/tools-data.js2
-rwxr-xr-xjs/stage/stage.reel/stage.js31
-rwxr-xr-xjs/tools/EyedropperTool.js206
-rwxr-xr-xjs/tools/FillTool.js3
-rwxr-xr-xjs/tools/InkBottleTool.js35
-rwxr-xr-xjs/tools/modifier-tool-base.js2
10 files changed, 284 insertions, 36 deletions
diff --git a/js/controllers/color-controller.js b/js/controllers/color-controller.js
index e3b15f1c..a6e41dd3 100755
--- a/js/controllers/color-controller.js
+++ b/js/controllers/color-controller.js
@@ -322,7 +322,19 @@ exports.ColorController = Montage.create(Component, {
322 //Simple solid color 322 //Simple solid color
323 color = this.parseCssToColor(css); 323 color = this.parseCssToColor(css);
324 } 324 }
325 //Returning color object (or null if none) 325 // TODO - Hack for inconsistent color object -- some workflows set color.color and some color.value
326 if(color)
327 {
328 if(color.value && !color.color)
329 {
330 color.color = color.value;
331 }
332 else if(color.color && !color.value)
333 {
334 color.value = color.color;
335 }
336 }
337 //Returning color object (or null if none)
326 return color; 338 return color;
327 } 339 }
328 }, 340 },
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js
index ac14def4..46e82ace 100755
--- a/js/controllers/elements/element-controller.js
+++ b/js/controllers/elements/element-controller.js
@@ -118,6 +118,7 @@ var ElementController = exports.ElementController = Montage.create(NJComponent,
118 } 118 }
119 else 119 else
120 { 120 {
121 // TODO - Need to update border style and width also
121 el.elementModel.stroke = colorObj; 122 el.elementModel.stroke = colorObj;
122 } 123 }
123 124
@@ -162,10 +163,22 @@ var ElementController = exports.ElementController = Montage.create(NJComponent,
162 case 'gradient': 163 case 'gradient':
163 this.setProperty(el, "border-image", color.color.css); 164 this.setProperty(el, "border-image", color.color.css);
164 this.setProperty(el, "border-color", "none"); 165 this.setProperty(el, "border-color", "none");
166 if(color.borderInfo)
167 {
168 this.setProperty(el, "border-width", color.borderInfo.borderWidth +
169 color.borderInfo.borderUnits);
170 this.setProperty(el, "border-style", color.borderInfo.borderStyle);
171 }
165 break; 172 break;
166 default: 173 default:
167 this.setProperty(el, "border-image", "none"); 174 this.setProperty(el, "border-image", "none");
168 this.setProperty(el, "border-color", color.color.css); 175 this.setProperty(el, "border-color", color.color.css);
176 if(color.borderInfo)
177 {
178 this.setProperty(el, "border-width", color.borderInfo.borderWidth +
179 color.borderInfo.borderUnits);
180 this.setProperty(el, "border-style", color.borderInfo.borderStyle);
181 }
169 } 182 }
170 } 183 }
171 el.elementModel.stroke = color; 184 el.elementModel.stroke = color;
diff --git a/js/controllers/elements/image-controller.js b/js/controllers/elements/image-controller.js
index 5abce13e..25ca8da6 100755
--- a/js/controllers/elements/image-controller.js
+++ b/js/controllers/elements/image-controller.js
@@ -19,7 +19,7 @@ exports.ImageController = Montage.create(ElementController, {
19 return el.getAttribute(prop); 19 return el.getAttribute(prop);
20 break; 20 break;
21 default: 21 default:
22 return ElementController.getProperty(el, prop); 22 return ElementController.getProperty(el, prop, true);
23 } 23 }
24 } 24 }
25 }, 25 },
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index 15a18a51..e0bff70c 100755
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -250,6 +250,10 @@ exports.ShapesController = Montage.create(CanvasController, {
250 setColor: { 250 setColor: {
251 value: function(el, color, isFill) { 251 value: function(el, color, isFill) {
252 var webGl = color.webGlColor || color.color.webGlColor; 252 var webGl = color.webGlColor || color.color.webGlColor;
253 if(!webGl)
254 {
255 webGl = this.application.ninja.colorController.colorModel.colorToWebGl(color.color);
256 }
253 if(isFill) 257 if(isFill)
254 { 258 {
255 el.elementModel.shapeModel.GLGeomObj.setFillColor(webGl); 259 el.elementModel.shapeModel.GLGeomObj.setFillColor(webGl);
@@ -261,6 +265,14 @@ exports.ShapesController = Montage.create(CanvasController, {
261 el.elementModel.shapeModel.GLGeomObj.setStrokeColor(webGl); 265 el.elementModel.shapeModel.GLGeomObj.setStrokeColor(webGl);
262 this.setShapeProperty(el, "stroke", webGl); 266 this.setShapeProperty(el, "stroke", webGl);
263 this.setShapeProperty(el, "border", color); 267 this.setShapeProperty(el, "border", color);
268 if(color.strokeInfo)
269 {
270 var strokeWidth = this.GetValueInPixels(color.strokeInfo.strokeSize,
271 color.strokeInfo.strokeUnits);
272 el.elementModel.shapeModel.GLGeomObj.setStrokeWidth(strokeWidth);
273 this.setShapeProperty(el, "strokeSize", color.strokeInfo.strokeSize + " "
274 + color.strokeInfo.strokeUnits);
275 }
264 } 276 }
265 el.elementModel.shapeModel.GLWorld.render(); 277 el.elementModel.shapeModel.GLWorld.render();
266 } 278 }
diff --git a/js/data/tools-data.js b/js/data/tools-data.js
index de965dbc..f63d14ae 100755
--- a/js/data/tools-data.js
+++ b/js/data/tools-data.js
@@ -174,7 +174,7 @@ exports.ToolsData = Montage.create(Montage, {
174 "spriteSheet": true, 174 "spriteSheet": true,
175 "action": "EyedropperTool", 175 "action": "EyedropperTool",
176 "toolTip": "Eyedropper Tool", 176 "toolTip": "Eyedropper Tool",
177 "cursor": "url('images/tools/eyedropper_down.png'), default", 177 "cursor": "url('images/tools/eyedropper_down.png') 6 20, default",
178 "lastInGroup": false, 178 "lastInGroup": false,
179 "container": false, 179 "container": false,
180 "selected": false 180 "selected": false
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js
index 44e14827..641ac247 100755
--- a/js/stage/stage.reel/stage.js
+++ b/js/stage/stage.reel/stage.js
@@ -515,12 +515,37 @@ exports.Stage = Montage.create(Component, {
515 */ 515 */
516 GetElement: { 516 GetElement: {
517 value: function(pos) { 517 value: function(pos) {
518 var point = webkitConvertPointFromPageToNode(this.canvas, new WebKitPoint(pos.pageX, pos.pageY)); 518 var point = webkitConvertPointFromPageToNode(this.canvas, new WebKitPoint(pos.pageX, pos.pageY)),
519 return this.application.ninja.currentDocument.GetElementFromPoint(point.x + this.scrollLeft,point.y + this.scrollTop); 519 elt = this.application.ninja.currentDocument.GetElementFromPoint(point.x + this.scrollLeft,point.y + this.scrollTop);
520
521 // workaround Chrome 3d bug
522 if(this.application.ninja.currentDocument.inExclusion(elt) !== -1)
523 {
524 return this._getElementUsingSnapping(point);
525 } else {
526 return elt;
527 }
520 } 528 }
521 }, 529 },
522 530
523 531 /**
532 * _getElementUsingSnapping: Returns the object at point using snap manager
533 *
534 * @param: point
535 * @return: Returns the Object in the user document under the point
536 */
537 _getElementUsingSnapping: {
538 value: function(point) {
539 this.stageDeps.snapManager.enableElementSnap( true );
540 var hitRec = this.stageDeps.snapManager.snap(point.x, point.y, true);
541 this.stageDeps.snapManager.enableElementSnap( this.stageDeps.snapManager.elementSnapEnabledAppLevel() );
542 if (hitRec) {
543 return hitRec.getElement();
544 } else {
545 return null;
546 }
547 }
548 },
524 549
525 550
526 draw: { 551 draw: {
diff --git a/js/tools/EyedropperTool.js b/js/tools/EyedropperTool.js
index 795753d2..d007da39 100755
--- a/js/tools/EyedropperTool.js
+++ b/js/tools/EyedropperTool.js
@@ -6,7 +6,8 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
6 6
7var Montage = require("montage/core/core").Montage, 7var Montage = require("montage/core/core").Montage,
8 ElementsMediator = require("js/mediators/element-mediator").ElementMediator, 8 ElementsMediator = require("js/mediators/element-mediator").ElementMediator,
9 9 drawUtils = require("js/helper-classes/3D/draw-utils").DrawUtils,
10 vecUtils = require("js/helper-classes/3D/vec-utils").VecUtils,
10 toolBase = require("js/tools/ToolBase").toolBase; 11 toolBase = require("js/tools/ToolBase").toolBase;
11 12
12exports.EyedropperTool = Montage.create(toolBase, { 13exports.EyedropperTool = Montage.create(toolBase, {
@@ -14,6 +15,9 @@ exports.EyedropperTool = Montage.create(toolBase, {
14 _isMouseDown: { value: false }, 15 _isMouseDown: { value: false },
15 _previousColor: { value: null}, 16 _previousColor: { value: null},
16 _color: { value: null}, 17 _color: { value: null},
18 _elementUnderMouse: { value: null },
19 _imageDataCanvas: { value: null },
20 _imageDataContext: { value: null },
17 21
18 Configure: { 22 Configure: {
19 value: function ( doActivate ) 23 value: function ( doActivate )
@@ -46,6 +50,8 @@ exports.EyedropperTool = Montage.create(toolBase, {
46 { 50 {
47 this._isMouseDown = false; 51 this._isMouseDown = false;
48 this._escape = false; 52 this._escape = false;
53 this._elementUnderMouse = null;
54 this._deleteImageDataCanvas();
49 } 55 }
50 if(this._isMouseDown) 56 if(this._isMouseDown)
51 { 57 {
@@ -67,6 +73,9 @@ exports.EyedropperTool = Montage.create(toolBase, {
67 this._updateColor(this._color); 73 this._updateColor(this._color);
68 74