From b97570f5daff9d0c40f274c2c29a457079da1c1a Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Thu, 17 May 2012 12:23:31 -0700 Subject: fixing the breadcrumb Signed-off-by: Valerio Virgillito --- .../layout/bread-crumb.reel/bread-crumb.html | 37 ++++++++-------------- .../layout/bread-crumb.reel/bread-crumb.js | 24 ++++---------- 2 files changed, 19 insertions(+), 42 deletions(-) (limited to 'js/components') diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.html b/js/components/layout/bread-crumb.reel/bread-crumb.html index ae3e2022..0dabc781 100755 --- a/js/components/layout/bread-crumb.reel/bread-crumb.html +++ b/js/components/layout/bread-crumb.reel/bread-crumb.html @@ -32,30 +32,23 @@ } ], "bindings": { - "label": { - "boundObject": {"@": "repetition1"}, - "boundObjectPropertyPath": "objectAtCurrentIteration.label", - "oneway": true - }, - "value": { - "boundObject": {"@": "repetition1"}, - "boundObjectPropertyPath": "objectAtCurrentIteration.nodeUuid", - "oneway": true - } + "label": {"<-": "@buttonsList.objectAtCurrentIteration.label"}, + "value": {"<-": "@buttonsList.objectAtCurrentIteration.nodeUuid"} + } + }, + + "buttonsListController": { + "prototype": "montage/ui/controller/array-controller", + "bindings": { + "content": {"<<->": "@owner.containerElements"} } }, - "repetition1": { + "buttonsList": { "prototype": "montage/ui/repetition.reel", "properties": { - "element": {"#": "breadcrumb_container"} - }, - "bindings": { - "objects": { - "boundObject": {"@": "owner"}, - "boundObjectPropertyPath": "containerElements", - "oneway": true - } + "element": {"#": "breadcrumb_container"}, + "contentController": {"@": "buttonsListController"} } }, @@ -65,11 +58,7 @@ "element": {"#": "disabledCondition"} }, "bindings": { - "condition": { - "boundObject": {"@": "owner"}, - "boundObjectPropertyPath": "disabled", - "oneway": true - } + "condition": {"<-": "@owner.disabled"} } } } diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.js b/js/components/layout/bread-crumb.reel/bread-crumb.js index c1b021a3..d2a6b1e4 100755 --- a/js/components/layout/bread-crumb.reel/bread-crumb.js +++ b/js/components/layout/bread-crumb.reel/bread-crumb.js @@ -60,30 +60,18 @@ exports.Breadcrumb = Montage.create(Component, { value: function() { var parentNode; - this.containerElements.length = 0; +// delete this.containerElements; + this.containerElements = []; parentNode = this.container; - // This is for the old template support. - // TODO: Remove marker for old template: NINJA-STAGE-REWORK - if(this.application.ninja.currentDocument.documentRoot.id === "UserContent") { - while(parentNode.id !== "UserContent") { - this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName}); - parentNode = parentNode.parentNode; - } - - // This is always the top container which is now hardcoded to body - this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": "Body"}); - } else { - while(parentNode !== this.application.ninja.currentDocument.documentRoot) { - this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName}); - parentNode = parentNode.parentNode; - } - - // This is always the top container which is now hardcoded to body + while(parentNode !== this.application.ninja.currentDocument.documentRoot) { this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName}); + parentNode = parentNode.parentNode; } + // This is always the top container which is now hardcoded to body + this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName}); } }, -- cgit v1.2.3 From 43994432117686f18eb1783418ef83744ae01d79 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 17 May 2012 15:43:40 -0700 Subject: Fixed border radius hot-text linking that was broken by update to montage v.10. Signed-off-by: Nivesh Rajbhandari --- .../rect-properties.reel/rect-properties.html | 49 ++++++++++++-- .../rect-properties.reel/rect-properties.js | 79 +++++++++------------- 2 files changed, 74 insertions(+), 54 deletions(-) (limited to 'js/components') diff --git a/js/components/tools-properties/rect-properties.reel/rect-properties.html b/js/components/tools-properties/rect-properties.reel/rect-properties.html index 42746caa..7aa91314 100755 --- a/js/components/tools-properties/rect-properties.reel/rect-properties.html +++ b/js/components/tools-properties/rect-properties.reel/rect-properties.html @@ -15,8 +15,19 @@ "prototype": "js/components/hottextunit.reel[HotTextUnit]", "properties": { "element": {"#": "TLRadiusControl"}, - "acceptableUnits" : ["px", "pt", "%"] - } + "acceptableUnits" : ["px", "pt", "%"], + "identifier": "TLRadiusControl" + }, + "listeners": [ + { + "type": "change", + "listener": {"@": "owner"} + }, + { + "type": "changing", + "listener": {"@": "owner"} + } + ] }, "hottext2": { @@ -25,7 +36,13 @@ "element": {"#": "TRRadiusControl"}, "acceptableUnits" : ["px", "pt", "%"], "enabled": false - } + }, + "listeners": [ + { + "type": "change", + "listener": {"@": "owner"} + } + ] }, "hottext3": { @@ -34,7 +51,13 @@ "element": {"#": "BLRadiusControl"}, "acceptableUnits" : ["px", "pt", "%"], "enabled": false - } + }, + "listeners": [ + { + "type": "change", + "listener": {"@": "owner"} + } + ] }, "hottext4": { @@ -43,7 +66,13 @@ "element": {"#": "BRRadiusControl"}, "acceptableUnits" : ["px", "pt", "%"], "enabled": false - } + }, + "listeners": [ + { + "type": "change", + "listener": {"@": "owner"} + } + ] }, "lockButton": { @@ -53,8 +82,14 @@ "pressed": true, "pressedClass": "lockUp", "preventFocus": true, - "identifier": "ratio" - } + "identifier": "lockButton" + }, + "listeners": [ + { + "type": "action", + "listener": {"@": "owner"} + } + ] }, "owner": { 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 c1cb3945..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, { _subPrepare: { value: function() { - this.lockButton.identifier = "lockButton"; - this.lockButton.addEventListener("action", this, false); - - this._setBindings([this.TRRadiusControl, this.BLRadiusControl, this.BRRadiusControl]); - this._setCap([this.TLRadiusControl,this.TRRadiusControl, this.BLRadiusControl, this.BRRadiusControl]); - } }, @@ -33,11 +27,8 @@ exports.RectProperties = Montage.create(ToolProperties, { this.TRRadiusControl.enabled = this.BLRadiusControl.enabled = this.BRRadiusControl.enabled = !this.lockButton.pressed; if(this.lockButton.pressed) { - this._setBindings([this.TRRadiusControl, this.BLRadiusControl, this.BRRadiusControl]); - } else { - this._removeBindings([this.TRRadiusControl, this.BLRadiusControl, this.BRRadiusControl]); + this._syncRadii(this.TLRadiusControl.value, this.TLRadiusControl.units); } - } }, @@ -80,57 +71,51 @@ exports.RectProperties = Montage.create(ToolProperties, { get: function() { return this.base._fillMaterial.value; } }, - _setBindings: { - value: function(els) { - var that = this; - els.forEach(function(el) { - Object.defineBinding(el, "value", { - boundObject: that.TLRadiusControl, - boundObjectPropertyPath: "value", - boundValueMutator: function(value) { - if (typeof value === "string") { - return parseFloat(value); - } - - return value; - } - }); - - Object.defineBinding(el, "units", { - boundObject: that.TLRadiusControl, - boundObjectPropertyPath: "units" - }); - }); - } - }, + handleChanging: { + value: function(event) { + if(event.wasSetByCode) { + return; + } - _removeBindings: { - value: function(els) { - els.forEach(function(el) { - Object.deleteBindings(el); - }); + this._setBorderRadius(event); } }, - _setCap: { - value: function(els) { - var that = this; - els.forEach(function(el) { - el.addEventListener("change", that, false); - }); + handleChange: { + value: function(event) { + if(event.wasSetByCode) { + return; + } + + this._setBorderRadius(event); } }, - handleChange: { + _setBorderRadius: { value: function(event) { var hotTxt = event.currentTarget; if(hotTxt.units === "%") { if(hotTxt.value > 50) { hotTxt.maxValue = 50; } - return hotTxt.value; } - + + if(this.lockButton.pressed && (this.TLRadiusControl === hotTxt)) { + this._syncRadii(hotTxt.value, hotTxt.units); + } + } + }, + + _syncRadii: { + value: function(value, units) { + this.TRRadiusControl.value = value; + this.BLRadiusControl.value = value; + this.BRRadiusControl.value = value; + + this.TRRadiusControl.units = units; + this.BLRadiusControl.units = units; + this.BRRadiusControl.units = units; } } + }); \ No newline at end of file -- cgit v1.2.3 From 6636b2729b421740e49142b7e8b1a76540508306 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 17 May 2012 15:46:56 -0700 Subject: Removed unneeded identifier. Signed-off-by: Nivesh Rajbhandari --- .../tools-properties/rect-properties.reel/rect-properties.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'js/components') diff --git a/js/components/tools-properties/rect-properties.reel/rect-properties.html b/js/components/tools-properties/rect-properties.reel/rect-properties.html index 7aa91314..a7bf6a7c 100755 --- a/js/components/tools-properties/rect-properties.reel/rect-properties.html +++ b/js/components/tools-properties/rect-properties.reel/rect-properties.html @@ -15,8 +15,7 @@ "prototype": "js/components/hottextunit.reel[HotTextUnit]", "properties": { "element": {"#": "TLRadiusControl"}, - "acceptableUnits" : ["px", "pt", "%"], - "identifier": "TLRadiusControl" + "acceptableUnits" : ["px", "pt", "%"] }, "listeners": [ { -- cgit v1.2.3 From 7a94696e19b14e15261df516e2ba75e693b1313d Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 18 May 2012 00:21:56 -0700 Subject: enabling basic document switching Signed-off-by: Valerio Virgillito --- js/components/layout/document-entry.reel/document-entry.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/components') diff --git a/js/components/layout/document-entry.reel/document-entry.js b/js/components/layout/document-entry.reel/document-entry.js index ad0236c6..50b3624c 100755 --- a/js/components/layout/document-entry.reel/document-entry.js +++ b/js/components/layout/document-entry.reel/document-entry.js @@ -121,8 +121,8 @@ exports.DocumentEntry = Montage.create(Component, { if(event._event.target.nodeName === "IMG") { this.application.ninja.documentController.closeFile(this.application.ninja.documentController._findDocumentByUUID(this._uuid)); } else { - if(!this._document.isActive) { - this.application.ninja.stage.stageView.switchDocument(this.application.ninja.documentController._findDocumentByUUID(this._uuid)); + if(!this.active) { + this.application.ninja.documentController.switchDocuments(this.application.ninja.currentDocument, this.application.ninja.documentController._findDocumentByUUID(this._uuid)); } } } -- cgit v1.2.3 From 8247cddcc7ddce25a6282e97d304cad9a0f0c4f3 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 18 May 2012 01:06:31 -0700 Subject: fixed the shape subtool not refreshing the icon Signed-off-by: Valerio Virgillito --- js/components/layout/tool-button.reel/tool-button.html | 4 ++++ js/components/layout/tool-button.reel/tool-button.js | 11 ----------- js/components/layout/tools-list.reel/tools-list.html | 12 ++---------- 3 files changed, 6 insertions(+), 21 deletions(-) (limited to 'js/components') diff --git a/js/components/layout/tool-button.reel/tool-button.html b/js/components/layout/tool-button.reel/tool-button.html index 84a6d34e..a329f646 100755 --- a/js/components/layout/tool-button.reel/tool-button.html +++ b/js/components/layout/tool-button.reel/tool-button.html @@ -16,6 +16,10 @@ "prototype": "js/components/layout/tool-button.reel", "properties": { "element": {"#": "toolBarButton"} + }, + "bindings": { + "selected": {"<<->": "@owner.data.selected"}, + "subselected": {"<-": "@owner.data.subtools.selected"} } } } diff --git a/js/components/layout/tool-button.reel/tool-button.js b/js/components/layout/tool-button.reel/tool-button.js index 6cea0dc3..6008c4ec 100755 --- a/js/components/layout/tool-button.reel/tool-button.js +++ b/js/components/layout/tool-button.reel/tool-button.js @@ -48,19 +48,8 @@ exports.ToolButton = Montage.create(Component, { this.element.addEventListener("mousedown", this, false); this.element.addEventListener("dblclick", this, false); - Object.defineBinding(this, "selected", { - boundObject: this.data, - boundObjectPropertyPath: "selected", - oneway: false - }); - if(this.data.container) { this.element.title = this.data.subtools[this._subselected].toolTip; - Object.defineBinding(this, "subselected", { - boundObject: this.data.subtools, - boundObjectPropertyPath: "selected", - oneway: true - }); } this.element.classList.add(this.data.id) diff --git a/js/components/layout/tools-list.reel/tools-list.html b/js/components/layout/tools-list.reel/tools-list.html index d5c33624..df603bf8 100755 --- a/js/components/layout/tools-list.reel/tools-list.html +++ b/js/components/layout/tools-list.reel/tools-list.html @@ -16,11 +16,7 @@ "element": {"#": "toolbutton"} }, "bindings": { - "data": { - "boundObject": {"@": "repetition1"}, - "boundObjectPropertyPath": "objectAtCurrentIteration", - "oneway": true - } + "data": {"<-": "@repetition1.objectAtCurrentIteration"} } }, @@ -30,11 +26,7 @@ "element": {"#": "groupLine"} }, "bindings": { - "condition": { - "boundObject": {"@": "repetition1"}, - "boundObjectPropertyPath": "objectAtCurrentIteration.lastInGroup", - "oneway": true - } + "condition": {"<-": "@repetition1.objectAtCurrentIteration.lastInGroup"} } }, -- cgit v1.2.3 From fdfba499f0b84360b96096fa866a981e96e8756c Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 18 May 2012 16:35:56 -0700 Subject: fixing the color chip for the document root Signed-off-by: Valerio Virgillito --- js/components/ui/color-chip.reel/color-chip.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'js/components') diff --git a/js/components/ui/color-chip.reel/color-chip.js b/js/components/ui/color-chip.reel/color-chip.js index 4e64b2e8..630dcd4b 100755 --- a/js/components/ui/color-chip.reel/color-chip.js +++ b/js/components/ui/color-chip.reel/color-chip.js @@ -33,6 +33,11 @@ var ColorChip = exports.ColorChip = Montage.create(Component, { value: {r:0, g:0, b:0, a:1, css:'rgb(0,0,0)', mode:'rgb'} }, + chipBtn: { + serializable: true, + value: null + }, + changeDelegate: { value: function(event) { this.color = event._event.color; @@ -60,7 +65,7 @@ var ColorChip = exports.ColorChip = Montage.create(Component, { this.icon.style.display = "none"; } - this.chipBtn.props = {side: 'right', align: 'top', wheel: true, palette: true, gradient: true, image: true, offset: this.offset}; + this.chipBtn.props = {side: 'right', align: 'top', wheel: true, palette: true, gradient: true, image: true, nocolor: true, offset: this.offset}; this.application.ninja.colorController.addButton(this.mode, this.chipBtn); } @@ -80,9 +85,13 @@ var ColorChip = exports.ColorChip = Montage.create(Component, { b = colorObj.value.b; a = colorObj.value.a; css = colorObj.css; + this.chipBtn.color(mode, {wasSetByCode: true, type: 'change', color: {r: r, g: g, b: b}, css: css}); + } else { + mode = "nocolor"; + this.chipBtn.color(mode, null); + } - this.chipBtn.color(mode, {wasSetByCode: true, type: 'change', color: {r: r, g: g, b: b}, css: css}); this.chipBtn.addEventListener("change", this, false); } } -- cgit v1.2.3