From 7d3bdf39e6d1534de1848ca2744aed66dfeb5d2a Mon Sep 17 00:00:00 2001 From: Armen Kesablyan Date: Tue, 5 Jun 2012 23:13:03 -0700 Subject: Initial Text Tool Changes Signed-off-by: Armen Kesablyan --- .../text-properties.reel/text-properties.html | 9 +- .../text-properties.reel/text-properties.js | 154 +++++++++------------ 2 files changed, 65 insertions(+), 98 deletions(-) (limited to 'js/components/tools-properties/text-properties.reel') diff --git a/js/components/tools-properties/text-properties.reel/text-properties.html b/js/components/tools-properties/text-properties.reel/text-properties.html index 725e1d22..a3477e99 100755 --- a/js/components/tools-properties/text-properties.reel/text-properties.html +++ b/js/components/tools-properties/text-properties.reel/text-properties.html @@ -93,14 +93,9 @@ "identifier": "btnBold", "pressedLabel": "B", "unpressedLabel": "B" - }, - "listeners": [ - { - "type": "action", - "listener": {"@": "owner"} - } - ] + } }, + "btnItalic": { "prototype": "montage/ui/toggle-button.reel", "properties": { diff --git a/js/components/tools-properties/text-properties.reel/text-properties.js b/js/components/tools-properties/text-properties.reel/text-properties.js index fa2ec066..35d46cc7 100755 --- a/js/components/tools-properties/text-properties.reel/text-properties.js +++ b/js/components/tools-properties/text-properties.reel/text-properties.js @@ -72,7 +72,7 @@ exports.TextProperties = Montage.create(ToolProperties, { handleEditorSelect: { value: function(e) { - this.application.ninja.stage.textTool.updateStates(); + //this.application.ninja.stage.textTool.updateStates(); // this.fontSelection.value = this.application.ninja.stage.textTool.states.fontname; // // for( var i = 0; i < this.fontSize.items.length; i++) { @@ -96,30 +96,6 @@ exports.TextProperties = Montage.create(ToolProperties, { } }, - - handleBtnBoldAction: { - value: function(e) { - this.application.ninja.stage.textTool.doAction("bold"); - } - }, - - handleBtnItalicAction: { - value: function(e) { - this.application.ninja.stage.textTool.doAction("italic"); - } - }, - - handleBtnUnderlineAction: { - value: function(e) { - this.application.ninja.stage.textTool.doAction("underline"); - } - }, - - handleBtnStrikethroughAction: { - value: function(e) { - this.application.ninja.stage.textTool.doAction("strikethrough"); - } - }, handleAlignLeftAction: { value: function(e) { @@ -211,87 +187,83 @@ exports.TextProperties = Montage.create(ToolProperties, { Object.defineBinding(this.btnBold, "pressed", { boundObject: this.application.ninja.stage.textTool, - boundObjectPropertyPath: "states.bold", - boundValueMutator: this.validatePressed, - oneway: true + boundObjectPropertyPath: "bold", + oneway: false }); Object.defineBinding(this.btnItalic, "pressed", { boundObject: this.application.ninja.stage.textTool, - boundObjectPropertyPath: "states.italic", - boundValueMutator: this.validatePressed, - oneway: true + boundObjectPropertyPath: "italic", + oneway: false }); Object.defineBinding(this.btnUnderline, "pressed", { boundObject: this.application.ninja.stage.textTool, - boundObjectPropertyPath: "states.underline", - boundValueMutator: this.validatePressed, - oneway: true + boundObjectPropertyPath: "underline", + oneway: false }); Object.defineBinding(this.btnStrikethrough, "pressed", { boundObject: this.application.ninja.stage.textTool, - boundObjectPropertyPath: "states.strikethrough", - boundValueMutator: this.validatePressed, - oneway: true + boundObjectPropertyPath: "strikeThrough", + oneway: false }); Object.defineBinding(this.alignLeft, "pressed", { boundObject: this.application.ninja.stage.textTool, - boundObjectPropertyPath: "states.justifyleft", - boundValueMutator: this.validatePressed, - oneway: true - }); - - Object.defineBinding(this.alignCenter, "pressed", { - boundObject: this.application.ninja.stage.textTool, - boundObjectPropertyPath: "states.justifycenter", - boundValueMutator: this.validatePressed, - oneway: true - }); - - Object.defineBinding(this.alignRight, "pressed", { - boundObject: this.application.ninja.stage.textTool, - boundObjectPropertyPath: "states.justifyright", - boundValueMutator: this.validatePressed, - oneway: true - }); - - Object.defineBinding(this.alignJustify, "pressed", { - boundObject: this.application.ninja.stage.textTool, - boundObjectPropertyPath: "states.justifyfull", - boundValueMutator: this.validatePressed, - oneway: true - }); - - Object.defineBinding(this.numberedList, "pressed", { - boundObject: this.application.ninja.stage.textTool, - boundObjectPropertyPath: "states.insertorderedlist", - boundValueMutator: this.validatePressed, - oneway: true - }); - - Object.defineBinding(this.bulletedList, "pressed", { - boundObject: this.application.ninja.stage.textTool, - boundObjectPropertyPath: "states.insertunorderedlist", - boundValueMutator: this.validatePressed, - oneway: true - }); - - Object.defineBinding(this.fontSelection, "value", { - boundObject: this.application.ninja.stage.textTool, - boundObjectPropertyPath: "states.fontname", - boundValueMutator: this.validateFont, - oneway: true - }); - - Object.defineBinding(this.fontSize, "value", { - boundObject: this.application.ninja.stage.textTool, - boundObjectPropertyPath: "states.fontsize", - boundValueMutator: this.validateFontSize.bind(this), - oneway: true + boundObjectPropertyPath: "justify", + boundValueMutator: this.validateJustify, + oneway: false }); +// +// Object.defineBinding(this.alignCenter, "pressed", { +// boundObject: this.application.ninja.stage.textTool, +// boundObjectPropertyPath: "justifycenter", +// boundValueMutator: this.validatePressed, +// oneway: true +// }); +// +// Object.defineBinding(this.alignRight, "pressed", { +// boundObject: this.application.ninja.stage.textTool, +// boundObjectPropertyPath: "justifyright", +// boundValueMutator: this.validatePressed, +// oneway: true +// }); +// +// Object.defineBinding(this.alignJustify, "pressed", { +// boundObject: this.application.ninja.stage.textTool, +// boundObjectPropertyPath: "justifyfull", +// boundValueMutator: this.validatePressed, +// oneway: true +// }); +// +// Object.defineBinding(this.numberedList, "pressed", { +// boundObject: this.application.ninja.stage.textTool, +// boundObjectPropertyPath: "insertorderedlist", +// boundValueMutator: this.validatePressed, +// oneway: true +// }); +// +// Object.defineBinding(this.bulletedList, "pressed", { +// boundObject: this.application.ninja.stage.textTool, +// boundObjectPropertyPath: "insertunorderedlist", +// boundValueMutator: this.validatePressed, +// oneway: true +// }); +// +// Object.defineBinding(this.fontSelection, "value", { +// boundObject: this.application.ninja.stage.textTool, +// boundObjectPropertyPath: "fontname", +// boundValueMutator: this.validateFont, +// oneway: true +// }); +// +// Object.defineBinding(this.fontSize, "value", { +// boundObject: this.application.ninja.stage.textTool, +// boundObjectPropertyPath: "states.fontsize", +// boundValueMutator: this.validateFontSize.bind(this), +// oneway: true +// }); this.initialized = true; } @@ -331,8 +303,8 @@ exports.TextProperties = Montage.create(ToolProperties, { handleFontColorChange: { value: function(e) { - this.application.ninja.stage.textTool.element.firstChild.style.color = e._event.color.css; - this.application.ninja.stage.textTool.element.firstChild.focus(); + this.application.ninja.stage.textTool.element.style.color = e._event.color.css; + this.application.ninja.stage.textTool.element.focus(); //this.application.ninja.stage.textTool.doAction("forecolor",e._event.color.css); } -- cgit v1.2.3 From 23aec4144f9d4352ba6d10367288f51d57ba990f Mon Sep 17 00:00:00 2001 From: Armen Kesablyan Date: Sat, 23 Jun 2012 13:44:49 -0700 Subject: Text Tool Fix - Can Not Switch Document when Text Tool Initialized Signed-off-by: Armen Kesablyan --- .../tools-properties/text-properties.reel/text-properties.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'js/components/tools-properties/text-properties.reel') diff --git a/js/components/tools-properties/text-properties.reel/text-properties.js b/js/components/tools-properties/text-properties.reel/text-properties.js index 72a6f034..c5729e98 100755 --- a/js/components/tools-properties/text-properties.reel/text-properties.js +++ b/js/components/tools-properties/text-properties.reel/text-properties.js @@ -296,14 +296,18 @@ exports.TextProperties = Montage.create(ToolProperties, { handleFontSelectionChange: { value: function(e) { - this.application.ninja.stage.textTool.doAction("fontname", this.fontSelection.value); this.application.ninja.stage.textTool.element.focus(); + this.application.ninja.stage.textTool.doAction("fontname", this.fontSelection.value); + + //Note: Set Font Color on selection to ColorChip Component; + //this.this.application.ninja.stage.textTool.foreColor + } }, handleFontColorChange: { value: function(e) { - this.application.ninja.stage.textTool.element.style.color = e._event.color.css; + this.application.ninja.stage.textTool.foreColor = e._event.color.css; this.application.ninja.stage.textTool.element.focus(); //this.application.ninja.stage.textTool.doAction("forecolor",e._event.color.css); -- cgit v1.2.3