From d44f3196c925332dcaf45f7cf8c64e22a1994bb9 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Mon, 4 Jun 2012 17:11:06 -0700 Subject: Fill and Ink-Bottle fixes. Signed-off-by: Nivesh Rajbhandari --- js/controllers/elements/element-controller.js | 24 +++++++++++++++++ js/controllers/elements/shapes-controller.js | 38 +++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) (limited to 'js/controllers') diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index 01e132d7..fd4d3c12 100755 --- a/js/controllers/elements/element-controller.js +++ b/js/controllers/elements/element-controller.js @@ -225,6 +225,30 @@ exports.ElementController = Montage.create(Component, { } }, + getFill: { + value: function(el, fill) { + var fillInfo = {}, + color; + if(fill.colorInfo) { + fillInfo.colorInfo = {}; + color = this.getColor(el, true); + if(color && color.color) { + fillInfo.colorInfo.mode = color.mode; + fillInfo.colorInfo.color = color.color; + } else { + fillInfo.colorInfo.mode = "nocolor"; + fillInfo.colorInfo.color = null; + } + } + return fillInfo; + } + }, + + setFill: { + value: function(el, fill, eventType, source) { + this.setColor(el, fill.colorInfo, true); + } + }, //-------------------------------------------------------------------------------------------------------- // Routines to get/set 3D properties get3DProperty: { diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index 626dedb6..f19aaffb 100755 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js @@ -584,6 +584,44 @@ exports.ShapesController = Montage.create(CanvasController, { } }, + getFill: { + value: function(el, fill) { + var fillInfo = {}, + color; + if(fill.colorInfo) { + fillInfo.colorInfo = {}; + color = this.getColor(el, true); + if(color && color.color) { + fillInfo.colorInfo.mode = color.mode; + fillInfo.colorInfo.color = color.color; + } else { + fillInfo.colorInfo.mode = "nocolor"; + fillInfo.colorInfo.color = null; + } + } + if(fill.webGLInfo) { + fillInfo.webGLInfo = {}; + if(this.getShapeProperty(el, "useWebGl")) { + fillInfo.webGLInfo.material = this.getProperty("fillMaterial"); + } else { + fillInfo.webGLInfo.material = null; + } + } + return fillInfo; + } + }, + + setFill: { + value: function(el, fill, eventType, source) { + if(fill.colorInfo) { + this.setColor(el, fill.colorInfo, true); + } + if(fill.webGLInfo) { + this.setProperty(el, "fillMaterial", fill.webGLInfo.material, eventType, source); + } + } + }, + DisplayMaterials: { value: function (cb) { -- cgit v1.2.3