aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/elements/shapes-controller.js
diff options
context:
space:
mode:
authorValerio Virgillito2012-06-05 21:43:48 -0700
committerValerio Virgillito2012-06-05 21:43:48 -0700
commitfb684fb27c2cef04251655d86e55eceed9da3132 (patch)
treea7773e4d8ee6cb3d047e5aa5f8c4f33403099574 /js/controllers/elements/shapes-controller.js
parente28eb9158a50d7e6d97dbc68066e591ac600c241 (diff)
parent18e212dca48066d1ddaca96875a3f40adcc859b6 (diff)
downloadninja-fb684fb27c2cef04251655d86e55eceed9da3132.tar.gz
Merge branch 'refs/heads/master' into element-model-fixes
Conflicts: js/mediators/element-mediator.js Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/controllers/elements/shapes-controller.js')
-rwxr-xr-xjs/controllers/elements/shapes-controller.js101
1 files changed, 82 insertions, 19 deletions
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index ae345489..9fc9b576 100755
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -551,12 +551,6 @@ exports.ShapesController = Montage.create(CanvasController, {
551 el.elementModel.shapeModel.GLGeomObj.setStrokeColor(webGl); 551 el.elementModel.shapeModel.GLGeomObj.setStrokeColor(webGl);
552 } 552 }
553 } 553 }
554
555 // Support for ink-bottle tool
556 if(color.strokeInfo)
557 {
558 this.setProperty(el, "strokeSize", color.strokeInfo.strokeSize + " " + color.strokeInfo.strokeUnits);
559 }
560 } 554 }
561 el.elementModel.shapeModel.GLWorld.render(); 555 el.elementModel.shapeModel.GLWorld.render();
562 this.application.ninja.currentDocument.model.needsSave = true; 556 this.application.ninja.currentDocument.model.needsSave = true;
@@ -564,23 +558,92 @@ exports.ShapesController = Montage.create(CanvasController, {
564 }, 558 },
565 559
566 getStroke: { 560 getStroke: {
567 value: function(el) { 561 value: function(el, stroke) {
568 // TODO - Need to figure out which border side user wants 562 var strokeInfo = {},
569 var size = this.getShapeProperty(el, "strokeSize"); 563 color,
570 var color = this.getShapeProperty(el, "stroke"); 564 strokeWidth,
571 return {stroke:color, strokeSize:size}; 565 strokeSize;
566 if(stroke.colorInfo) {
567 strokeInfo.colorInfo = {};
568 color = this.getColor(el, false);
569 if(color && color.color) {
570 strokeInfo.colorInfo.mode = color.mode;
571 strokeInfo.colorInfo.color = color.color;
572 } else {
573 strokeInfo.colorInfo.mode = "nocolor";
574 strokeInfo.colorInfo.color = null;
575 }
576 }
577 if(stroke.shapeInfo) {
578 strokeInfo.shapeInfo = {};
579 strokeWidth = this.getProperty(el, "strokeSize");
580 if(strokeWidth) {
581 strokeSize = njModule.NJUtils.getValueAndUnits(strokeWidth);
582 strokeInfo.shapeInfo.strokeSize = strokeSize[0];
583 strokeInfo.shapeInfo.strokeUnits = strokeSize[1];
584 }
585 }
586 if(stroke.webGLInfo) {
587 strokeInfo.webGLInfo = {};
588 if(this.getShapeProperty(el, "useWebGl")) {
589 strokeInfo.webGLInfo.material = this.getProperty(el, "strokeMaterial");
590 } else {
591 strokeInfo.webGLInfo.material = null;
592 }
593 }
594 return strokeInfo;
572 } 595 }
573 }, 596 },
574 597
575 setStroke: { 598 setStroke: {
576 value: function(el, stroke) { 599 value: function(el, stroke, eventType, source) {
577 el.elementModel.shapeModel.GLGeomObj.setStrokeColor(stroke.color.webGlColor); 600 if(stroke.colorInfo) {
578 var strokeWidth = this.GetValueInPixels(stroke.strokeSize, stroke.strokeUnits); 601 this.setColor(el, stroke.colorInfo, false);
579 el.elementModel.shapeModel.GLGeomObj.setStrokeWidth(strokeWidth); 602 }
580 this.setShapeProperty(el, "stroke", stroke.color.webGlColor); 603 if(stroke.shapeInfo) {
581 this.setShapeProperty(el, "strokeSize", stroke.strokeSize + " " + stroke.strokeUnits); 604 this.setProperty(el, "strokeSize", stroke.shapeInfo.strokeSize + " " + stroke.shapeInfo.strokeUnits, eventType, source);
582 el.elementModel.shapeModel.GLGeomObj.buildBuffers(); 605 }
583 el.elementModel.shapeModel.GLWorld.render(); 606 if(stroke.webGLInfo) {
607 this.setProperty(el, "strokeMaterial", stroke.webGLInfo.material);
608 }
609 }
610 },
611
612 getFill: {
613 value: function(el, fill) {
614 var fillInfo = {},
615 color;
616 if(fill.colorInfo) {
617 fillInfo.colorInfo = {};
618 color = this.getColor(el, true);
619 if(color && color.color) {
620 fillInfo.colorInfo.mode = color.mode;
621 fillInfo.colorInfo.color = color.color;
622 } else {
623 fillInfo.colorInfo.mode = "nocolor";
624 fillInfo.colorInfo.color = null;
625 }
626 }
627 if(fill.webGLInfo) {
628 fillInfo.webGLInfo = {};
629 if(this.getShapeProperty(el, "useWebGl")) {
630 fillInfo.webGLInfo.material = this.getProperty(el, "fillMaterial");
631 } else {
632 fillInfo.webGLInfo.material = null;
633 }
634 }
635 return fillInfo;
636 }
637 },
638
639 setFill: {
640 value: function(el, fill) {
641 if(fill.colorInfo) {
642 this.setColor(el, fill.colorInfo, true);
643 }
644 if(fill.webGLInfo) {
645 this.setProperty(el, "fillMaterial", fill.webGLInfo.material);
646 }
584 } 647 }
585 }, 648 },
586 649