From b89a7ee8b956c96a1dcee995ea840feddc5d4b27 Mon Sep 17 00:00:00 2001 From: Pierre Frisch Date: Thu, 22 Dec 2011 07:25:50 -0800 Subject: First commit of Ninja to ninja-internal Signed-off-by: Valerio Virgillito --- js/panels/properties/content.reel/content.css | 299 ++++++++++++++++++++++ js/panels/properties/content.reel/content.html | 161 ++++++++++++ js/panels/properties/content.reel/content.js | 328 +++++++++++++++++++++++++ 3 files changed, 788 insertions(+) create mode 100644 js/panels/properties/content.reel/content.css create mode 100644 js/panels/properties/content.reel/content.html create mode 100644 js/panels/properties/content.reel/content.js (limited to 'js/panels/properties/content.reel') diff --git a/js/panels/properties/content.reel/content.css b/js/panels/properties/content.reel/content.css new file mode 100644 index 00000000..2537aea2 --- /dev/null +++ b/js/panels/properties/content.reel/content.css @@ -0,0 +1,299 @@ +/* + 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. +
*/ + +.propertiesPanel { + color:#FFF; + overflow-x: hidden; +} + +.propertiesPanel .fieldCol { + display: -webkit-box; + -webkit-box-orient:horizontal; + position:relative; +} + +.propertiesPanel .fieldCol > label { + -webkit-box-flex:0; + text-align: right; + width:46px; + display:block; + padding: 4px 2px 4px 5px; + height:16px; + line-height: 16px; +} + +.propertiesPanel .fieldRow label { +padding-right:6px; + width:20px; + display: inline-block; + text-align: right; +} + + +.propertiesPanel .fieldRow { + padding: 4px 10px 4px 5px; + height:16px; + line-height: 16px; + display:block; + -webkit-box-flex:1; +} + +.propertiesPanel .fieldRow.oneCol div, .propertiesPanel .fieldRow.twoCol div,.propertiesPanel .fieldRow.threeCol div { + -webkit-box-sizing: content-box; + float:left; + +} + +.propertiesPanel hr { + border: 0; + border-top: 1px solid #3c3c3c; + border-bottom: 1px solid #555; +} + +.propertiesPanel input[type='text'] { + width:100%; + padding: 1px; +} + +.propertiesPanel .montage-textfield { + padding: 1px; +} + +.propertiesPanel .fieldRow.threeCol div input[type='text'] { + width:34px; + display: inline-block; +} + +.propertiesPanel .hottextunit input { + width:38px; +} + +.propertiesPanel .fieldRow.threeCol div .inputField { + width:34px; +} +.propertiesPanel .fieldRow.twoCol label { + width:74px; + display: inline-block; + +} + +.propertiesPanel .fieldRow.oneCol label { + width:auto; + display: inline-block; + +} + +.propertiesPanel .fieldRow.oneCol div input[type='text'] { + width:34px; + display: inline-block; +} +.propertiesPanel .fieldRow.oneCol div .inputField { + width:34px; +} + + +.propertiesPanel .fieldRow.twoCol div input[type='text'] { + width:38px; + display: inline-block; +} +.propertiesPanel .fieldRow.twoCol div .inputField { + width:38px; +} + +.propertiesPanel input[type='text'][readonly], .propertiesPanel input[type='text'][readonly]:focus { + border: none; + background: none; + -webkit-box-shadow:none; +} + +.propertiesPanel h2 { + background: #3E3E3E; + font-size:11px; + height:16px; + line-height: 17px; + display:-webkit-box; + -webkit-box-orient:horizontal; + margin: 0px; + border-bottom: 1px solid #3A3A3A; +} +.propertiesPanel .subSectionHeader .arrow { + -webkit-box-flex:0; + margin: 0px 10px; +} + +.propertiesPanel .subSectionHeader .arrowIcon { + background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8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gAABdvkl/FRgAAAP9JREFUeNrEk02KhDAQhV+GCPEELnSVA3gMr+mJbFHxdyTTm25/cJ9aCJlVy9iaYcDFFARS5OV7L4RixhhcqQ9crMsA/tpIKY3WGuu62sWcw3VdKKXYAaC1RhRF8DwPjuPsFuccnHOM44g4js+fIIRA133+GjdJEgghzgFExO73LyzLcnr5+Xwgz3MQEbMmEEKgbdtTwO2WbhpbAhARU0phnuedaBgGFEUBImJEdP4LP8lN08D3/a1P0/TgbEsAImJ932Oaps29LMvN/U8JAKCqKgRBgCzLrO47wBuZdV1nwjBEXdcAwGwA9homKeX7mdFaw3XdA0ApdQT82zB9DwCCtIRuTJsRWAAAAABJRU5ErkJggg==") 0px 0px no-repeat; + -webkit-background-size:cover; + width:15px; + height:15px; +} + +.propertiesPanel .subSectionHeader.collapsed .arrowIcon { + -webkit-transform: rotate(-90deg); +} + +.propertiesPanel .sectional { + padding: 4px; +} + +.propertiesPanel .animated { + -webkit-transition: 0.2s all linear; +} + +.propertiesPanel div.collapsed { + padding: 0px !important; + height:0px !important; + overflow: hidden; +} + +.propertiesPanel .subSectionHeader section { + -webkit-box-flex:1; +} + +.propertiesPanel { + text-shadow: 1px 1px 1px #000; +} + +/* Dropdown layout */ +.propertiesPanel select { + -webkit-appearance: none; + font-size: 10px; + color: white; + background-color: #444; + border: 1px solid #313131; + width: 100%; + -webkit-box-sizing: border-box; + height: 15px; + outline: none; + background-image: url("../../../../images/dropdown-bg.png"); + background-repeat: no-repeat; + background-position: right center; + border-radius: 0px; + padding-left:5px; +} + +/* File Input Field */ +.propertiesPanel .file { + display:-webkit-box; +} +.propertiesPanel .file input { + -webkit-box-flex:1; + width:auto; + display: block; +} +.propertiesPanel .file .source { + border: 1px solid #313131; + background-color: #444; + color:#FFF; + height:16px; + width:20px; + -webkit-box-flex:0; + cursor: pointer; + padding: 0px; +} + +.propertiesPanel .file .source:hover { + background-color:#555; +} + +.propertiesPanel .file .source:active { + background-color: #666; +} + +/* Checkbox layout */ + +.propertiesPanel .fieldRow.checkbox div .inputField { + width:25px; +} + +.propertiesPanel .fieldRow.colorSelect { + height: 20px; +} + +.propertiesPanel .colortoolbar { + width: 105px; + float:left; +} + +.propertiesPanel .colortoolbar div { + margin: 0px 10px 0px 20px; + clear:none; +} + +/* color select */ +.propertiesPanel .colortoolbar button { + width:40px; + height:20px; + clear:none; +} + +.propertiesPanel .LockToolUp, .propertiesPanel .UnLockToolUp { + position: absolute; + left: 105px; + border: none; + background-color: transparent; + top: 2px; + opacity: 0.7; +} + +.propertiesPanel .button:active { + outline: none; +} + +.propertiesPanel .LockToolUp:hover, .propertiesPanel .UnLockToolUp:hover { + opacity: 1; +} + +.propertiesPanel input[type="checkbox"].nj-skinned, .propertiesPanel input[type="radio"].nj-skinned { + position: relative; + overflow: visible; +} + +.propertiesPanel input[type="checkbox"].nj-skinned:checked::after, .propertiesPanel input[type="radio"].nj-skinned:checked::after { + content: ""; +} + +.propertiesPanel input[type="checkbox"].nj-skinned:checked::before { + content: "✔"; +} + +.propertiesPanel input[type="radio"].nj-skinned:checked::before { + content: "•"; +} + +.propertiesPanel input.nj-skinned label { + position: absolute; + top: 0; + left: 15px; + font-size: 10px; + width:55px; + text-align: left; + font-weight: normal; + color:#FFF; +} + +.propertiesPanel input[type='radio'].nj-skinned { + text-indent: 0px; + line-height: 5px; +} + +.propertiesPanel input[type='radio'].nj-skinned label { + left:15px; +} + +input label { + -webkit-user-select: none; +} + +.propertiesPanel .rotation > label { + padding-left:40px; + padding-right:5px; +} + +.propertiesPanel .rotation .fieldRow { + -webkit-box-flex:0; + width:45px; +} \ No newline at end of file diff --git a/js/panels/properties/content.reel/content.html b/js/panels/properties/content.reel/content.html new file mode 100644 index 00000000..ab485323 --- /dev/null +++ b/js/panels/properties/content.reel/content.html @@ -0,0 +1,161 @@ + + + + + + + + + +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+
+
+
+
+
+
+ + \ No newline at end of file diff --git a/js/panels/properties/content.reel/content.js b/js/panels/properties/content.reel/content.js new file mode 100644 index 00000000..fe6faef8 --- /dev/null +++ b/js/panels/properties/content.reel/content.js @@ -0,0 +1,328 @@ +/* +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, + Component = require("montage/ui/component").Component, + PiData = require("js/data/pi/pi-data").PiData, + CustomSection = require("js/panels/properties/sections/custom.reel").CustomSection; + +var ElementsMediator = require("js/mediators/element-mediator").ElementMediator; + +exports.Content = Montage.create(Component, { + + elementName: { + value: null + }, + + elementID: { + value: null + }, + + elementClassName: { + value: null + }, + + customSections: { + value: [] + }, + + _customPi: { + value: null + }, + + customPi: { + get: function() { + return this._customPi; + }, + set: function(value) { + if(this._customPi !== value) { + this._customPi = value; + } + } + }, + + prepareForDraw: { + value : function() { + + this.eventManager.addEventListener("selectionChange", this, false); + + // This will be a toggle option + if(this.application.ninja.appData.PILiveUpdate) { + this.eventManager.addEventListener( "elementChanging", this, false); + } + + this.eventManager.addEventListener( "elementChange", this, false); + + if(this.application.ninja.selectedElements.length === 0) { + this.displayStageProperties(); + } + + this.elementId.element.addEventListener("blur", this, false); + this.elementId.element.addEventListener("keyup", this, false); + } + }, + + /** + * Blur and Key up to handle change in the Element ID field. + */ + handleBlur: { + value: function(event) { + if(this.application.ninja.selectedElements.length) { + ElementsMediator.setAttribute(this.application.ninja.selectedElements[0], "id", this.elementId.value, "Change", "pi"); + } else { + ElementsMediator.setAttribute(this.application.ninja.currentDocument.documentRoot, "id", this.elementId.value, "Change", "pi", this.application.ninja.currentDocument.documentRoot.elementModel.id); + } + } + }, + + handleKeyup: { + value: function(event) { + if(event.keyCode === 13) { + this.elementId.element.blur(); + } + } + }, + + handleElementChanging: { + value: function(event) { +// this.positionSize.leftPosition = parseFloat(ElementsMediator.getProperty(this.application.ninja.selectedElements[0]._element, "left")); +// this.positionSize.topPosition = parseFloat(ElementsMediator.getProperty(this.application.ninja.selectedElements[0]._element, "top")); + } + }, + + handleElementChange: { + value: function(event) { +// console.log("Element Change PI ", event.detail.source); // If the event comes from the pi don't need to update + if(event.detail.source && event.detail.source !== "pi") { + this.positionSize.leftPosition = parseFloat(ElementsMediator.getProperty(this.application.ninja.selectedElements[0]._element, "left")); + this.positionSize.topPosition = parseFloat(ElementsMediator.getProperty(this.application.ninja.selectedElements[0]._element, "top")); + } + } + }, + + handleSelectionChange: { + value: function(event) { + if(event.detail.isDocument) { + this.displayStageProperties(); + } else { + if(this.application.ninja.selectedElements.length === 1) { + this.displayElementProperties(this.application.ninja.selectedElements[0]._element); + } else { + this.displayGroupProperties(this.application.ninja.selectedElements); + } + + } + } + }, + + displayStageProperties: { + value: function() { + var stage = this.application.ninja.currentDocument.documentRoot; + //this is test code please remove + this.elementName = "Stage"; + this.elementId.value = stage.elementModel.id; + this.elementClassName = ""; + + this.positionSize.disablePosition = true; + this.threeD.disableTranslation = true; + + this.positionSize.heightSize = parseFloat(ElementsMediator.getProperty(stage, "height")); + this.positionSize.widthSize = parseFloat(ElementsMediator.getProperty(stage, "width")); + + if(this.customPi !== stage.elementModel.pi) { + this.customPi = stage.elementModel.pi; + this.displayCustomProperties(stage, stage.elementModel.pi); + } + } + }, + + displayElementProperties: { + value: function (el) { + var customPI; + + this.elementName = el.elementModel.selection; + this.elementId.value = el.getAttribute("id") || ""; + this.elementClassName = el.getAttribute("class"); + + this.positionSize.disablePosition = false; + this.threeD.disableTranslation = false; + + this.positionSize.leftPosition = parseFloat(ElementsMediator.getProperty(el, "left")); + this.positionSize.topPosition = parseFloat(ElementsMediator.getProperty(el, "top")); + this.positionSize.heightSize = parseFloat(ElementsMediator.getProperty(el, "height")); + this.positionSize.widthSize = parseFloat(ElementsMediator.getProperty(el, "width")); + + + if(this.threeD.inGlobalMode) + { + this.threeD.x3D = ElementsMediator.get3DProperty(el, "x3D"); + this.threeD.y3D = ElementsMediator.get3DProperty(el, "y3D"); + this.threeD.z3D = ElementsMediator.get3DProperty(el, "z3D"); + this.threeD.xAngle = ElementsMediator.get3DProperty(el, "xAngle"); + this.threeD.yAngle = ElementsMediator.get3DProperty(el, "yAngle"); + this.threeD.zAngle = ElementsMediator.get3DProperty(el, "zAngle"); + } + + // Custom Section + if(this.customPi !== el.elementModel.pi) { + this.customPi = el.elementModel.pi; + this.displayCustomProperties(el, el.elementModel.pi); + } + + customPI = PiData[this.customPi]; + // Get all the custom section for the custom PI + for(var i = 0, customSec; customSec = customPI[i]; i++) { + + // Now set the Fields for the custom PI + for(var j = 0, fields; fields = customSec.Section[j]; j++) { + for(var k = 0, control; control = fields[k]; k++) { + + if(control.prop !== "border-color" && control.prop !== "background-color") { + var currentValue = ElementsMediator.getProperty(el, control.prop, control.valueMutator); + currentValue ? currentValue = currentValue : currentValue = control.defaultValue; + this.customSections[0].content.controls[control.id] = currentValue; + } + } + } + } + + + //TODO: Once logic for color and gradient is established, this needs to be revised + + var color, background, backgroundImage, borderColor = ElementsMediator.getProperty(el, "border-color"), borderImage = ElementsMediator.getProperty(el, "border-image"); + this.application.ninja.colorController.colorModel.input = "stroke"; + if(borderColor || borderImage) { + if (borderImage && borderImage !== 'none' && borderImage.indexOf('-webkit') >= 0) { + //Gradient + color = this.application.ninja.colorController.getColorObjFromCss(borderImage); + if (color && color.value) { + this.application.ninja.colorController.colorModel[color.mode] = {value: color.value, wasSetByCode: true, type: 'change'}; + } else { + this.application.ninja.colorController.colorModel.alpha = {value: 1, wasSetByCode: true, type: 'change'}; + this.application.ninja.colorController.colorModel.applyNoColor(); + } + } else { + //Solid + color = this.application.ninja.colorController.getColorObjFromCss(borderColor); + if (color && color.value) { + color.value.wasSetByCode = true; + color.value.type = 'change'; + if (color.value.a) { + this.application.ninja.colorController.colorModel.alpha = {value: color.value.a, wasSetByCode: true, type: 'change'}; + } + this.application.ninja.colorController.colorModel[color.mode] = color.value; + } else { + this.application.ninja.colorController.colorModel.alpha = {value: 1, wasSetByCode: true, type: 'change'}; + this.application.ninja.colorController.colorModel.applyNoColor(); + } + } + } else { + this.application.ninja.colorController.colorModel.alpha = {value: 1, wasSetByCode: true, type: 'change'}; + this.application.ninja.colorController.colorModel.applyNoColor(); + } + // + background = ElementsMediator.getProperty(el, "background-color"); + backgroundImage = ElementsMediator.getProperty(el, "background-image"); + this.application.ninja.colorController.colorModel.input = "fill"; + if(background || backgroundImage) { + if (backgroundImage && backgroundImage !== 'none' && backgroundImage.indexOf('-webkit') >= 0) { + //Gradient + color = this.application.ninja.colorController.getColorObjFromCss(backgroundImage); + if (color && color.value) { + this.application.ninja.colorController.colorModel[color.mode] = {value: color.value, wasSetByCode: true, type: 'change'}; + } else { + this.application.ninja.colorController.colorModel.alpha = {value: 1, wasSetByCode: true, type: 'change'}; + this.application.ninja.colorController.colorModel.applyNoColor(); + } + } else { + //Solid + color = this.application.ninja.colorController.getColorObjFromCss(background); + if (color && color.value) { + color.value.wasSetByCode = true; + color.value.type = 'change'; + if (color.value.a) { + this.application.ninja.colorController.colorModel.alpha = {value: color.value.a, wasSetByCode: true, type: 'change'}; + } + this.application.ninja.colorController.colorModel[color.mode] = color.value; + } else { + this.application.ninja.colorController.colorModel.alpha = {value: 1, wasSetByCode: true, type: 'change'}; + this.application.ninja.colorController.colorModel.applyNoColor(); + } + } + } else { + this.application.ninja.colorController.colorModel.alpha = {value: 1, wasSetByCode: true, type: 'change'}; + this.application.ninja.colorController.colorModel.applyNoColor(); + } + + + + + + } + }, + + displayGroupProperties: { + value: function (els) { + this.elementName = "Multiple Elements"; + } + }, + + displayCustomProperties: { + value: function() { + var customPI; + + this.customSections = []; + + customPI = PiData[this.customPi]; + + if(customPI) { + //Get all the custom sections for the custom PI + for(var i = 0, customSec; customSec = customPI[i]; i++) { + var customUI = CustomSection.create(); + customUI.fields = customSec.Section; + this.customSections.push({ + name: customSec.label, + content: customUI + }); + } + } + + for(var j = 0, customSections; customSections = this.customSections[j]; j++) { + customSections.content.addEventListener("propertyChange", this, false); + customSections.content.addEventListener("propertyChanging", this, false); + } + + } + }, + + handlePropertyChange: { + value: function(e) { + var newValue; + + e.units ? newValue = e.value + e.units : newValue = e.value; + + if(e.prop === "border-width") {// || e.prop === "border-style") { + ElementsMediator.setProperty(this.application.ninja.selectedElements, "border-style", [this.customSections[0].content.controls.borderStyle], "Change", "pi"); + } else if(e.prop === "border-style") { + ElementsMediator.setProperty(this.application.ninja.selectedElements, "border-width", [this.customSections[0].content.controls.borderWidth + "px"], "Change", "pi"); + } + + ElementsMediator.setProperty(this.application.ninja.selectedElements, e.prop, [newValue], "Change", "pi"); + + } + }, + + handlePropertyChanging: { + value: function(e) { + +// ElementsMediator.setProperty(this.application.ninja.selectedElements, "border-style", [this.customSections[0].content.controls.borderStyle], "Changing", "pi"); + ElementsMediator.setProperty(this.application.ninja.selectedElements, e.prop, [e.value + "px"], "Changing", "pi"); + + + } + } + +}); -- cgit v1.2.3