aboutsummaryrefslogtreecommitdiff
path: root/js/components/tools-properties/rect-properties.reel/rect-properties.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/components/tools-properties/rect-properties.reel/rect-properties.js')
-rwxr-xr-xjs/components/tools-properties/rect-properties.reel/rect-properties.js87
1 files changed, 39 insertions, 48 deletions
diff --git a/js/components/tools-properties/rect-properties.reel/rect-properties.js b/js/components/tools-properties/rect-properties.reel/rect-properties.js
index f023f4bb..2f8ea4dd 100755
--- a/js/components/tools-properties/rect-properties.reel/rect-properties.js
+++ b/js/components/tools-properties/rect-properties.reel/rect-properties.js
@@ -19,12 +19,6 @@ exports.RectProperties = Montage.create(ToolProperties, {
19 19
20 _subPrepare: { 20 _subPrepare: {
21 value: function() { 21 value: function() {
22 this.lockButton.identifier = "lockButton";
23 this.lockButton.addEventListener("action", this, false);
24
25 this._setBindings([this.TRRadiusControl, this.BLRadiusControl, this.BRRadiusControl]);
26 this._setCap([this.TLRadiusControl,this.TRRadiusControl, this.BLRadiusControl, this.BRRadiusControl]);
27
28 } 22 }
29 }, 23 },
30 24
@@ -33,15 +27,20 @@ exports.RectProperties = Montage.create(ToolProperties, {
33 this.TRRadiusControl.enabled = this.BLRadiusControl.enabled = this.BRRadiusControl.enabled = !this.lockButton.pressed; 27 this.TRRadiusControl.enabled = this.BLRadiusControl.enabled = this.BRRadiusControl.enabled = !this.lockButton.pressed;
34 28
35 if(this.lockButton.pressed) { 29 if(this.lockButton.pressed) {
36 this._setBindings([this.TRRadiusControl, this.BLRadiusControl, this.BRRadiusControl]); 30 this._syncRadii(this.TLRadiusControl.value, this.TLRadiusControl.units);
37 } else {
38 this._removeBindings([this.TRRadiusControl, this.BLRadiusControl, this.BRRadiusControl]);
39 } 31 }
40
41 } 32 }
42 }, 33 },
43 34
44 // Public API 35 // Public API
36 fill: {
37 get: function () { return this.base.fill; }
38 },
39
40 stroke: {
41 get: function () { return this.base.stroke; }
42 },
43
45 use3D: { 44 use3D: {
46 get: function() { return this.base._use3D; } 45 get: function() { return this.base._use3D; }
47 }, 46 },
@@ -72,59 +71,51 @@ exports.RectProperties = Montage.create(ToolProperties, {
72 get: function() { return this.base._fillMaterial.value; } 71 get: function() { return this.base._fillMaterial.value; }
73 }, 72 },
74 73
75 _setBindings: { 74 handleChanging: {
76 value: function(els) { 75 value: function(event) {
77 var that = this; 76 if(event.wasSetByCode) {
78 els.forEach(function(el) { 77 return;
79 Object.defineBinding(el, "value", { 78 }
80 boundObject: that.TLRadiusControl,
81 boundObjectPropertyPath: "value",
82 boundValueMutator: function(value) {
83 if (typeof value === "string") {
84 return parseFloat(value);
85 }
86
87 return value;
88 }
89 });
90
91 Object.defineBinding(el, "units", {
92 boundObject: that.TLRadiusControl,
93 boundObjectPropertyPath: "units"
94 });
95 });
96 }
97 },
98 79
99 _removeBindings: { 80 this._setBorderRadius(event);
100 value: function(els) {
101 els.forEach(function(el) {
102 Object.deleteBindings(el);
103 });
104 } 81 }
105 }, 82 },
106 83
107 _setCap: { 84 handleChange: {
108 value: function(els) { 85 value: function(event) {
109 var that = this; 86 if(event.wasSetByCode) {
110 els.forEach(function(el) { 87 return;
111 el.addEventListener("change", that, false); 88 }
112 }); 89
90 this._setBorderRadius(event);
113 } 91 }
114 }, 92 },
115 93
116 handleChange: { 94 _setBorderRadius: {
117 value: function(event) { 95 value: function(event) {
118 var hotTxt = event.currentTarget; 96 var hotTxt = event.currentTarget;
119 if(hotTxt.units === "%") { 97 if(hotTxt.units === "%") {
120 if(hotTxt.value > 50) { 98 if(hotTxt.value > 50) {
121 hotTxt.maxValue = 50; 99 hotTxt.maxValue = 50;
122 } 100 }
123 return hotTxt.value;
124 } 101 }
125 102
103 if(this.lockButton.pressed && (this.TLRadiusControl === hotTxt)) {
104 this._syncRadii(hotTxt.value, hotTxt.units);
105 }
126 } 106 }
127 } 107 },
108
109 _syncRadii: {
110 value: function(value, units) {
111 this.TRRadiusControl.value = value;
112 this.BLRadiusControl.value = value;
113 this.BRRadiusControl.value = value;
128 114
115 this.TRRadiusControl.units = units;
116 this.BLRadiusControl.units = units;
117 this.BRRadiusControl.units = units;
118 }
119 }
129 120
130}); \ No newline at end of file 121}); \ No newline at end of file