diff options
Diffstat (limited to 'js/controllers/elements/shapes-controller.js')
-rwxr-xr-x | js/controllers/elements/shapes-controller.js | 69 |
1 files changed, 47 insertions, 22 deletions
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index f19aaffb..845e7dc2 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,54 @@ 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 | } | ||
584 | } | 609 | } |
585 | }, | 610 | }, |
586 | 611 | ||
@@ -602,7 +627,7 @@ exports.ShapesController = Montage.create(CanvasController, { | |||
602 | if(fill.webGLInfo) { | 627 | if(fill.webGLInfo) { |
603 | fillInfo.webGLInfo = {}; | 628 | fillInfo.webGLInfo = {}; |
604 | if(this.getShapeProperty(el, "useWebGl")) { | 629 | if(this.getShapeProperty(el, "useWebGl")) { |
605 | fillInfo.webGLInfo.material = this.getProperty("fillMaterial"); | 630 | fillInfo.webGLInfo.material = this.getProperty(el, "fillMaterial"); |
606 | } else { | 631 | } else { |
607 | fillInfo.webGLInfo.material = null; | 632 | fillInfo.webGLInfo.material = null; |
608 | } | 633 | } |
@@ -612,12 +637,12 @@ exports.ShapesController = Montage.create(CanvasController, { | |||
612 | }, | 637 | }, |
613 | 638 | ||
614 | setFill: { | 639 | setFill: { |
615 | value: function(el, fill, eventType, source) { | 640 | value: function(el, fill) { |
616 | if(fill.colorInfo) { | 641 | if(fill.colorInfo) { |
617 | this.setColor(el, fill.colorInfo, true); | 642 | this.setColor(el, fill.colorInfo, true); |
618 | } | 643 | } |
619 | if(fill.webGLInfo) { | 644 | if(fill.webGLInfo) { |
620 | this.setProperty(el, "fillMaterial", fill.webGLInfo.material, eventType, source); | 645 | this.setProperty(el, "fillMaterial", fill.webGLInfo.material); |
621 | } | 646 | } |
622 | } | 647 | } |
623 | }, | 648 | }, |