From 76f2021618c0a6a99a1b855233e353e84ca99467 Mon Sep 17 00:00:00 2001
From: Pushkar Joshi
Date: Tue, 13 Mar 2012 11:23:32 -0700
Subject: Add a smoothing amount parameter, and hide options based on
 checkboxes

---
 .../brush-properties.reel/brush-properties.js      | 30 ++++++++++++++++++++++
 1 file changed, 30 insertions(+)

(limited to 'js/components/tools-properties/brush-properties.reel/brush-properties.js')

diff --git a/js/components/tools-properties/brush-properties.reel/brush-properties.js b/js/components/tools-properties/brush-properties.reel/brush-properties.js
index e6faa0f0..fdcd50f8 100755
--- a/js/components/tools-properties/brush-properties.reel/brush-properties.js
+++ b/js/components/tools-properties/brush-properties.reel/brush-properties.js
@@ -9,6 +9,33 @@ var Component = require("montage/ui/component").Component;
 var ToolProperties = require("js/components/tools-properties/tool-properties").ToolProperties;
 
 exports.BrushProperties = Montage.create(ToolProperties, {
+    _subPrepare: {
+        value: function() {
+            this.handleChange(null);
+            this._useCalligraphic.addEventListener("change", this, false);
+            this._doSmoothing.addEventListener("change", this, false);
+        }
+    },
+    handleChange: {
+        value: function(event) {
+            if(this._useCalligraphic.checked) {
+                this._strokeAngle.element.style["display"] = "";
+                this._strokeAngle.visible = true;
+                this._angleLabel.style["display"] = "";
+            } else {
+                this._strokeAngle.element.style["display"] = "none";
+                this._strokeAngle.visible = false;
+                this._angleLabel.style["display"] = "none";
+            }
+            if(this._doSmoothing.checked) {
+                this._smoothingAmount.element.style["display"] = "";
+                this._smoothingAmount.visible = true;
+            } else {
+                this._smoothingAmount.element.style["display"] = "none";
+                this._smoothingAmount.visible = false;
+            }
+        }
+    },
     strokeSize: {
         get: function() { return this._strokeSize; }
     },
@@ -18,6 +45,9 @@ exports.BrushProperties = Montage.create(ToolProperties, {
     doSmoothing:{
         get: function() {return this._doSmoothing.checked; }
     },
+    smoothingAmount:{
+        get: function() {return this._smoothingAmount;}
+    },
     useCalligraphic: {
         get: function() {return this._useCalligraphic.checked;}
     },
-- 
cgit v1.2.3