From 209e0781e926212bbaaad9e8ca4b61a0c389b30f Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 28 Feb 2012 17:19:42 -0800 Subject: We need to remove color buttons from the color model when updating the PI for selection change. Signed-off-by: Nivesh Rajbhandari --- .../custom-rows/color-select.reel/color-select.html | 4 +++- .../custom-rows/color-select.reel/color-select.js | 21 +++++++++++++++++++++ js/panels/properties/sections/custom.reel/custom.js | 5 +++++ 3 files changed, 29 insertions(+), 1 deletion(-) (limited to 'js/panels/properties/sections') diff --git a/js/panels/properties/sections/custom-rows/color-select.reel/color-select.html b/js/panels/properties/sections/custom-rows/color-select.reel/color-select.html index 9c2588b9..96cc4de7 100755 --- a/js/panels/properties/sections/custom-rows/color-select.reel/color-select.html +++ b/js/panels/properties/sections/custom-rows/color-select.reel/color-select.html @@ -14,7 +14,9 @@ "properties" : { "element" : {"#": "section"}, "Stroke" : {"#": "Stroke"}, - "Fill" : {"#": "Fill"} + "Fill" : {"#": "Fill"}, + "strokeChip" : {"@": "colorChip"}, + "fillChip" : {"@": "colorChip2"} } }, diff --git a/js/panels/properties/sections/custom-rows/color-select.reel/color-select.js b/js/panels/properties/sections/custom-rows/color-select.reel/color-select.js index 60f8efef..3e81ff67 100755 --- a/js/panels/properties/sections/custom-rows/color-select.reel/color-select.js +++ b/js/panels/properties/sections/custom-rows/color-select.reel/color-select.js @@ -17,6 +17,14 @@ exports.ColorSelect = Montage.create(Component, { value: null }, + strokeChip: { + value: null + }, + + fillChip: { + value: null + }, + handleChange: { value: function(e) { @@ -57,6 +65,19 @@ exports.ColorSelect = Montage.create(Component, { // } } + }, + + destroy: { + value: function() { + if(this.strokeChip) + { + this.strokeChip.destroy(); + } + if(this.fillChip) + { + this.fillChip.destroy(); + } + } } }); \ No newline at end of file diff --git a/js/panels/properties/sections/custom.reel/custom.js b/js/panels/properties/sections/custom.reel/custom.js index a2b9b9fa..a537d323 100755 --- a/js/panels/properties/sections/custom.reel/custom.js +++ b/js/panels/properties/sections/custom.reel/custom.js @@ -59,6 +59,8 @@ exports.CustomSection = Montage.create(Component, { if(obj1.visible === false) tmpRow.colorVisible = obj1.visible; if(obj2.visible === false) tmpRow.color2Visible = obj2.visible; + // TODO - Hack for now to reference the color select object to unregister color chips + this.controls["colorSelect"] = tmpRow; } else { @@ -344,6 +346,9 @@ exports.CustomSection = Montage.create(Component, { this.controls[aField.id] = obj; + // TODO - Hack for now to reference the color select object to unregister color chips + this.controls["stageBackground"] = obj; + return obj; } } -- cgit v1.2.3 From 42d78d11764dca5df6c7d01f3221f398bee17152 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Thu, 1 Mar 2012 15:00:48 -0800 Subject: Squashed commit of the workspace-bugs - Panels fixes. Signed-off-by: Valerio Virgillito --- .../color-select.reel/color-select.html | 53 --- .../custom-rows/color-select.reel/color-select.js | 83 ----- .../custom-rows/dual-row.reel/dual-row.html | 67 ---- .../sections/custom-rows/dual-row.reel/dual-row.js | 53 --- .../custom-rows/single-row.reel/single-row.html | 47 --- .../custom-rows/single-row.reel/single-row.js | 50 --- .../properties/sections/custom.reel/custom.html | 61 ---- .../properties/sections/custom.reel/custom.js | 356 --------------------- .../position-and-size.reel/position-and-size.css | 14 - .../position-and-size.reel/position-and-size.html | 142 -------- .../position-and-size.reel/position-and-size.js | 264 --------------- .../sections/three-d-view.reel/three-d-view.html | 348 -------------------- .../sections/three-d-view.reel/three-d-view.js | 265 --------------- 13 files changed, 1803 deletions(-) delete mode 100755 js/panels/properties/sections/custom-rows/color-select.reel/color-select.html delete mode 100755 js/panels/properties/sections/custom-rows/color-select.reel/color-select.js delete mode 100755 js/panels/properties/sections/custom-rows/dual-row.reel/dual-row.html delete mode 100755 js/panels/properties/sections/custom-rows/dual-row.reel/dual-row.js delete mode 100755 js/panels/properties/sections/custom-rows/single-row.reel/single-row.html delete mode 100755 js/panels/properties/sections/custom-rows/single-row.reel/single-row.js delete mode 100755 js/panels/properties/sections/custom.reel/custom.html delete mode 100755 js/panels/properties/sections/custom.reel/custom.js delete mode 100755 js/panels/properties/sections/position-and-size.reel/position-and-size.css delete mode 100755 js/panels/properties/sections/position-and-size.reel/position-and-size.html delete mode 100755 js/panels/properties/sections/position-and-size.reel/position-and-size.js delete mode 100755 js/panels/properties/sections/three-d-view.reel/three-d-view.html delete mode 100755 js/panels/properties/sections/three-d-view.reel/three-d-view.js (limited to 'js/panels/properties/sections') diff --git a/js/panels/properties/sections/custom-rows/color-select.reel/color-select.html b/js/panels/properties/sections/custom-rows/color-select.reel/color-select.html deleted file mode 100755 index 96cc4de7..00000000 --- a/js/panels/properties/sections/custom-rows/color-select.reel/color-select.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - -
-
-
-
-
-
-
-
- - \ No newline at end of file diff --git a/js/panels/properties/sections/custom-rows/color-select.reel/color-select.js b/js/panels/properties/sections/custom-rows/color-select.reel/color-select.js deleted file mode 100755 index 3e81ff67..00000000 --- a/js/panels/properties/sections/custom-rows/color-select.reel/color-select.js +++ /dev/null @@ -1,83 +0,0 @@ -/* -This file contains proprietary software owned by Motorola Mobility, Inc.
-No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
-(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. -
*/ - -var Montage = require("montage/core/core").Montage; -var Component = require("montage/ui/component").Component; - -exports.ColorSelect = Montage.create(Component, { - - Stroke: { - value: null - }, - - Fill: { - value: null - }, - - strokeChip: { - value: null - }, - - fillChip: { - value: null - }, - - handleChange: { - value: function(e) { - - } - }, - - colorVisible: { - value: true - }, - - color2Visible: { - value: true - }, - - divider: { - value: false - }, - - prepareForDraw: { - value: function() { - if (this.divider) { - this.element.appendChild(document.createElement("hr")); - } - if (!this.colorVisible) { - this.Stroke.style.display = "none"; - } - - if (!this.color2Visible) { - this.Fill.style.display = "none"; - } - -// for (var i = 0; i < this.options.length; i ++ ) { -// var tmpOption = new Option(); -// tmpOption.text = this.options[i].name; -// tmpOption.value = this.options[i].value; -// if (i === this.selectedIndex) tmpOption.selected = true -// this.options[i].name = this.element.getElementsByTagName("select")[0].add(tmpOption); -// } - - } - }, - - destroy: { - value: function() { - if(this.strokeChip) - { - this.strokeChip.destroy(); - } - if(this.fillChip) - { - this.fillChip.destroy(); - } - } - } - -}); \ No newline at end of file diff --git a/js/panels/properties/sections/custom-rows/dual-row.reel/dual-row.html b/js/panels/properties/sections/custom-rows/dual-row.reel/dual-row.html deleted file mode 100755 index 0398ff4c..00000000 --- a/js/panels/properties/sections/custom-rows/dual-row.reel/dual-row.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - -
-
- -
-
- -
-
- -
-
- -
-
-
-
- - \ No newline at end of file diff --git a/js/panels/properties/sections/custom-rows/dual-row.reel/dual-row.js b/js/panels/properties/sections/custom-rows/dual-row.reel/dual-row.js deleted file mode 100755 index 72d216ca..00000000 --- a/js/panels/properties/sections/custom-rows/dual-row.reel/dual-row.js +++ /dev/null @@ -1,53 +0,0 @@ -/* -This file contains proprietary software owned by Motorola Mobility, Inc.
-No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
-(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. -
*/ - -var Montage = require("montage/core/core").Montage; -var Component = require("montage/ui/component").Component; - -exports.DualRow = Montage.create(Component, { - id: { - value: null - }, - - label: { - value: null - }, - - label2:{ - value: null - }, - - content: { - value: null - }, - - content2: { - value: null - }, - - eventDelegate: { - value: null - }, - - divider: { - value: false - }, - - prepareForDraw: { - value: function() { - if (this.divider) this.element.appendChild(document.createElement("hr")); - if(this.label !== null) { - this.element.getElementsByClassName("lbl")[0].innerHTML = this.label + ":"; - } - if(this.label2 !== null) { - this.element.getElementsByClassName("lbl")[1].innerHTML = this.label2 + ":"; - } else { - this.element.getElementsByClassName("lbl")[1].style.display = "none"; - } - } - } - -}); \ No newline at end of file diff --git a/js/panels/properties/sections/custom-rows/single-row.reel/single-row.html b/js/panels/properties/sections/custom-rows/single-row.reel/single-row.html deleted file mode 100755 index 27c02380..00000000 --- a/js/panels/properties/sections/custom-rows/single-row.reel/single-row.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - -
-
- -
-
- -
-
-
-
- - \ No newline at end of file diff --git a/js/panels/properties/sections/custom-rows/single-row.reel/single-row.js b/js/panels/properties/sections/custom-rows/single-row.reel/single-row.js deleted file mode 100755 index b606d6b8..00000000 --- a/js/panels/properties/sections/custom-rows/single-row.reel/single-row.js +++ /dev/null @@ -1,50 +0,0 @@ -/* -This file contains proprietary software owned by Motorola Mobility, Inc.
-No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
-(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. -
*/ - -var Montage = require("montage/core/core").Montage; -var Component = require("montage/ui/component").Component; - -exports.SingleRow = Montage.create(Component, { - id: { - value: null - }, - - label: { - value: null - }, - - content: { - value: null - }, - - eventDelegate: { - value: null - }, - - - handleChange: { - value: function(event) { - } - }, - - handleChanging: { - value: function(event) { - this.eventDelegate({"type": "changing", "id": this.id, "prop": this.prop, "text": this.label, "value": this.value}); - } - }, - - divider: { - value: false - }, - - prepareForDraw: { - value: function() { - if (this.divider) this.element.appendChild(document.createElement("hr")); - if(this.label !== null) this.element.getElementsByClassName("lbl")[0].innerHTML = this.label + ":"; - } - } - -}); \ No newline at end of file diff --git a/js/panels/properties/sections/custom.reel/custom.html b/js/panels/properties/sections/custom.reel/custom.html deleted file mode 100755 index 6d4cf0cd..00000000 --- a/js/panels/properties/sections/custom.reel/custom.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - -
-
-
-
-
- - \ No newline at end of file diff --git a/js/panels/properties/sections/custom.reel/custom.js b/js/panels/properties/sections/custom.reel/custom.js deleted file mode 100755 index a537d323..00000000 --- a/js/panels/properties/sections/custom.reel/custom.js +++ /dev/null @@ -1,356 +0,0 @@ -/* -This file contains proprietary software owned by Motorola Mobility, Inc.
-No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
-(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. -
*/ - -var Montage = require("montage/core/core").Montage; -var Component = require("montage/ui/component").Component; -var ElementsMediator = require("js/mediators/element-mediator").ElementMediator; - -//Custom Rows -var SingleRow = require("js/panels/properties/sections/custom-rows/single-row.reel").SingleRow; -var DualRow = require("js/panels/properties/sections/custom-rows/dual-row.reel").DualRow; -var ColorSelect = require("js/panels/properties/sections/custom-rows/color-select.reel").ColorSelect; - -// Components Needed to make this work -var Hottext = require("js/components/hottextunit.reel").HotTextUnit; -var Dropdown = require("js/components/combobox.reel").Combobox; -var TextField = require("js/components/textfield.reel").TextField; -var FileInput = require("js/components/ui/file-input.reel").FileInput; -var Checkbox = require("js/components/checkbox.reel").Checkbox; -var ColorChip = require("js/components/ui/color-chip.reel").ColorChip; - -exports.CustomSection = Montage.create(Component, { - - repeat: { - value: null - }, - - _fields: { - - }, - - fields: { - get: function() { - return this._fields; - }, - set: function(val) { - this.controls = {}; - this.rows = []; - this._fields = val; - for(var i=0; i < this._fields.length; i++) { - var tmpRow, fields; - if(this._fields[i].length === 1) { - fields = this._fields[i][0]; - tmpRow = SingleRow.create(); - tmpRow.content = this.generateObject(fields); - if (fields.label) tmpRow.label = fields.label; - if (fields.divider) tmpRow.divider = fields.divider; - this.rows.push(tmpRow); - } else if(this._fields[i].length === 2) { - - var obj1 = this._fields[i][0]; - var obj2 = this._fields[i][1]; - - - if (obj1.type == "color" && obj2.type == "color") { - tmpRow = Montage.create(ColorSelect); - if(obj1.visible === false) tmpRow.colorVisible = obj1.visible; - if(obj2.visible === false) tmpRow.color2Visible = obj2.visible; - - // TODO - Hack for now to reference the color select object to unregister color chips - this.controls["colorSelect"] = tmpRow; - } - else - { - tmpRow = DualRow.create(); - if (obj1.label) tmpRow.label = obj1.label; - if (obj2.label) tmpRow.label2 = obj2.label; - tmpRow.content = this.generateObject(obj1); - tmpRow.content2 = this.generateObject(obj2); - } - - if (obj1.divider === true || obj2.divider === true) tmpRow.divider = true; - this.rows.push(tmpRow); - - } else if(this._fields[i].length === 3) { - - } - - } - } - - }, - - rows: { - value: [] - }, - - controls: { - value:{} - }, - - handleChanging: { - value:function(event) { - var obj = event.currentTarget; - this._dispatchPropEvent({"type": "changing", "id": obj.id, "prop": obj.prop, "value": obj.value, "control": obj}); - } - }, - - handleChange: { - value:function(event) { - if(event._event.wasSetByCode) return; - - var obj = event.currentTarget; - this._dispatchPropEvent({"type": "change", "id": obj.id, "prop": obj.prop, "value": obj.value, "control": obj}); - } - }, - - /** - * Color change handler. Hard coding the stage for now since only the stage PI uses this color chip - */ - handleColorChange: { - value: function(event) { - // Change the stage color for now - //console.log(this, event); - ElementsMediator.setProperty([this.application.ninja.currentDocument.documentRoot], this.id, [event._event.color.css], "Change", "pi", ''); - /* - var propEvent = document.createEvent("CustomEvent"); - propEvent.initEvent("propertyChange", true, true); - propEvent.type = "propertyChange"; - - propEvent.prop = "background";//event.prop; - propEvent.value = event._event.color.css; - - this.dispatchEvent(propEvent); - */ - } - }, - - _dispatchPropEvent: { - value: function(event) { -// console.log(event); - var propEvent = document.createEvent("CustomEvent"); - if(event.type === "changing") - { - propEvent.initEvent("propertyChanging", true, true); - propEvent.type = "propertyChanging"; - } - else - { - propEvent.initEvent("propertyChange", true, true); - propEvent.type = "propertyChange"; - } - - propEvent.id = event.id; - propEvent.prop = event.prop; - propEvent.text = event.text; - propEvent.value = event.value; - - event.control.units ? propEvent.units = event.control.units : propEvent.units = ""; - - this.dispatchEvent(propEvent); - } - }, - - generateObject: { - value: function(fields) { - switch(fields.type) { - case "hottext" : return this.createHottext(fields); - case "dropdown" : return this.createDropdown(fields); - case "textbox" : return this.createTextField(fields); - case "file" : return this.createFileInput(fields); - case "checkbox" : return this.createCheckbox(fields); - case "chip" : return this.createColorChip(fields); - } - } - }, - - //Breaking Up Switch Case Statement to functions to return a row - createHottext: { - value: function(aField) { - - // Generate Hottext - var obj = Hottext.create(); - - // Set Values for HottextRow - if (aField.id) obj.id = aField.id; - if (aField.value) obj.value = aField.value; - if (aField.acceptableUnits) obj.acceptableUnits = aField.acceptableUnits; - if (aField.unit) obj.units = aField.unit; - if (aField.min) obj._minValue = aField.min; - if (aField.max) obj._maxValue = aField.max; - if (aField.prop) obj.prop = aField.prop; - - //Initiate onChange Events - obj.addEventListener("change", this, false); - obj.addEventListener("changing", this, false); - - //Bind object value to controls list so it can be manipulated - Object.defineBinding(this.controls, aField.id, { - boundObject: obj, - boundObjectPropertyPath: "value" - }); - - return obj; - } - }, - - createDropdown: { - value: function(aField) { - - //Generate Dropdown - var obj = Dropdown.create(); - - // Set Values for Dropdown - if (aField.id) obj.id = aField.id; - if (aField.prop) obj.prop = aField.prop; - if (aField.value) obj.value = aField.value; - if (aField.labelField) obj.labelField = aField.labelField; - if (aField.labelFunction) obj.labelFunction = aField.labelFunction; - if (aField.dataField) obj.dataField = aField.dataField; - if (aField.dataFunction) obj.dataFunction = aField.dataFunction; - if (aField.items) { - if(aField.items.boundObject) { - obj.items = eval(aField.items.boundObject)[aField.items.boundProperty]; - } else { - obj.items = aField.items; - } - } - if (aField.enabled) { - if(aField.enabled.boundObject) { - // TODO - For now, always bind to this.controls[someProperty] - Object.defineBinding(obj, "enabled", { - boundObject: this.controls, - boundObjectPropertyPath: aField.enabled.boundProperty, - oneway: false - }); - } else { - obj.enabled = aField.enabled; - } - } - - obj.addEventListener("change", this, false); -// -// Object.defineBinding(obj, "value", { -// boundObject: this.controls, -// boundObjectPropertyPath: aField.id, -// oneway: false, -// boundValueMutator: function(value) { -// console.log("In the binding ", value); -// return value; -// } -// }); - - Object.defineBinding(this.controls, aField.id, { - boundObject: obj, - boundObjectPropertyPath: "value", - oneway: false - }); - - - obj.needsDraw = true; - - return obj; - } - }, - - createTextField: { - value: function(aField) { - - // Generate Textfield - var obj = TextField.create(); - - // Set Values for TextField - if (aField.id) obj.id = aField.id; - if (aField.value) obj.value = aField.value; - if (aField.prop) obj.prop = aField.prop; - - //Initiate onChange Events - obj.addEventListener("change", this, false); - - //Bind object value to controls list so it can be manipulated - Object.defineBinding(this.controls, aField.id, { - boundObject: obj, - boundObjectPropertyPath: "value" - }); - - return obj; - } - }, - - createFileInput: { - value: function(aField) { - - // Generate Textfield - var obj = TextField.create(); - - // Set Values for TextField - if (aField.id) obj.id = aField.id; - if (aField.value) obj.value = aField.value; - if (aField.prop) obj.prop = aField.prop; - - - //Initiate onChange Events - obj.addEventListener("change", this, false); - - //Bind object value to controls list so it can be manipulated - Object.defineBinding(this.controls, aField.id, { - boundObject: obj, - boundObjectPropertyPath: "value" - }); - - return obj; - } - }, - - createCheckbox: { - value: function(aField) { - - // Generate Textfield - var obj = Checkbox.create(); - - // Set Values for TextField - if (aField.id) obj.id = aField.id; - if (aField.checked) obj.checked = aField.checked; - if (aField.value) obj.label = aField.value; - if (aField.prop) obj.prop = aField.prop; - - //Initiate onChange Events - obj.addEventListener("change", this, false); - - //Bind object value to controls list so it can be manipulated - Object.defineBinding(this.controls, aField.id, { - boundObject: obj, - boundObjectPropertyPath: "checked" - }); - - return obj; - } - }, - - createColorChip: { - value: function(aField) { - var obj = ColorChip.create(); - - obj.chip = true; - obj.iconType = "fillIcon"; - obj.mode = "chip"; - obj.offset = 0; - - if (aField.id) obj.id = aField.id; - if (aField.prop) obj.prop = aField.prop; - - obj.changeDelegate = this.handleColorChange; - - this.controls[aField.id] = obj; - - // TODO - Hack for now to reference the color select object to unregister color chips - this.controls["stageBackground"] = obj; - - return obj; - } - } - -}); \ No newline at end of file diff --git a/js/panels/properties/sections/position-and-size.reel/position-and-size.css b/js/panels/properties/sections/position-and-size.reel/position-and-size.css deleted file mode 100755 index 227a232b..00000000 --- a/js/panels/properties/sections/position-and-size.reel/position-and-size.css +++ /dev/null @@ -1,14 +0,0 @@ -/* - This file contains proprietary software owned by Motorola Mobility, Inc.
- No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
- (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. -
*/ - -.fieldCol .hide { - display: none; -} - -.fieldCol .disabled -{ - color:#999999; -} \ No newline at end of file diff --git a/js/panels/properties/sections/position-and-size.reel/position-and-size.html b/js/panels/properties/sections/position-and-size.reel/position-and-size.html deleted file mode 100755 index 79a55385..00000000 --- a/js/panels/properties/sections/position-and-size.reel/position-and-size.html +++ /dev/null @@ -1,142 +0,0 @@ - - - - - - - - -
-
- -
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
- - -
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
- - \ No newline at end of file diff --git a/js/panels/properties/sections/position-and-size.reel/position-and-size.js b/js/panels/properties/sections/position-and-size.reel/position-and-size.js deleted file mode 100755 index 49117090..00000000 --- a/js/panels/properties/sections/position-and-size.reel/position-and-size.js +++ /dev/null @@ -1,264 +0,0 @@ -/* -This file contains proprietary software owned by Motorola Mobility, Inc.
-No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
-(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. -
*/ - -var Montage = require("montage/core/core").Montage; -var Component = require("montage/ui/component").Component; - -exports.PosSize = Montage.create(Component, { - leftPosition: { - value: 0 - }, - - topPosition: { - value: 0 - }, - - heightSize: { - value: 0 - }, - - widthSize: { - value: 0 - }, - - savedPosition: { - value: null - }, - - aspectRatioWidth: { - value: null - }, - - aspectRatioHeight: { - value: null - }, - - _disablePosition: { - value: true - }, - - disablePosition: { - get: function () { - return this._disablePosition; - }, - set: function (value) { - if(value !== this._disablePosition) { - this._disablePosition = value; - this.needsDraw = true; - } - } - }, - - prepareForDraw: { - value: function() { - this.leftControl.identifier = "left"; - this.leftControl.addEventListener("change", this, false); - this.leftControl.addEventListener("changing", this, false); - - this.topControl.identifier = "top"; - this.topControl.addEventListener("change", this, false); - this.topControl.addEventListener("changing", this, false); - - this.heightControl.identifier = "height"; - this.heightControl.addEventListener("change", this, false); - this.heightControl.addEventListener("changing", this, false); - - this.widthControl.identifier = "width"; - this.widthControl.addEventListener("change", this, false); - this.widthControl.addEventListener("changing", this, false); - - this.bindButton.identifier = "ratio"; - this.bindButton.addEventListener("action", this, false); - - } - }, - - draw: { - value: function() { - if(this._disablePosition) { - this.leftPosition = 0; - this.leftControl.enabled = false; - this.topPosition = 0; - this.topControl.enabled = false; - this.leftLabel.classList.add("disabled"); - this.topLabel.classList.add("disabled"); - } else { - this.leftControl.enabled = true; - this.topControl.enabled = true; - this.leftLabel.classList.remove("disabled"); - this.topLabel.classList.remove("disabled"); - } - } - }, - - /** - * Calculate the current aspect ration when the bind button is pressed. - * If one of the values is 0, then use 1:1 as the ratio; - */ - handleRatioAction: { - value: function() { - if(this.bindButton.value) { - this.aspectRatioWidth = this.heightControl.value / this.widthControl.value; - if(isNaN(this.aspectRatioWidth) || !isFinite(this.aspectRatioWidth) || this.aspectRatioWidth === 0) this.aspectRatioWidth = 1; - - this.aspectRatioHeight = this.widthControl.value / this.heightControl.value; - if(isNaN(this.aspectRatioHeight) || !isFinite(this.aspectRatioHeight) || this.aspectRatioHeight === 0) this.aspectRatioHeight = 1; - } else { - this.aspectRatioWidth = 1; - this.aspectRatioHeight = 1; - } - } - }, - - handleLeftChange: { - value: function(event) { - var prevPosition; - - if(!event.wasSetByCode) { - if(this.savedPosition) prevPosition = [this.savedPosition + "px"]; - - this.application.ninja.elementMediator.setProperty(this.application.ninja.selectedElements, "left", [this.leftControl.value + "px"] , "Change", "pi", prevPosition); - this.savedPosition = null; - } - } - }, - - handleTopChange: { - value: function(event) { - var prevPosition; - - if(!event.wasSetByCode) { - if(this.savedPosition) prevPosition = [this.savedPosition + "px"]; - - this.application.ninja.elementMediator.setProperty(this.application.ninja.selectedElements, "top", [this.topControl.value + "px"] , "Change", "pi", prevPosition); - this.savedPosition = null; - } - } - }, - - handleHeightChange: { - value: function(event) { - var prevPosition, items; - - if(!event.wasSetByCode) { - if(this.savedPosition) prevPosition = [this.savedPosition + "px"]; - - this.application.ninja.selectedElements.length ? items = this.application.ninja.selectedElements : items = [this.application.ninja.currentDocument.documentRoot]; - - if(this.bindButton.value) { - - var newWidth = Math.round(this.aspectRatioHeight * this.heightControl.value); - - if(!isFinite(newWidth)) newWidth = this.heightControl.value; - - this.widthControl.value = newWidth; - this.application.ninja.elementMediator.setProperty(items, "width", [newWidth + "px"] , "Change", "pi"); - } - - this.application.ninja.elementMediator.setProperty(items, "height", [this.heightControl.value + "px"] , "Change", "pi", prevPosition); - this.savedPosition = null; - } - } - }, - - handleWidthChange: { - value: function(event) { - var prevPosition, items; - - if(!event.wasSetByCode) { - if(this.savedPosition) prevPosition = [this.savedPosition + "px"]; - - this.application.ninja.selectedElements.length ? items = this.application.ninja.selectedElements : items = [this.application.ninja.currentDocument.documentRoot]; - - if(this.bindButton.value) { - - var newHeight = Math.round(this.aspectRatioWidth * this.widthControl.value); - - if(!isFinite(newHeight)) newHeight = this.widthControl.value; - - this.heightControl.value = newHeight; - this.application.ninja.elementMediator.setProperty(items, "height", [newHeight + "px"] , "Change", "pi"); - - } - - this.application.ninja.elementMediator.setProperty(items, "width", [this.widthControl.value + "px"] , "Change", "pi", prevPosition); - this.savedPosition = null; - - } - - } - }, - - handleLeftChanging: { - value: function(event) { - if(!event.wasSetByCode) { - if(!this.savedPosition) this.savedPosition = this.leftPosition; - this.application.ninja.elementMediator.setProperty(this.application.ninja.selectedElements, "left", [this.leftControl.value + "px"] , "Changing", "pi"); - } - - } - }, - - handleTopChanging: { - value: function(event) { - if(!event.wasSetByCode) { - if(!this.savedPosition) this.savedPosition = this.topPosition; - this.application.ninja.elementMediator.setProperty(this.application.ninja.selectedElements, "top", [this.topControl.value + "px"] , "Changing", "pi"); - } - - } - }, - - handleHeightChanging: { - value: function(event) { - var items; - if(!event.wasSetByCode) { - - if(!this.savedPosition) this.savedPosition = this.heightSize; - - this.application.ninja.selectedElements.length ? items = this.application.ninja.selectedElements : items = [this.application.ninja.currentDocument.documentRoot]; - - if(this.bindButton.value) { - - var newWidth = Math.round(this.aspectRatioHeight * this.heightControl.value); - - if(!isFinite(newWidth)) newWidth = this.heightControl.value; - - this.widthControl.value = newWidth; - this.application.ninja.elementMediator.setProperty(items, "width", [newWidth + "px"] , "Changing", "pi"); - } - - this.application.ninja.elementMediator.setProperty(items, "height", [this.heightControl.value + "px"] , "Changing", "pi"); - - } - } - }, - - handleWidthChanging: { - value: function(event) { - var items; - if(!event.wasSetByCode) { - - if(!this.savedPosition) this.savedPosition = this.widthSize; - - this.application.ninja.selectedElements.length ? items = this.application.ninja.selectedElements : items = [this.application.ninja.currentDocument.documentRoot]; - - if(this.bindButton.value) { - var newHeight = Math.round(this.aspectRatioWidth * this.widthControl.value); - - if(!isFinite(newHeight)) newHeight = this.widthControl.value; - - this.heightControl.value = newHeight; - this.application.ninja.elementMediator.setProperty(items, "height", [newHeight + "px"] , "Changing", "pi"); - } - - this.application.ninja.elementMediator.setProperty(items, "width", [this.widthControl.value + "px"] , "Changing", "pi"); - } - } - } - - -}); \ No newline at end of file diff --git a/js/panels/properties/sections/three-d-view.reel/three-d-view.html b/js/panels/properties/sections/three-d-view.reel/three-d-view.html deleted file mode 100755 index 1e24cb55..00000000 --- a/js/panels/properties/sections/three-d-view.reel/three-d-view.html +++ /dev/null @@ -1,348 +0,0 @@ - - - - - - - -
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
- -
-
-
- -
-
-
-
-
-
-
-
-
- -
-
-
- -
-
- -
-
-
-
-
- - \ No newline at end of file diff --git a/js/panels/properties/sections/three-d-view.reel/three-d-view.js b/js/panels/properties/sections/three-d-view.reel/three-d-view.js deleted file mode 100755 index 35591afa..00000000 --- a/js/panels/properties/sections/three-d-view.reel/three-d-view.js +++ /dev/null @@ -1,265 +0,0 @@ -/* -This file contains proprietary software owned by Motorola Mobility, Inc.
-No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
-(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. -
*/ - -var Montage = require("montage/core/core").Montage; -var Component = require("montage/ui/component").Component; - -exports.ThreeD = Montage.create(Component, { - - inGlobalMode: { - value: false - }, - - // TODO - booleans not working with boundValueMutator when bound to selectedIndex, so using index - // 0 = local; 1 = global - _axisMode: { - value: 0 - }, - - axisMode: { - get: function() { - return this._axisMode; - }, - set: function(value) { - this._axisMode = value; - - if(value === 0) - { - this.inGlobalMode = false; - this.x3D = 0; - this.y3D = 0; - this.z3D = 0; - - this.xAngle = 0; - this.yAngle = 0; - this.zAngle = 0; - } - else - { - this.inGlobalMode = true; - var item = this.item; - if(item) - { - this.x3D = item.elementModel.props3D.x3D; - this.y3D = item.elementModel.props3D.y3D; - this.z3D = item.elementModel.props3D.z3D; - - this.xAngle = item.elementModel.props3D.xAngle; - this.yAngle = item.elementModel.props3D.yAngle; - this.zAngle = item.elementModel.props3D.zAngle; - } - } - } - }, - - x3D: { - value: 0 - }, - - y3D: { - value: 0 - }, - - z3D: { - value: 0 - }, - - xAngle: { - value: 0 - }, - - yAngle: { - value: 0 - }, - - zAngle: { - value: 0 - }, - - _disableTranslation: { - value: true - }, - - disableTranslation: { - get: function () { - return this._disableTranslation; - }, - set: function (value) { - if(value !== this._disableTranslation) { - this._disableTranslation = value; - this.needsDraw = true; - } - } - }, - - item: { - value: null - }, - - _curMat: { - value: null - }, - - _curProp: { - value: null - }, - - handleChange: { - value: function(event) { - if(event.wasSetByCode) { - return; - } - - this.apply3DProperties(event.currentTarget.identifier, - event.currentTarget, - this.item, - this.inGlobalMode, - false); - - this._curMat = null; - this._curProp = null; - } - }, - - handleChanging: { - value: function(event) { - if(event.wasSetByCode) { - return; - } - - this.apply3DProperties(event.currentTarget.identifier, - event.currentTarget, - this.item, - this.inGlobalMode, - true); - } - }, - - apply3DProperties : { - value : function(prop, value, item, inGlobalMode, isChanging){ - if(!this._curMat) - { - this._curMat = this.application.ninja.elementMediator.getMatrix(item); - } - var curMat = this._curMat; - var delta = value.value; - if(inGlobalMode) - { - if(!this._curProp) - { - this._curProp = this.application.ninja.elementMediator.get3DProperty(item, prop); - } - delta -= this._curProp; - } - - var xFormMat = Matrix.I(4); - switch (prop) - { - case "xAngle": - xFormMat = Matrix.RotationX(MathUtils.DEG_TO_RAD * delta); - break; - case "yAngle": - xFormMat = Matrix.RotationY(MathUtils.DEG_TO_RAD