From 1a759361b82127f9d5c1428dc889fffdf2daaf86 Mon Sep 17 00:00:00 2001
From: John Mayhew
Date: Thu, 3 May 2012 15:11:56 -0700
Subject: First round of moving color chips into the sub tools. Shape and Pen
tool now have chips in the sub tool bar. Still need to complete adding chips
to the Brush tool and finalizing the subtool bar layout to our spec for all
of the subtools.
---
.../pen-properties.reel/pen-properties.css | 20 ++++++
.../pen-properties.reel/pen-properties.html | 16 +++--
.../pen-properties.reel/pen-properties.js | 83 +++++++++++++++++++++-
3 files changed, 111 insertions(+), 8 deletions(-)
(limited to 'js/components/tools-properties/pen-properties.reel')
diff --git a/js/components/tools-properties/pen-properties.reel/pen-properties.css b/js/components/tools-properties/pen-properties.reel/pen-properties.css
index 7f1b0f7f..01a0ca1f 100755
--- a/js/components/tools-properties/pen-properties.reel/pen-properties.css
+++ b/js/components/tools-properties/pen-properties.reel/pen-properties.css
@@ -4,3 +4,23 @@
(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
*/
+
+ .optionsPenTool {
+ padding: 6px;
+}
+
+ .optionsPenTool > * {
+ float:left;
+}
+
+ .optionsPenTool .fillColorCtrl, .optionsPenTool .strokeColorCtrl {
+ width: 20px;
+ height: 18px;
+ margin: 2px 6px;
+}
+
+ .optionsPenTool .colorCtrlIcon {
+ width: 20px;
+ height: 20px;
+ background-color: rgb(54, 54, 54);
+}
\ No newline at end of file
diff --git a/js/components/tools-properties/pen-properties.reel/pen-properties.html b/js/components/tools-properties/pen-properties.reel/pen-properties.html
index e835f69d..176663df 100755
--- a/js/components/tools-properties/pen-properties.reel/pen-properties.html
+++ b/js/components/tools-properties/pen-properties.reel/pen-properties.html
@@ -28,20 +28,24 @@
"prototype": "js/components/tools-properties/pen-properties.reel",
"properties": {
"element": {"#": "penProperties"},
+ "_fillColorCtrl": {"#": "fillColorCtrl"},
+ "_strokeColorCtrl": {"#": "strokeColorCtrl"},
"_strokeSize": {"@": "strokeSizeHT"}
}
}
}
-
+
-
-
+
diff --git a/js/components/tools-properties/pen-properties.reel/pen-properties.js b/js/components/tools-properties/pen-properties.reel/pen-properties.js
index b57f9a6f..cd205e07 100755
--- a/js/components/tools-properties/pen-properties.reel/pen-properties.js
+++ b/js/components/tools-properties/pen-properties.reel/pen-properties.js
@@ -7,8 +7,87 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
var Montage = require("montage/core/core").Montage;
var ToolProperties = require("js/components/tools-properties/tool-properties").ToolProperties;
-exports.PenProperties = Montage.create(ToolProperties, {
+var PenProperties = exports.PenProperties = Montage.create(ToolProperties, {
+ addedColorChips: { value: false },
+
+ _fill: {
+ enumerable: false,
+ value: { colorMode: 'rgb', color: { r: 255, g: 255, b: 255, a: 1, css: 'rgb(255,255,255)', mode: 'rgb', wasSetByCode: true, type: 'change' }, webGlColor: [1, 1, 1, 1] }
+ },
+
+ _stroke: {
+ enumerable: false,
+ value: { colorMode: 'rgb', color: { r: 0, g: 0, b: 0, a: 1, css: 'rgb(0,0,0)', mode: 'rgb', wasSetByCode: true, type: 'change' }, webGlColor: [0, 0, 0, 1] }
+ },
+
+ stroke: {
+ enumerable: true,
+ get: function () {
+ return this._stroke;
+ },
+ set: function (value) {
+ if (value !== this._stroke) {
+ this._stroke = value;
+ }
+ }
+ },
+
+ fill: {
+ enumerable: true,
+ get: function () {
+ return this._fill;
+ },
+ set: function (value) {
+ if (value !== this._fill) {
+ this._fill = value;
+ }
+ }
+ },
+
strokeSize: {
- get: function() { return this._strokeSize; }
+ get: function () {
+ return this._strokeSize;
+ }
+ },
+
+ draw: {
+ enumerable: false,
+ value: function () {
+ Object.getPrototypeOf(PenProperties).draw.call(this);
+
+ if (this.addedColorChips === false && this.application.ninja.colorController.colorPanelDrawn) {
+ // setup fill color
+ this._fillColorCtrl.props = { side: 'top', align: 'center', wheel: true, palette: true, gradient: false, image: false, nocolor: true, offset: -80 };
+ this.application.ninja.colorController.addButton("chip", this._fillColorCtrl);
+
+ // setup stroke color
+ this._strokeColorCtrl.props = { side: 'top', align: 'center', wheel: true, palette: true, gradient: false, image: false, nocolor: true, offset: -80 };
+ this.application.ninja.colorController.addButton("chip", this._strokeColorCtrl);
+
+ this._fillColorCtrl.addEventListener("change", this.handleFillColorChange.bind(this), false);
+ this._strokeColorCtrl.addEventListener("change", this.handleStrokeColorChange.bind(this), false);
+
+ this.addedColorChips = true;
+ }
+
+ if (this.addedColorChips) {
+ this._fillColorCtrl.color(this._fill.colorMode, this._fill.color);
+ this._strokeColorCtrl.color(this._stroke.colorMode, this._stroke.color);
+ }
+ }
+ },
+
+ handleFillColorChange: {
+ value: function (e) {
+ this.fill = e._event;
+ this.fill.webGlColor = this.application.ninja.colorController.colorModel.colorToWebGl(e._event.color);
+ }
+ },
+
+ handleStrokeColorChange: {
+ value: function (e) {
+ this.stroke = e._event;
+ this.stroke.webGlColor = this.application.ninja.colorController.colorModel.colorToWebGl(e._event.color);
+ }
}
});
\ No newline at end of file
--
cgit v1.2.3