diff options
author | Eric Guzman | 2012-06-11 13:28:42 -0700 |
---|---|---|
committer | Eric Guzman | 2012-06-11 13:28:42 -0700 |
commit | 3a4727ffc350216a434a7c6977b6a23653b77780 (patch) | |
tree | c5dff306f8803c36a16163ba5df1e7f492e762b5 /js/controllers/elements/shapes-controller.js | |
parent | d6b46ba496c9c8974ae39bb476aea35bcd1ddaf1 (diff) | |
parent | 337efc667372326ae2f9984d89a47bb151016774 (diff) | |
download | ninja-3a4727ffc350216a434a7c6977b6a23653b77780.tar.gz |
Merge branch 'binding' of github.com:dhg637/ninja-internal into binding
Diffstat (limited to 'js/controllers/elements/shapes-controller.js')
-rwxr-xr-x | js/controllers/elements/shapes-controller.js | 107 |
1 files changed, 85 insertions, 22 deletions
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index 38f133b5..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; |
@@ -213,7 +213,7 @@ exports.ShapesController = Montage.create(CanvasController, { | |||
213 | default: | 213 | default: |
214 | CanvasController.setProperty(el, p, value); | 214 | CanvasController.setProperty(el, p, value); |
215 | } | 215 | } |
216 | this.application.ninja.documentController.activeDocument.model.needsSave = true; | 216 | this.application.ninja.currentDocument.model.needsSave = true; |
217 | } | 217 | } |
218 | }, | 218 | }, |
219 | 219 | ||
@@ -551,36 +551,99 @@ 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.documentController.activeDocument.model.needsSave = true; | 556 | this.application.ninja.currentDocument.model.needsSave = true; |
563 | } | 557 | } |
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 | ||