aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/elements/shapes-controller.js
diff options
context:
space:
mode:
authorAnanya Sen2012-06-07 11:59:32 -0700
committerAnanya Sen2012-06-07 11:59:32 -0700
commit7378b6846f140106490f10c02cd7cec6a19023aa (patch)
tree90b60c007696b4a73c29abbae82562f69f15c11a /js/controllers/elements/shapes-controller.js
parentaea0e6879abfef02a827ed239ef091c3b96d6eb2 (diff)
parentb75fe9369f7caec0351d298f7106c8d59572b440 (diff)
downloadninja-7378b6846f140106490f10c02cd7cec6a19023aa.tar.gz
Merge branch 'refs/heads/ninja-internal-master' into cut-copy-paste
Diffstat (limited to 'js/controllers/elements/shapes-controller.js')
-rwxr-xr-xjs/controllers/elements/shapes-controller.js103
1 files changed, 83 insertions, 20 deletions
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index 626dedb6..9fc9b576 100755
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -133,7 +133,7 @@ exports.ShapesController = Montage.create(CanvasController, {
133 canvas.setAttribute("data-RDGE-id", njModule.NJUtils.generateRandom()); 133 canvas.setAttribute("data-RDGE-id", njModule.NJUtils.generateRandom());
134 canvas.width = el.width; 134 canvas.width = el.width;
135 canvas.height = el.height; 135 canvas.height = el.height;
136 canvas.elementModel = el.elementModel; 136 canvas._model = el.elementModel;
137 this.toggleWebGlMode(canvas, value); 137 this.toggleWebGlMode(canvas, value);
138 this.application.ninja.elementMediator.replaceElement(canvas, el); 138 this.application.ninja.elementMediator.replaceElement(canvas, el);
139 break; 139 break;
@@ -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