From 495a56081219c0c77814cb72f2d787195ef58285 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') 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 792c83a0fe8f7f22d139684ed6d711a2c334c098 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Thu, 17 May 2012 16:55:19 -0700 Subject: Adding component initialization on open This is for opening components, selection is still not reflecting component data. --- js/document/views/design.js | 29 +++++++++-------- js/mediators/io-mediator.js | 78 +++++++++++++++++++++++++-------------------- 2 files changed, 59 insertions(+), 48 deletions(-) (limited to 'js') diff --git a/js/document/views/design.js b/js/document/views/design.js index 2ccb82d1..bd8c25ec 100755 --- a/js/document/views/design.js +++ b/js/document/views/design.js @@ -184,8 +184,7 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { this._bodyFragment = null; //Calling standard method to finish opening document this.bodyContentLoaded(null); - - // TODO: Clean up this code + //TODO: Move this to be set via the controller this.application.ninja.stage.documentOffsetLeft = parseInt((this.document.body.scrollWidth - this._template.size.width)/2); this.application.ninja.stage.documentOffsetTop = parseInt((this.document.body.scrollHeight - this._template.size.height)/2); } @@ -243,17 +242,15 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { } } } - //Checking and initializing webGL + //Checking for script tags then parsing check for montage and webgl if (scripttags.length > 0) { + //Checking and initializing webGL this.initWebGl(scripttags); - } //Else there is not data to parse - - - - //TODO: Load Montage Components (blocking) - //this.initMontage(); - - + //Checking and initializing Montage + this.initMontage(scripttags); + } else { + //Else there is not data to parse + } //Makign callback if specified if (this._callback) this._callback(); } @@ -350,8 +347,14 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { //////////////////////////////////////////////////////////////////// // initMontage: { - value: function () { - //initWithDocument(window.document) instantiateWithOwnerAndDocument(null, window.document) + value: function (scripttags) { + // + this.iframe.contentWindow.document.body.addEventListener('mjsTemplateReady', function () { + //Initializing template with user's seriliazation + var template = this.iframe.contentWindow.mjsTemplate.create(); + template.initWithDocument(this.iframe.contentWindow.document); + template.instantiateWithOwnerAndDocument(null, this.iframe.contentWindow.document, function (e){/*Nothing just a required extra parameter*/}); + }.bind(this), false); } }, //////////////////////////////////////////////////////////////////// diff --git a/js/mediators/io-mediator.js b/js/mediators/io-mediator.js index b1916446..c506e186 100644 --- a/js/mediators/io-mediator.js +++ b/js/mediators/io-mediator.js @@ -225,7 +225,7 @@ exports.IoMediator = Montage.create(Component, { mjsCreator = template.mjsTemplateCreator.create(), mJsSerialization, montageTemplate; - // + //Creating instance of template creator montageTemplate = mjsCreator.initWithDocument(template.document); //Setting up expression for parsing URLs regexRootUrl = new RegExp(rootUrl.replace(/\//gi, '\\\/'), 'gi'); @@ -239,7 +239,6 @@ exports.IoMediator = Montage.create(Component, { template.file.content.document.head.innerHTML = template.head.innerHTML.replace(regexRootUrl, ''); template.file.content.document.body.innerHTML = template.body.innerHTML.replace(regexRootUrl, ''); } - //Copying attributes to maintain same properties as the for (var n in template.body.attributes) { if (template.body.attributes[n].value) { @@ -250,6 +249,7 @@ exports.IoMediator = Montage.create(Component, { //TODO: Add attribute copying for and + //console.log(template.file.content.document.getElementsByTagName('html')[0].innerHTML); //Getting all CSS (style or link) tags @@ -266,7 +266,7 @@ exports.IoMediator = Montage.create(Component, { } ////////////////////////////////////////////////// - // + //Adding to tags to be removed form template for (var f in njtemplatetags) { if (njtemplatetags[f].getAttribute) toremovetags.push(njtemplatetags[f]); } @@ -405,6 +405,31 @@ exports.IoMediator = Montage.create(Component, { } } } + // + var matchingtags = [], scripts = template.file.content.document.getElementsByTagName('script'), webgltag, webgljstag, webgllibtag, webglrdgetag, mjstag, mjslibtag; + // + for (var i in scripts) { + if (scripts[i].getAttribute) { + if (scripts[i].getAttribute('data-ninja-webgl') !== null) {//TODO: Use querySelectorAll + matchingtags.push(scripts[i]); + } + if (scripts[i].getAttribute('data-ninja-webgl-js') !== null) { + webgljstag = scripts[i]; // TODO: Add logic to delete unneccesary tags + } + if (scripts[i].getAttribute('data-ninja-webgl-lib') !== null) { + webgllibtag = scripts[i]; // TODO: Add logic to delete unneccesary tags + } + if (scripts[i].getAttribute('data-ninja-webgl-rdge') !== null) { + webglrdgetag = scripts[i]; // TODO: Add logic to delete unneccesary tags + } + if (scripts[i].getAttribute('type') === 'text/montage-serialization') { + mjstag = scripts[i]; // TODO: Add logic to delete unneccesary tags + } + if (scripts[i].getAttribute('data-mjs-lib') !== null) { + mjslibtag = scripts[i]; // TODO: Add logic to delete unneccesary tags + } + } + } //Checking for webGL elements in document if (template.webgl && template.webgl.length > 1) {//TODO: Should be length 0, hack for a temp fix var rdgeDirName, rdgeVersion; @@ -420,31 +445,6 @@ exports.IoMediator = Montage.create(Component, { } } // - var json, matchingtags = [], webgltag, scripts = template.file.content.document.getElementsByTagName('script'), webgljstag, webgllibtag, webglrdgetag, mjstag, mjslibtag; - // - for (var i in scripts) { - if (scripts[i].getAttribute) { - if (scripts[i].getAttribute('data-ninja-webgl') !== null) {//TODO: Use querySelectorAll - matchingtags.push(scripts[i]); - } - if (scripts[i].getAttribute('data-ninja-webgl-js') !== null) { - webgljstag = scripts[i]; // TODO: Add logic to delete unneccesary tags - } - if (scripts[i].getAttribute('data-ninja-webgl-lib') !== null) { - webgllibtag = scripts[i]; // TODO: Add logic to delete unneccesary tags - } - if (scripts[i].getAttribute('data-ninja-webgl-rdge') !== null) { - webglrdgetag = scripts[i]; // TODO: Add logic to delete unneccesary tags - } - if (scripts[i].getAttribute('type') === 'text/montage-serialization') { - mjstag = scripts[i]; // TODO: Add logic to delete unneccesary tags - } - if (scripts[i].getAttribute('data-mjs-lib') !== null) { - mjslibtag = scripts[i]; // TODO: Add logic to delete unneccesary tags - } - } - } - // if (matchingtags.length) { if (matchingtags.length === 1) { webgltag = matchingtags[0]; @@ -510,7 +510,7 @@ function loadWebGL (e) {\n\ }\ "; //TODO: This data should be saved to a JSON file eventually - json = '\n({\n\t"version": "' + rdgeVersion + '",\n\t"directory": "' + rdgeDirName + '/",\n\t"data": ['; + var json = '\n({\n\t"version": "' + rdgeVersion + '",\n\t"directory": "' + rdgeDirName + '/",\n\t"data": ['; //Looping through data to create escaped array for (var j = 0; template.webgl[j]; j++) { if (j === 0) { @@ -524,11 +524,6 @@ function loadWebGL (e) {\n\ //Setting string in tag webgltag.innerHTML = json; } - - - - - //Checking for Montage if (mJsSerialization) { //Copy Montage library if needed @@ -538,8 +533,21 @@ function loadWebGL (e) {\n\ mjsDirName = (this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name + this.application.ninja.coreIoApi.ninjaLibrary.libs[i].version).toLowerCase(); mjsVersion = this.application.ninja.coreIoApi.ninjaLibrary.libs[i].version; this.application.ninja.coreIoApi.ninjaLibrary.copyLibToCloud(template.file.root, mjsDirName); + + + //TODO: Fix to allow no overwrite and nested locations - var packjson = this.application.ninja.coreIoApi.createFile({ uri: template.file.root + 'package.json', contents: '{"mappings": {"montage": "' + mjsDirName + '/montage/"}}' }); + var mjsCheck, mjsPath = template.file.root + 'package.json'; + mjsCheck = this.application.ninja.coreIoApi.fileExists({uri: mjsPath}); + // + if (!mjsCheck || mjsCheck.status !== 204) { + var packjson = this.application.ninja.coreIoApi.createFile({ uri: mjsPath, contents: '{"mappings": {"montage": "' + mjsDirName + '/montage/"}}' }); + } else { + //Already exists + } + + + } else { //TODO: Error handle no available library to copy } -- cgit v1.2.3 From eff40602cac6821f8272177c24b6bf3de399f8b1 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Thu, 17 May 2012 21:11:33 -0700 Subject: multiple documents - enable opening multiple documents and initial switching Signed-off-by: Valerio Virgillito --- js/controllers/document-controller.js | 71 +++++++++++++++++------------------ js/document/document-html.js | 2 - 2 files changed, 35 insertions(+), 38 deletions(-) (limited to 'js') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index cf46e73e..50874725 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -454,58 +454,57 @@ var DocumentController = exports.DocumentController = Montage.create(Component, // Open document callback _onOpenDocument: { value: function(doc){ - + var currentDocument; if(this.activeDocument) { // There is a document currently opened - - + currentDocument = this.activeDocument; //this.application.ninja.stage.stageView.showCodeViewBar(false); //this.application.ninja.stage.stageView.restoreAllPanels(); - // - /* - if(this.activeDocument.currentView === "design"){ - this.activeDocument.saveAppState(); - this.activeDocument.container.parentNode.style["display"] = "none"; - this.application.ninja.stage.hideCanvas(true); - this.application.ninja.stage.stageView.hideRulers(); - } + //this.activeDocument.saveAppState(); - this.activeDocument.container.style["display"] = "none"; - */ - - /* - this.activeDocument.container.style["display"] = "block"; - if(this.activeDocument.currentView === "design"){ - this.activeDocument.container.parentNode.style["display"] = "block"; - this.activeDocument.restoreAppState(); - }else{ - //hide the iframe when switching to code view - document.getElementById("iframeContainer").style.display = "none"; - } - - */ - // hide current document + // TODO: Do we need this? + //this.application.ninja.stage.hideCanvas(true); + //this.application.ninja.stage.stageView.hideRulers(); + + //this.activeDocument.restoreAppState(); } else { // There is no document opened - // Set the active document - this.activeDocument = doc; + // Show the rulers + // TODO: Move this indo design view + this.application.ninja.stage.stageView.showRulers(); // Show the canvas this.application.ninja.stage.hideCanvas(false); + } - // Show the rulers - // TODO: Move this indo design view - this.application.ninja.stage.stageView.showRulers(); - // Initialize the documentRoot styles - this.initializeRootStyles(doc.documentRoot); - // Flag to stop stylesheet dirty event - this._hackInitialStyles = false; + // Set the active document + this.activeDocument = doc; + + // Initialize the documentRoot styles + this.initializeRootStyles(doc.documentRoot); + // Flag to stop stylesheet dirty event + this._hackInitialStyles = false; + + this.switchDocuments(currentDocument, doc); + + NJevent("onOpenDocument", doc); + + //Setting opacity to be viewable after load + //doc.model.views.design.iframe.style.opacity = 1; + + } + }, + + switchDocuments: { + value: function(current, newDocument) { + newDocument.model.views.design.iframe.style.opacity = 1; - NJevent("onOpenDocument", doc); + if(current) { + current.model.views.design.hide(); } } }, diff --git a/js/document/document-html.js b/js/document/document-html.js index 56d9db02..c77ed7bc 100755 --- a/js/document/document-html.js +++ b/js/document/document-html.js @@ -119,8 +119,6 @@ exports.HtmlDocument = Montage.create(Component, { this._observer = null; //Making callback after view is loaded this.loaded.callback.call(this.loaded.context, this); - //Setting opacity to be viewable after load - this.model.views.design.iframe.style.opacity = 1; } }, //////////////////////////////////////////////////////////////////// -- cgit v1.2.3 From b72c5f72ea5df4aa164350e1ba66fd1b4e23369d Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Thu, 17 May 2012 23:07:48 -0700 Subject: removing all stageDeps for drawing classes. Signed-off-by: Valerio Virgillito --- js/helper-classes/3D/draw-utils.js | 2 +- js/helper-classes/3D/snap-manager.js | 13 ++------ js/helper-classes/3D/view-utils.js | 53 ++++++++++++------------------- js/stage/stage-deps.js | 61 +++++------------------------------- js/stage/stage.reel/stage.html | 3 -- js/tools/drawing-tool-base.js | 39 ++++++++--------------- 6 files changed, 45 insertions(+), 126 deletions(-) (limited to 'js') diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index a6d2d899..a8bc16ef 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js @@ -138,7 +138,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { l, t, plane, - elt + elt; for(i=0; i --- js/helper-classes/3D/draw-utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js') diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index a8bc16ef..bf48a723 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js @@ -124,7 +124,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { this._eltArray = []; this._planesArray = []; this.setDrawingSurfaceElement(stage.canvas); - this.setSourceSpaceElement( stage.stageDeps.currentStage ); + this.setSourceSpaceElement( this.application.ninja.currentDocument.documentRoot); this.setWorkingPlane( [0,0,1,0] ); //Loop through all the top-level children of the current document and call drawUtils.addElement on them -- 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 --- .../layout/document-entry.reel/document-entry.js | 4 +- js/controllers/document-controller.js | 37 +++++----- js/controllers/selection-controller.js | 4 +- js/document/document-html.js | 20 +++++- js/document/html-document.js | 78 +--------------------- js/document/models/base.js | 2 +- js/ninja.reel/ninja.js | 17 ++++- js/panels/properties.reel/properties.js | 16 ----- js/stage/stage-deps.js | 13 ++-- js/stage/stage-view.reel/stage-view.js | 22 ------ 10 files changed, 59 insertions(+), 154 deletions(-) (limited to 'js') 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)); } } } diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 50874725..fc1f2c0f 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -459,16 +459,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, // There is a document currently opened currentDocument = this.activeDocument; - //this.application.ninja.stage.stageView.showCodeViewBar(false); //this.application.ninja.stage.stageView.restoreAllPanels(); - - //this.activeDocument.saveAppState(); - - // TODO: Do we need this? - //this.application.ninja.stage.hideCanvas(true); - //this.application.ninja.stage.stageView.hideRulers(); - - //this.activeDocument.restoreAppState(); } else { // There is no document opened @@ -480,7 +471,6 @@ var DocumentController = exports.DocumentController = Montage.create(Component, this.application.ninja.stage.hideCanvas(false); } - // Set the active document this.activeDocument = doc; @@ -489,22 +479,27 @@ var DocumentController = exports.DocumentController = Montage.create(Component, // Flag to stop stylesheet dirty event this._hackInitialStyles = false; - this.switchDocuments(currentDocument, doc); - - NJevent("onOpenDocument", doc); - - //Setting opacity to be viewable after load - //doc.model.views.design.iframe.style.opacity = 1; - + this.switchDocuments(currentDocument, doc, true); } }, switchDocuments: { - value: function(current, newDocument) { - newDocument.model.views.design.iframe.style.opacity = 1; + value: function(currentDocument, newDocument, didCreate) { + + if(currentDocument) { + currentDocument.serializeDocument(); - if(current) { - current.model.views.design.hide(); + currentDocument.model.views.design.hide(); + } + + if(didCreate) { + newDocument.model.views.design.iframe.style.opacity = 1; + NJevent("onOpenDocument", newDocument); + } else { + this.activeDocument = newDocument; + newDocument.model.views.design.show(); + newDocument.deserializeDocument(); + NJevent("switchDocument"); } } }, diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index 6e40abb5..1092615a 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js @@ -81,10 +81,10 @@ exports.SelectionController = Montage.create(Component, { handleSwitchDocument: { value: function() { - if(this.application.ninja.documentController.activeDocument.currentView === "design"){ +// if(this.application.ninja.documentController.activeDocument.currentView === "design"){ this._isDocument = this.application.ninja.selectedElements.length === 0; NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); - } +// } } }, diff --git a/js/document/document-html.js b/js/document/document-html.js index c77ed7bc..0037c94d 100755 --- a/js/document/document-html.js +++ b/js/document/document-html.js @@ -134,7 +134,7 @@ exports.HtmlDocument = Montage.create(Component, { // serializeDocument: { value: function () { - // There are not needed for now ssince we cannot change them + // There are not needed for now since we cannot change them //this.gridHorizontalSpacing = this.application.ninja.stage.drawUtils.gridHorizontalSpacing; //this.gridVerticalSpacing = this.application.ninja.stage.drawUtils.gridVerticalSpacing; @@ -150,13 +150,29 @@ exports.HtmlDocument = Montage.create(Component, { // Pause the videos this.model.views.design.pauseVideos(); + + this.model.isActive = false; } }, //////////////////////////////////////////////////////////////////// // deserializeDocument: { value: function () { - //TODO: Import functionality + // There are not needed for now since we cannot change them + //this.application.ninja.stage.drawUtils.gridHorizontalSpacing = this.gridHorizontalSpacing; + //this.application.ninja.stage.drawUtils.gridVerticalSpacing = this.gridVerticalSpacing; + + // Deserialize the current scroll position + // TODO: Implement + + this.application.ninja.selectedElements = this.model.selection.slice(0); + + this.application.ninja.appModel.show3dGrid = this.draw3DGrid; + + // Serialize the undo + // TODO: Save the montage undo queue + + this.model.isActive = true; } } //////////////////////////////////////////////////////////////////// diff --git a/js/document/html-document.js b/js/document/html-document.js index 68c2a9fb..bcf2b5c2 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js @@ -454,55 +454,6 @@ exports.HTMLDocument = Montage.create(TextDocument, { } }, - /** - * Return the specified inline attribute from the element. - */ - GetElementAttribute: { - value: function(element, attribute) { - - var value; - - if(attribute === "src") { - return element[attribute].replace(window.location.href, ''); - } - - value = element[attribute]; - - if(value !== undefined) return value; -// if(value || value === false) return [value, "inline"]; - - // 3. - //value = this._document.defaultView.getComputedStyle(element,null).getPropertyValue(attribute); - //if(value) return value; - - return null; - } - }, - - GetElementStyle: { - value: function(element, style) { -// return this._queryStylesheets(element, style); - } - }, - - SetStyle: { - value: function(type, selector, style, value) { - try { - for(var j=0; j --- js/helper-classes/3D/snap-manager.js | 7 +++++++ js/ninja.reel/ninja.js | 15 +++++++++++++-- js/stage/stage-deps.js | 5 +++-- 3 files changed, 23 insertions(+), 4 deletions(-) (limited to 'js') diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js index 7194524e..e22ac3ad 100755 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js @@ -456,6 +456,13 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { } }, + reload2DCache: { + value: function() { + this.clear2DCache(); + this.load2DCache(workingPlane); + } + }, + clear2DCache : { value : function() { // clear the 2D cache flags in the objects diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js index ba87e2d5..067a005f 100755 --- a/js/ninja.reel/ninja.js +++ b/js/ninja.reel/ninja.js @@ -134,10 +134,21 @@ exports.Ninja = Montage.create(Component, { value: [] }, - currentSelectedContainer: { + _currentSelectedContainer: { value: null }, + currentSelectedContainer: { + get: function() { + return this._currentSelectedContainer; + }, + set: function(value) { + if(value !== this._currentSelectedContainer) { + this._currentSelectedContainer = value; + } + } + }, + templateDidLoad: { value: function() { this.ninjaVersion = window.ninjaVersion.ninja.version; @@ -285,7 +296,7 @@ exports.Ninja = Montage.create(Component, { this.currentDocument = this.documentController.activeDocument; if(this.currentDocument.documentRoot) { - this.application.ninja.currentSelectedContainer = this.currentDocument.documentRoot; + this._currentSelectedContainer = this.selectionController._currentSelectedContainer = this.currentDocument.documentRoot; } } }, diff --git a/js/stage/stage-deps.js b/js/stage/stage-deps.js index 84f04249..0d53696b 100755 --- a/js/stage/stage-deps.js +++ b/js/stage/stage-deps.js @@ -105,7 +105,7 @@ exports.StageDeps = Montage.create(Component, { workingPlane = [0,0,1,0]; - snapManager._isCacheInvalid = true; + snapManager.reload2DCache(); snapManager.setupDragPlaneFromPlane (workingPlane); drawUtils.initializeFromDocument(); @@ -116,8 +116,9 @@ exports.StageDeps = Montage.create(Component, { value: function(){ workingPlane = [0,0,1,0]; - snapManager._isCacheInvalid = true; snapManager.setupDragPlaneFromPlane (workingPlane); + snapManager.reload2DCache(); + drawUtils.initializeFromDocument(); } -- 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 ++---------- js/data/tools-data.js | 13 +++++++++++++ 4 files changed, 19 insertions(+), 21 deletions(-) (limited to 'js') 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": {"#": "groupLi