aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/elements/shapes-controller.js
diff options
context:
space:
mode:
authorhwc4872012-06-12 15:52:35 -0700
committerhwc4872012-06-12 15:52:35 -0700
commit9490f816924e9e9c9970ef9384241c07ec0a6e9f (patch)
treef44449a2e0055e21960a5513fb3a0738a91db528 /js/controllers/elements/shapes-controller.js
parentb7a41cbd5a30d32f524ee60e2dfdf9c65c7ec55b (diff)
parent6854a72504f57903bd5de003e377f2aefb02d0da (diff)
downloadninja-9490f816924e9e9c9970ef9384241c07ec0a6e9f.tar.gz
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into Textures
Conflicts: assets/canvas-runtime.js js/io/system/ninjalibrary.json js/mediators/element-mediator.js
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 e3eeca31..e62af921 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