From 9d2c2a80483415d7560b00cda5519153db23e241 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Sat, 11 Feb 2012 23:04:36 -0800 Subject: Bug Fixes IKNINJA-1101 IKNINJA-1079 IKNINJA-1144 --- js/components/colorwheel.reel/compass_app_log.txt | 3 -- js/components/popup.reel/compass_app_log.txt | 48 ---------------------- .../Color/colorpanelbase.reel/colorpanelbase.js | 8 ++-- .../colorpanelpopup.reel/css/colorpanelpopup.css | 4 +- .../colorpanelpopup.reel/css/colorpanelpopup.scss | 4 +- 5 files changed, 8 insertions(+), 59 deletions(-) delete mode 100644 js/components/colorwheel.reel/compass_app_log.txt delete mode 100644 js/components/popup.reel/compass_app_log.txt (limited to 'js') diff --git a/js/components/colorwheel.reel/compass_app_log.txt b/js/components/colorwheel.reel/compass_app_log.txt deleted file mode 100644 index 815feb02..00000000 --- a/js/components/colorwheel.reel/compass_app_log.txt +++ /dev/null @@ -1,3 +0,0 @@ -2011-11-23 01:07:12 create css/colorwheel.css -2011-11-23 01:07:25 overwrite css/colorwheel.css -2011-12-20 17:04:05 overwrite css/colorwheel.css diff --git a/js/components/popup.reel/compass_app_log.txt b/js/components/popup.reel/compass_app_log.txt deleted file mode 100644 index 8a3fb984..00000000 --- a/js/components/popup.reel/compass_app_log.txt +++ /dev/null @@ -1,48 +0,0 @@ -2011-06-28 18:13:06 create css/popup.css -2011-06-28 18:13:12 identical css/popup.css -2011-06-28 18:14:08 overwrite css/popup.css -2011-06-28 18:14:20 overwrite css/popup.css -2011-06-28 18:14:29 overwrite css/popup.css -2011-06-28 18:17:23 overwrite css/popup.css -2011-06-28 18:17:27 overwrite css/popup.css -2011-06-28 18:17:56 overwrite css/popup.css -2011-06-28 18:18:09 overwrite css/popup.css -2011-06-28 18:20:30 overwrite css/popup.css -2011-06-28 18:22:35 overwrite css/popup.css -2011-06-28 18:24:12 overwrite css/popup.css -2011-06-28 18:24:23 overwrite css/popup.css -2011-06-28 18:24:33 overwrite css/popup.css -2011-06-28 18:25:17 overwrite css/popup.css -2011-06-28 18:26:21 overwrite css/popup.css -2011-06-28 18:26:33 overwrite css/popup.css -2011-06-28 18:26:42 overwrite css/popup.css -2011-06-28 18:26:57 overwrite css/popup.css -2011-06-28 18:29:57 overwrite css/popup.css -2011-06-28 18:30:14 overwrite css/popup.css -2011-06-28 18:30:23 overwrite css/popup.css -2011-06-28 18:30:48 overwrite css/popup.css -2011-06-28 18:31:03 overwrite css/popup.css -2011-06-29 10:18:31 overwrite css/popup.css -2011-06-29 10:18:47 overwrite css/popup.css -2011-06-29 10:37:19 overwrite css/popup.css -2011-06-29 10:40:29 overwrite css/popup.css -2011-06-29 10:45:37 overwrite css/popup.css -2011-06-29 10:45:53 identical css/popup.css -2011-06-29 10:46:52 overwrite css/popup.css -2011-06-29 10:47:02 identical css/popup.css -2011-06-29 13:30:47 overwrite css/popup.css -2011-06-29 13:31:14 overwrite css/popup.css -2011-12-20 17:06:48 overwrite css/popup.css -2011-12-22 11:29:15 overwrite css/popup.css -2011-12-22 11:29:24 identical css/popup.css -2011-12-22 11:30:05 overwrite css/popup.css -2011-12-22 11:30:33 overwrite css/popup.css -2011-12-22 11:30:51 overwrite css/popup.css -2011-12-22 11:32:30 overwrite css/popup.css -2011-12-22 11:33:06 overwrite css/popup.css -2011-12-22 11:33:12 overwrite css/popup.css -2011-12-22 11:33:32 identical css/popup.css -2011-12-22 11:33:36 overwrite css/popup.css -2011-12-22 11:34:48 overwrite css/popup.css -2012-01-26 11:42:18 overwrite css/popup.css -2012-01-26 11:42:20 overwrite css/popup.css diff --git a/js/panels/Color/colorpanelbase.reel/colorpanelbase.js b/js/panels/Color/colorpanelbase.reel/colorpanelbase.js index 9a27689a..ff738bbe 100644 --- a/js/panels/Color/colorpanelbase.reel/colorpanelbase.js +++ b/js/panels/Color/colorpanelbase.reel/colorpanelbase.js @@ -1499,13 +1499,13 @@ exports.ColorPanelBase = Montage.create(Component, { // if (type._event.clientX && type._event.clientY) { // - if (type._event.clientX > (parseInt(document.width)/2)) { + //if (type._event.clientX > (parseInt(document.width)/2)) { //TODO: Fix offset hack this.application.ninja.colorController.colorPopupManager.showColorPopup((type._event.clientX - type._event.offsetX) +'px', (type._event.target.clientHeight/2+type._event.clientY - type._event.offsetY)+'px', 'right', 'top'); - } else { + //} else { // - this.application.ninja.colorController.colorPopupManager.showColorPopup((type._event.clientX - type._event.offsetX)+parseInt(type._event.target.offsetWidth)+'px', (type._event.target.offsetHeight/2+type._event.clientY - type._event.offsetY)+'px', 'left', 'top'); - } + // this.application.ninja.colorController.colorPopupManager.showColorPopup((type._event.clientX - type._event.offsetX)+parseInt(type._event.target.offsetWidth)+'px', (type._event.target.offsetHeight/2+type._event.clientY - type._event.offsetY)+'px', 'left', 'top'); + //} } } } else { diff --git a/js/panels/Color/colorpanelpopup.reel/css/colorpanelpopup.css b/js/panels/Color/colorpanelpopup.reel/css/colorpanelpopup.css index 6a418279..4db0abff 100644 --- a/js/panels/Color/colorpanelpopup.reel/css/colorpanelpopup.css +++ b/js/panels/Color/colorpanelpopup.reel/css/colorpanelpopup.css @@ -6,7 +6,7 @@ */ /* line 12, colorpanelpopup.scss */ .cpp_popup { - overflow: none; + overflow: hidden; font-size: 12px; text-shadow: 1px 1px 1px #000; font-family: 'Droid Sans', sans-serif; @@ -28,7 +28,7 @@ text-indent: -9999px; overflow: hidden; float: right; - padding: none; + padding: 0; cursor: pointer; border: 1px solid transparent; } diff --git a/js/panels/Color/colorpanelpopup.reel/css/colorpanelpopup.scss b/js/panels/Color/colorpanelpopup.reel/css/colorpanelpopup.scss index 20481fb6..1f63658a 100644 --- a/js/panels/Color/colorpanelpopup.reel/css/colorpanelpopup.scss +++ b/js/panels/Color/colorpanelpopup.reel/css/colorpanelpopup.scss @@ -10,7 +10,7 @@ $grey_light: #494949; .cpp_popup { - overflow: none; + overflow: hidden; font-size: 12px; text-shadow: 1px 1px 1px #000; font-family: 'Droid Sans', sans-serif; @@ -32,7 +32,7 @@ $grey_light: #494949; text-indent: -9999px; overflow: hidden; float: right; - padding: none; + padding: 0; cursor: pointer; border: 1px solid transparent; } -- cgit v1.2.3 From 2edcdd88ffc2f6ff0ea836e4da3e1fd2cb3e856f Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Mon, 27 Feb 2012 17:39:26 -0800 Subject: persist undo/redo stack per html document Signed-off-by: Ananya Sen --- js/controllers/undo-controller.js | 17 ++++++++++++++-- js/document/html-document.js | 29 ++++++++++++++++++++++++++++ js/models/color-model.js | 6 +++--- js/ninja.reel/ninja.js | 3 +++ js/panels/properties/content.reel/content.js | 4 ++-- 5 files changed, 52 insertions(+), 7 deletions(-) (limited to 'js') diff --git a/js/controllers/undo-controller.js b/js/controllers/undo-controller.js index 926803d3..01853593 100755 --- a/js/controllers/undo-controller.js +++ b/js/controllers/undo-controller.js @@ -71,22 +71,28 @@ exports.UndoController = Montage.create( Component, { /** * Undo Queue */ - _undoQueue: { value: [] }, + _undoQueue: { value: [], writable:true }, undoQueue: { get: function() { return this._undoQueue; + }, + set: function(value){ + this._undoQueue = value; } }, /** * Redo Queue */ - _redoQueue: { value: [], enumerable: false }, + _redoQueue: { value: [], enumerable: false, writable:true }, redoQueue: { get: function() { return this._redoQueue; + }, + set: function(value){ + this._redoQueue = value; } }, @@ -202,5 +208,12 @@ exports.UndoController = Montage.create( Component, { this.redoQueue.splice(0, this.redoQueue.length); //this.redoQueue = []; } + }, + + clearHistory:{ + value: function(){ + this.undoQueue.splice(0, this.undoQueue.length); + this.redoQueue.splice(0, this.redoQueue.length); + } } }); \ No newline at end of file diff --git a/js/document/html-document.js b/js/document/html-document.js index 75628731..111c491d 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js @@ -59,6 +59,27 @@ exports.HTMLDocument = Montage.create(TextDocument, { _gridVerticalSpacing: {value:0}, //end - drawUtils state + _undoStack: { value: [] }, + undoStack: { + get: function() { + return this._undoStack; + }, + set:function(value){ + this._undoStack = value; + } + }, + + _redoStack: { value: [], enumerable: false }, + + redoStack: { + get: function() { + return this._redoStack; + }, + set:function(value){ + this._redoStack = value; + } + }, + // GETTERS / SETTERS @@ -681,6 +702,11 @@ exports.HTMLDocument = Montage.create(TextDocument, { } this.draw3DGrid = this.application.ninja.appModel.show3dGrid; + + //persist a clone of history per document + this.undoStack = this.application.ninja.undocontroller.undoQueue.slice(0); + this.redoStack = this.application.ninja.undocontroller.redoQueue.slice(0); + this.application.ninja.undocontroller.clearHistory();//clear history to give the next document a fresh start } }, @@ -704,6 +730,9 @@ exports.HTMLDocument = Montage.create(TextDocument, { this.application.ninja.stage.handleScroll(); this.application.ninja.appModel.show3dGrid = this.draw3DGrid; + + this.application.ninja.undocontroller.undoQueue = this.undoStack.slice(0); + this.application.ninja.undocontroller.redoQueue = this.redoStack.slice(0); } } //////////////////////////////////////////////////////////////////// diff --git a/js/models/color-model.js b/js/models/color-model.js index 2c86422f..d3618c3e 100755 --- a/js/models/color-model.js +++ b/js/models/color-model.js @@ -265,7 +265,7 @@ exports.ColorModel = Montage.create(Component, { //////////////////////////////////////////////////////// case 'rgb': //Checking for match of previous (RGB) - if (color.r !== this.rgb.r && color.g !== this.rgb.g && color.b !== this.rgb.b) { + if (color && color.r !== this.rgb.r && color.g !== this.rgb.g && color.b !== this.rgb.b) { //Setting value and breaking out of function this.rgb = color; return; @@ -279,7 +279,7 @@ exports.ColorModel = Montage.create(Component, { //////////////////////////////////////////////////////// case 'hsv': //Checking for match of previous (HSV) - if (color.h !== this.hsv.h && color.s !== this.hsv.s && color.v !== this.hsv.v) { + if (color && color.h !== this.hsv.h && color.s !== this.hsv.s && color.v !== this.hsv.v) { //Setting value and breaking out of function this.hsv = color; return; @@ -293,7 +293,7 @@ exports.ColorModel = Montage.create(Component, { //////////////////////////////////////////////////////// case 'hsl': //Checking for match of previous (HSV) - if (color.h !== this.hsl.h && color.s !== this.hsl.s && color.l !== this.hsl.l) { + if (color && color.h !== this.hsl.h && color.s !== this.hsl.s && color.l !== this.hsl.l) { //Setting value and breaking out of function this.hsl = color; return; diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js index 6efeef8a..ab9503ec 100755 --- a/js/ninja.reel/ninja.js +++ b/js/ninja.reel/ninja.js @@ -98,6 +98,9 @@ exports.Ninja = Montage.create(Component, { if(this._appLoaded && this._preload) { // App is now deserialized and files are preloaded this.appModel.materials = MaterialsLibrary.materials; + + this.currentDocument = null; + } } }, diff --git a/js/panels/properties/content.reel/content.js b/js/panels/properties/content.reel/content.js index 8fa33a75..fa4c56f2 100755 --- a/js/panels/properties/content.reel/content.js +++ b/js/panels/properties/content.reel/content.js @@ -268,12 +268,12 @@ exports.Content = Montage.create(Component, { } else { - if (currentValue.color.a !== undefined) + if (currentValue.color && (currentValue.color.a !== undefined)) { this.application.ninja.colorController.colorModel.alpha = {value: currentValue.color.a, wasSetByCode: true, type: 'change'}; } - if(currentValue.color.mode) + if(currentValue.color && currentValue.color.mode) { this.application.ninja.colorController.colorModel[currentValue.color.mode] = currentValue.color; } -- cgit v1.2.3 From ada597016685a83f2c9a8b25b28589b9221569c0 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Tue, 28 Feb 2012 12:26:52 -0800 Subject: reverting null checks as per request Signed-off-by: Ananya Sen --- js/models/color-model.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'js') diff --git a/js/models/color-model.js b/js/models/color-model.js index d3618c3e..2c86422f 100755 --- a/js/models/color-model.js +++ b/js/models/color-model.js @@ -265,7 +265,7 @@ exports.ColorModel = Montage.create(Component, { //////////////////////////////////////////////////////// case 'rgb': //Checking for match of previous (RGB) - if (color && color.r !== this.rgb.r && color.g !== this.rgb.g && color.b !== this.rgb.b) { + if (color.r !== this.rgb.r && color.g !== this.rgb.g && color.b !== this.rgb.b) { //Setting value and breaking out of function this.rgb = color; return; @@ -279,7 +279,7 @@ exports.ColorModel = Montage.create(Component, { //////////////////////////////////////////////////////// case 'hsv': //Checking for match of previous (HSV) - if (color && color.h !== this.hsv.h && color.s !== this.hsv.s && color.v !== this.hsv.v) { + if (color.h !== this.hsv.h && color.s !== this.hsv.s && color.v !== this.hsv.v) { //Setting value and breaking out of function this.hsv = color; return; @@ -293,7 +293,7 @@ exports.ColorModel = Montage.create(Component, { //////////////////////////////////////////////////////// case 'hsl': //Checking for match of previous (HSV) - if (color && color.h !== this.hsl.h && color.s !== this.hsl.s && color.l !== this.hsl.l) { + if (color.h !== this.hsl.h && color.s !== this.hsl.s && color.l !== this.hsl.l) { //Setting value and breaking out of function this.hsl = color; return; -- cgit v1.2.3 From 866df4801b9e77a0155ffbfb87adbc79a94ce9a5 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Tue, 28 Feb 2012 12:34:33 -0800 Subject: reverted null check as per request Signed-off-by: Ananya Sen --- js/panels/properties/content.reel/content.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js') diff --git a/js/panels/properties/content.reel/content.js b/js/panels/properties/content.reel/content.js index fa4c56f2..8fa33a75 100755 --- a/js/panels/properties/content.reel/content.js +++ b/js/panels/properties/content.reel/content.js @@ -268,12 +268,12 @@ exports.Content = Montage.create(Component, { } else { - if (currentValue.color && (currentValue.color.a !== undefined)) + if (currentValue.color.a !== undefined) { this.application.ninja.colorController.colorModel.alpha = {value: currentValue.color.a, wasSetByCode: true, type: 'change'}; } - if(currentValue.color && currentValue.color.mode) + if(currentValue.color.mode) { this.application.ninja.colorController.colorModel[currentValue.color.mode] = currentValue.color; } -- cgit v1.2.3 From 1766c6b17e2311fcd21c2be6608c7dcdc0a9b23a Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Tue, 28 Feb 2012 15:07:49 -0800 Subject: persist selections while switching documents Signed-off-by: Ananya Sen --- js/controllers/selection-controller.js | 9 +++++++++ js/document/html-document.js | 6 +++--- js/panels/properties/content.reel/content.js | 11 +++++++++++ 3 files changed, 23 insertions(+), 3 deletions(-) (limited to 'js') diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index f50762f3..62313960 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js @@ -47,6 +47,7 @@ exports.SelectionController = Montage.create(Component, { this.eventManager.addEventListener("elementDeleted", this, false); this.eventManager.addEventListener("selectAll", this, false); this.eventManager.addEventListener("deleteSelection", this, false); + this.eventManager.addEventListener("switchDocument", this, false); // defaultEventManager.addEventListener( "undo", this, false); // defaultEventManager.addEventListener( "redo", this, false); } @@ -88,6 +89,14 @@ exports.SelectionController = Montage.create(Component, { } }, + handleSwitchDocument: { + value: function() { + this._selectedItems = this.application.ninja.selectedElements.slice(0); + this._isDocument = false; + NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); + } + }, + handleElementAdded: { value: function(event) { this.executeSelectElement(event.detail); diff --git a/js/document/html-document.js b/js/document/html-document.js index 111c491d..aac03606 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js @@ -698,7 +698,7 @@ exports.HTMLDocument = Montage.create(TextDocument, { this.gridVerticalSpacing = this.application.ninja.stage.drawUtils.gridVerticalSpacing; if(typeof this.application.ninja.selectedElements !== 'undefined'){ - this.selectionModel = this.application.ninja.selectedElements; + this.selectionModel = this.application.ninja.selectedElements.slice(0); } this.draw3DGrid = this.application.ninja.appModel.show3dGrid; @@ -717,8 +717,8 @@ exports.HTMLDocument = Montage.create(TextDocument, { this.application.ninja.stage.drawUtils.gridHorizontalSpacing = this.gridHorizontalSpacing; this.application.ninja.stage.drawUtils.gridVerticalSpacing = this.gridVerticalSpacing; - if((typeof this.selectionModel !== 'undefined') && (this.selectionModel !== null) && (this.selectionModel.length > 0)){ - this.application.ninja.selectionController.initWithDocument(this.selectionModel); + if((typeof this.selectionModel !== 'undefined') && (this.selectionModel !== null)){ + this.application.ninja.selectedElements = this.selectionModel.slice(0); } if((this.savedLeftScroll!== null) && (this.savedTopScroll !== null)){ diff --git a/js/panels/properties/content.reel/content.js b/js/panels/properties/content.reel/content.js index 8fa33a75..e92fbcb2 100755 --- a/js/panels/properties/content.reel/content.js +++ b/js/panels/properties/content.reel/content.js @@ -55,6 +55,8 @@ exports.Content = Montage.create(Component, { } this.eventManager.addEventListener("openDocument", this, false); + + this.eventManager.addEventListener("switchDocument", this, false); } }, @@ -74,6 +76,15 @@ exports.Content = Montage.create(Component, { } }, + handleSwitchDocument: { + value: function(){ + // For now always assume that the stage is selected by default + if(this.application.ninja.selectedElements.length === 0) { + this.displayStageProperties(); + } + } + }, + /** * Blur and Key up to handle change in the Element ID field. */ -- cgit v1.2.3 From e0fab951e4f3869b04fd4a01f429a6654991cd68 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Tue, 28 Feb 2012 15:33:35 -0800 Subject: minor fixes in saving undo/redo stacks per document Signed-off-by: Ananya Sen --- js/controllers/undo-controller.js | 8 ++++---- js/ninja.reel/ninja.js | 3 --- 2 files changed, 4 insertions(+), 7 deletions(-) (limited to 'js') diff --git a/js/controllers/undo-controller.js b/js/controllers/undo-controller.js index 01853593..19cfb6e6 100755 --- a/js/controllers/undo-controller.js +++ b/js/controllers/undo-controller.js @@ -71,7 +71,7 @@ exports.UndoController = Montage.create( Component, { /** * Undo Queue */ - _undoQueue: { value: [], writable:true }, + _undoQueue: { value: []}, undoQueue: { get: function() { @@ -85,7 +85,7 @@ exports.UndoController = Montage.create( Component, { /** * Redo Queue */ - _redoQueue: { value: [], enumerable: false, writable:true }, + _redoQueue: { value: [], enumerable: false}, redoQueue: { get: function() { @@ -212,8 +212,8 @@ exports.UndoController = Montage.create( Component, { clearHistory:{ value: function(){ - this.undoQueue.splice(0, this.undoQueue.length); - this.redoQueue.splice(0, this.redoQueue.length); + this.undoQueue.length = 0; + this.redoQueue.length = 0; } } }); \ No newline at end of file diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js index ab9503ec..6efeef8a 100755 --- a/js/ninja.reel/ninja.js +++ b/js/ninja.reel/ninja.js @@ -98,9 +98,6 @@ exports.Ninja = Montage.create(Component, { if(this._appLoaded && this._preload) { // App is now deserialized and files are preloaded this.appModel.materials = MaterialsLibrary.materials; - - this.currentDocument = null; - } } }, -- cgit v1.2.3 From 1c7e86b6c2c802d720cc3075f75c7a61866ebc07 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Tue, 28 Feb 2012 16:41:18 -0800 Subject: fix for creatingNewFile flag Signed-off-by: Ananya Sen --- js/controllers/document-controller.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'js') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 02031922..64ff2c7e 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -195,7 +195,10 @@ var DocumentController = exports.DocumentController = Montage.create(Component, value:function(doc){ var response = doc || null;//default just for testing if(!!response && response.success && (response.status!== 500) && !!response.uri){ + + this.isNewFilePath = true;//path identifier flag this.creatingNewFile = true;//flag for timeline to identify new file flow + this.application.ninja.ioMediator.fileOpen(response.uri, this.openFileCallback.bind(this)); }else if(!!response && !response.success){ //Todo: restrict directory path to the sandbox, in the dialog itself @@ -224,9 +227,10 @@ var DocumentController = exports.DocumentController = Montage.create(Component, //TODO: Add UI to handle error codes, shouldn't be alert windows if(!!response && (response.status === 204)) { - if((typeof this.creatingNewFile === 'undefined') || (this.creatingNewFile !== true)){//not from new file flow + if((typeof this.isNewFilePath === 'undefined') || (this.isNewFilePath !== true)){//not from new file flow this.creatingNewFile = false; } + this.isNewFilePath = false;//reset path identifier flag //Sending full response object this.openDocument(response); -- cgit v1.2.3 From 7a9c2a91dfbbdd0cd7c79d81be5aeecd7887e7f1 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Wed, 29 Feb 2012 10:12:38 -0800 Subject: handle selections for switching documents Signed-off-by: Ananya Sen --- js/controllers/selection-controller.js | 6 +++++- js/panels/properties/content.reel/content.js | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'js') diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index 62313960..0f2a16e0 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js @@ -92,7 +92,11 @@ exports.SelectionController = Montage.create(Component, { handleSwitchDocument: { value: function() { this._selectedItems = this.application.ninja.selectedElements.slice(0); - this._isDocument = false; + if(this._selectedItems.length === 0){ + this._isDocument = true; + }else{ + this._isDocument = false; + } NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); } }, diff --git a/js/panels/properties/content.reel/content.js b/js/panels/properties/content.reel/content.js index e92fbcb2..fcd85675 100755 --- a/js/panels/properties/content.reel/content.js +++ b/js/panels/properties/content.reel/content.js @@ -81,6 +81,12 @@ exports.Content = Montage.create(Component, { // For now always assume that the stage is selected by default if(this.application.ninja.selectedElements.length === 0) { 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); + } } } }, -- cgit v1.2.3 From 03ea76700cb8bee3f4f58acf3e3503b0642d13fb Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Wed, 29 Feb 2012 11:46:19 -0800 Subject: fixed selection which click after switching to a document Signed-off-by: Ananya Sen --- js/controllers/selection-controller.js | 4 +++- js/document/html-document.js | 11 +++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'js') diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index 0f2a16e0..184c4899 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js @@ -92,12 +92,14 @@ exports.SelectionController = Montage.create(Component, { handleSwitchDocument: { value: function() { this._selectedItems = this.application.ninja.selectedElements.slice(0); - if(this._selectedItems.length === 0){ + if(this._selectedItems.length === 0 ){ this._isDocument = true; }else{ this._isDocument = false; } NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); + + this._selectionContainer = this.application.ninja.currentSelectedContainer; } }, diff --git a/js/document/html-document.js b/js/document/html-document.js index aac03606..9e3f0cdd 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js @@ -717,9 +717,7 @@ exports.HTMLDocument = Montage.create(TextDocument, { this.application.ninja.stage.drawUtils.gridHorizontalSpacing = this.gridHorizontalSpacing; this.application.ninja.stage.drawUtils.gridVerticalSpacing = this.gridVerticalSpacing; - if((typeof this.selectionModel !== 'undefined') && (this.selectionModel !== null)){ - this.application.ninja.selectedElements = this.selectionModel.slice(0); - } + if((this.savedLeftScroll!== null) && (this.savedTopScroll !== null)){ this.application.ninja.stage._iframeContainer.scrollLeft = this.savedLeftScroll; @@ -727,12 +725,17 @@ exports.HTMLDocument = Montage.create(TextDocument, { this.application.ninja.stage._iframeContainer.scrollTop = this.savedTopScroll; this.application.ninja.stage._scrollLeft = this.savedTopScroll; } - this.application.ninja.stage.handleScroll(); + + if((typeof this.selectionModel !== 'undefined') && (this.selectionModel !== null)){ + this.application.ninja.selectedElements = this.selectionModel.slice(0); + } this.application.ninja.appModel.show3dGrid = this.draw3DGrid; this.application.ninja.undocontroller.undoQueue = this.undoStack.slice(0); this.application.ninja.undocontroller.redoQueue = this.redoStack.slice(0); + + this.application.ninja.currentSelectedContainer = this.documentRoot; } } //////////////////////////////////////////////////////////////////// -- cgit v1.2.3 From 4e21db069b28c79236c8c7fd19dcc7810d28c5cb Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Wed, 29 Feb 2012 12:18:09 -0800 Subject: set selectionContainer before restoring selected elements Signed-off-by: Ananya Sen --- js/document/html-document.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'js') diff --git a/js/document/html-document.js b/js/document/html-document.js index 9e3f0cdd..9dcea8cb 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js @@ -726,6 +726,7 @@ exports.HTMLDocument = Montage.create(TextDocument, { this.application.ninja.stage._scrollLeft = this.savedTopScroll; } + this.application.ninja.currentSelectedContainer = this.documentRoot; if((typeof this.selectionModel !== 'undefined') && (this.selectionModel !== null)){ this.application.ninja.selectedElements = this.selectionModel.slice(0); } @@ -735,7 +736,7 @@ exports.HTMLDocument = Montage.create(TextDocument, { this.application.ninja.undocontroller.undoQueue = this.undoStack.slice(0); this.application.ninja.undocontroller.redoQueue = this.redoStack.slice(0); - this.application.ninja.currentSelectedContainer = this.documentRoot; + } } //////////////////////////////////////////////////////////////////// -- cgit v1.2.3 From 7a259f8c78a2394e32c62654623285ee595c6249 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Wed, 29 Feb 2012 13:25:35 -0800 Subject: IKNINJA-1217: use encodeURI instead to save into sessionStorage Signed-off-by: Ananya Sen --- js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'js') diff --git a/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js b/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js index 428e7bab..3d99ae4d 100644 --- a/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js +++ b/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js @@ -861,12 +861,12 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, { var dataStore = window.sessionStorage; try { if(this.pickerModel.pickerMode === "write"){ - dataStore.setItem('lastSavedFolderURI',escape(""+this.currentURI)); + dataStore.setItem('lastSavedFolderURI', encodeURI(""+this.currentURI)); } else if(this.pickerModel.inFileMode === true){ - dataStore.setItem('lastOpenedFolderURI_fileSelection',escape(""+this.currentURI)); + dataStore.setItem('lastOpenedFolderURI_fileSelection',encodeURI(""+this.currentURI)); }else if(this.pickerModel.inFileMode === false){ - dataStore.setItem('lastOpenedFolderURI_folderSelection',escape(""+this.currentURI)); + dataStore.setItem('lastOpenedFolderURI_folderSelection',encodeURI(""+this.currentURI)); } } catch(e){ -- cgit v1.2.3 From 0cd17b6cf9231e60083958d85759d4796f505342 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Wed, 29 Feb 2012 13:48:11 -0800 Subject: Fix for selection bug due to bad scrollLeft and scrollTop values when switching between documents. Signed-off-by: Nivesh Rajbhandari --- js/document/html-document.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'js') diff --git a/js/document/html-document.js b/js/document/html-document.js index 9dcea8cb..581bbc08 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js @@ -719,15 +719,14 @@ exports.HTMLDocument = Montage.create(TextDocument, { - if((this.savedLeftScroll!== null) && (this.savedTopScroll !== null)){ + if((this.savedLeftScroll !== null) && (this.savedTopScroll !== null)){ this.application.ninja.stage._iframeContainer.scrollLeft = this.savedLeftScroll; - this.application.ninja.stage._scrollLeft = this.savedLeftScroll; this.application.ninja.stage._iframeContainer.scrollTop = this.savedTopScroll; - this.application.ninja.stage._scrollLeft = this.savedTopScroll; + this.application.ninja.stage.handleScroll(); } this.application.ninja.currentSelectedContainer = this.documentRoot; - if((typeof this.selectionModel !== 'undefined') && (this.selectionModel !== null)){ + if(!this.selectionModel){ this.application.ninja.selectedElements = this.selectionModel.slice(0); } -- cgit v1.2.3 From 84d6f6f5518e5ef8fc3d68be7e41c510f57b597a Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Wed, 29 Feb 2012 13:53:45 -0800 Subject: Fixing typo. Signed-off-by: Nivesh Rajbhandari --- js/document/html-document.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js') diff --git a/js/document/html-document.js b/js/document/html-document.js index 581bbc08..544c0ad5 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js @@ -726,7 +726,7 @@ exports.HTMLDocument = Montage.create(TextDocument, { } this.application.ninja.currentSelectedContainer = this.documentRoot; - if(!this.selectionModel){ + if(this.selectionModel){ this.application.ninja.selectedElements = this.selectionModel.slice(0); } -- cgit v1.2.3 From 80ac930684255dd24cecae70b488285a6058488e Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Thu, 1 Mar 2012 13:34:45 -0800 Subject: Optimizing URL intercepting detection Modified the way the webRequest maps to the file. --- js/controllers/document-controller.js | 9 ++++++--- js/document/html-document.js | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'js') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 64ff2c7e..194496a6 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -76,11 +76,14 @@ var DocumentController = exports.DocumentController = Montage.create(Component, // handleWebRequest: { value: function (request) { - if (this._hackRootFlag && request.url.indexOf('js/document/templates/montage-html') !== -1) { + //TODO: Check if frameId is proper + if (this._hackRootFlag && request.parentFrameId !== -1) { //TODO: Optimize creating string - return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split('/')[request.url.split('/').length-1]}; - } + //console.log(this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1], request.url); + //return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split('/')[request.url.split('/').length-1]}; + return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split(chrome.extension.getURL('js/document/templates/montage-html/'))[1]}; } + } }, //////////////////////////////////////////////////////////////////// // diff --git a/js/document/html-document.js b/js/document/html-document.js index e40656a3..1691e3e4 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js @@ -486,11 +486,12 @@ exports.HTMLDocument = Montage.create(TextDocument, { if(this._document.styleSheets[i].rules === null) { //TODO: Revisit URLs and URI creation logic, very hack right now var fileUri, cssUrl, cssData, tag, query; - if (this._document.styleSheets[i].href.indexOf('js/document/templates/montage-html') !== -1) { + //TODO: Parse out relative URLs and map them to absolute + if (this._document.styleSheets[i].href.indexOf(chrome.extension.getURL('')) !== -1) { //Getting the url of the CSS file - cssUrl = this._document.styleSheets[i].href.split('js/document/templates/montage-html')[1]; + cssUrl = this._document.styleSheets[i].href.split('js/document/templates/montage-html')[1];//TODO: Parse out relative URLs and map them to absolute //Creating the URI of the file (this is wrong should not be splitting cssUrl) - fileUri = this.application.ninja.coreIoApi.cloudData.root+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+cssUrl.split('/')[1]; + fileUri = this.application.ninja.coreIoApi.cloudData.root+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+cssUrl; //Loading the data from the file cssData = this.application.ninja.coreIoApi.readFile({uri: fileUri}); //Creating tag with file content @@ -506,6 +507,8 @@ exports.HTMLDocument = Montage.create(TextDocument, { tag.setAttribute(this._document.styleSheets[i].ownerNode.attributes[n].name, this._document.styleSheets[i].ownerNode.attributes[n].value); } } + //TODO: Parse out relative URLs and map them to absolute + //console.log(cssData.content); tag.innerHTML = cssData.content; //Looping through DOM to insert style tag at location of link element query = this._templateDocument.html.querySelectorAll(['link']); -- cgit v1.2.3 From 205d869d94005cb214fd838879d4f5e81d763311 Mon Sep 17 00:00:00 2001 From: Jon Reid Date: Thu, 1 Mar 2012 18:01:08 -0800 Subject: Timeline: Merge arrlayers and arrtracks into one object. Redefine collapser to use property binding instead of events. --- js/panels/Timeline/Collapser.js | 26 +++- js/panels/Timeline/Layer.reel/Layer.js | 138 ++++++++++++++++++--- .../Timeline/TimelinePanel.reel/TimelinePanel.html | 19 ++- .../Timeline/TimelinePanel.reel/TimelinePanel.js | 43 +++++-- .../Timeline/TimelineTrack.reel/TimelineTrack.js | 95 +++++++++++++- 5 files changed, 288 insertions(+), 33 deletions(-) (limited to 'js') diff --git a/js/panels/Timeline/Collapser.js b/js/panels/Timeline/Collapser.js index ad490c2e..d161cdd7 100644 --- a/js/panels/Timeline/Collapser.js +++ b/js/panels/Timeline/Collapser.js @@ -68,7 +68,7 @@ var Montage = require("montage/core/core").Montage, }, _bypassAnimation : { - value: false + value: true }, bypassAnimation: { get: function() { @@ -169,6 +169,28 @@ var Montage = require("montage/core/core").Montage, } }, + _isToggling: { + serializable: true, + value: true + }, + isToggling: { + serializable: true, + get: function() { + return this._isToggling; + }, + set: function(newVal) { + if (newVal !== this._isToggling) { + this._isToggling = newVal; + + if (this.bypassAnimation) { + this.isAnimated = false; + } + this.myContent.classList.remove(this.transitionClass); + this.handleCollapserLabelClick(); + } + } + }, + /* === END: Models === */ /* === BEGIN: Draw cycle === */ @@ -321,7 +343,7 @@ var Montage = require("montage/core/core").Montage, } if (this.bypassAnimation) { - this.bypassAnimation = false; + this.bypassAnimation = true; this.isAnimated = true; } } diff --git a/js/panels/Timeline/Layer.reel/Layer.js b/js/panels/Timeline/Layer.reel/Layer.js index 94d1f7e9..f9bba499 100644 --- a/js/panels/Timeline/Layer.reel/Layer.js +++ b/js/panels/Timeline/Layer.reel/Layer.js @@ -306,24 +306,28 @@ var Layer = exports.Layer = Montage.create(Component, { // Are the various collapsers collapsed or not _isMainCollapsed : { - value: "" + serializable: true, + value: true }, isMainCollapsed : { + serializable: true, get: function() { return this._isMainCollapsed; }, set: function(newVal) { + this.log('layer.js: isMainCollapsed: ' + newVal); if (newVal !== this._isMainCollapsed) { this._isMainCollapsed = newVal; - this.needsDraw = true; } } }, _isTransformCollapsed : { + serializable: true, value: true }, isTransformCollapsed : { + serializable: true, get: function() { return this._isTransformCollapsed; }, @@ -336,9 +340,11 @@ var Layer = exports.Layer = Montage.create(Component, { }, _isPositionCollapsed : { + serializable: true, value: true }, isPositionCollapsed : { + serializable: true, get: function() { return this._isPositionCollapsed; }, @@ -351,9 +357,11 @@ var Layer = exports.Layer = Montage.create(Component, { }, _isStyleCollapsed : { + serializable: true, value: true }, isStyleCollapsed : { + serializable: true, get: function() { return this._isStyleCollapsed; }, @@ -364,6 +372,19 @@ var Layer = exports.Layer = Montage.create(Component, { } } }, + _animateCollapser : { + serializable: true, + value: false + }, + animateCollapser : { + serializable: true, + get: function() { + return this._animateCollapser; + }, + set: function(newVal) { + this._animateCollapser = newVal; + } + }, /* END: Models */ @@ -404,10 +425,19 @@ var Layer = exports.Layer = Montage.create(Component, { this.mainCollapser.contentHeight = 60; this.myContent.style.height = "0px"; this.mainCollapser.element = this.myContent; - //this.mainCollapser.isCollapsedAtStart = true; this.mainCollapser.isCollapsed = this.isMainCollapsed; this.mainCollapser.isAnimated = true; this.element.setAttribute("data-layerid", this.layerID); + // Bind the collapser's isToggling property to the isMainCollapsed property, + // so a change in one will affect the other. + Object.defineBinding(this.mainCollapser, "isToggling", { + boundObject: this, + boundObjectPropertyPath: "isMainCollapsed", + oneway: false + }); + this.mainCollapser.clicker.addEventListener("click", this.handleMainCollapserClick.bind(this), false); + + /* this.mainCollapser.labelClickEvent = function(boolBypass) { var newEvent = document.createEvent("CustomEvent"); newEvent.initCustomEvent("layerEvent", false, true); @@ -418,15 +448,25 @@ var Layer = exports.Layer = Montage.create(Component, { defaultEventManager.dispatchEvent(newEvent); that.isMainCollapsed = that.mainCollapser.isCollapsed; } + */ //this.mainCollapser.needsDraw = true; this.positionCollapser.clicker = this.clickerPosition; this.positionCollapser.myContent = this.contentPosition; this.positionCollapser.element = this.contentPosition; this.positionCollapser.contentHeight = 40; - // this.positionCollapser.isCollapsedAtStart = true; this.positionCollapser.isCollapsed = this.isPositionCollapsed; - this.positionCollapser.isAnimated = true; + this.positionCollapser.isAnimated = false; + // Bind the collapser's isToggling property to the isPositionCollapsed property, + // so a change in one will affect the other. + Object.defineBinding(this.positionCollapser, "isToggling", { + boundObject: this, + boundObjectPropertyPath: "isPositionCollapsed", + oneway: false + }); + this.positionCollapser.clicker.addEventListener("click", this.handlePositionCollapserClick.bind(this), false); + + /* this.positionCollapser.labelClickEvent = function(boolBypass) { var newEvent = document.createEvent("CustomEvent"); newEvent.initCustomEvent("layerEvent", false, true); @@ -437,15 +477,26 @@ var Layer = exports.Layer = Montage.create(Component, { defaultEventManager.dispatchEvent(newEvent); that.isPositionCollapsed = that.positionCollapser.isCollapsed; } + */ //this.positionCollapser.needsDraw = true; this.transformCollapser.clicker = this.clickerTransform; this.transformCollapser.myContent = this.contentTransform; this.transformCollapser.element = this.contentTransform; this.transformCollapser.contentHeight = 100; - // this.transformCollapser.isCollapsedAtStart = true; this.transformCollapser.isCollapsed = this.isTransformCollapsed; - this.transformCollapser.isAnimated = true; + this.transformCollapser.isAnimated = false; + // Bind the collapser's isToggling property to the isTransformCollapsed property, + // so a change in one will affect the other. + Object.defineBinding(this.transformCollapser, "isToggling", { + boundObject: this, + boundObjectPropertyPath: "isTransformCollapsed", + oneway: false + }); + this.transformCollapser.clicker.addEventListener("click", this.handleTransformCollapserClick.bind(this), false); + + + /* this.transformCollapser.labelClickEvent = function(boolBypass) { var newEvent = document.createEvent("CustomEvent"); newEvent.initCustomEvent("layerEvent", false, true); @@ -456,6 +507,7 @@ var Layer = exports.Layer = Montage.create(Component, { defaultEventManager.dispatchEvent(newEvent); that.isTransformCollapsed = that.transformCollapser.isCollapsed; } + */ //this.transformCollapser.needsDraw = true; this.styleCollapser.clicker = this.clickerStyle; @@ -463,7 +515,18 @@ var Layer = exports.Layer = Montage.create(Component, { this.styleCollapser.element = this.contentStyle; this.styleCollapser.isCollapsed = this.isStyleCollapsed; this.styleCollapser.contentHeight = 0; - this.styleCollapser.isAnimated = true; + this.styleCollapser.isAnimated = false; + // Bind the collapser's isToggling property to the isStyleCollapsed property, + // so a change in one will affect the other. + Object.defineBinding(this.styleCollapser, "isToggling", { + boundObject: this, + boundObjectPropertyPath: "isStyleCollapsed", + oneway: false + }); + this.styleCollapser.clicker.addEventListener("click", this.handleStyleCollapserClick.bind(this), false); + + + /* this.styleCollapser.labelClickEvent = function(boolBypass) { var newEvent = document.createEvent("CustomEvent"); newEvent.initCustomEvent("layerEvent", false, true); @@ -474,6 +537,7 @@ var Layer = exports.Layer = Montage.create(Component, { defaultEventManager.dispatchEvent(newEvent); that.isStyleCollapsed = that.styleCollapser.isCollapsed; } + */ //this.styleCollapser.needsDraw = true; // Add event listeners to add and delete style buttons @@ -493,20 +557,22 @@ var Layer = exports.Layer = Montage.create(Component, { value: function() { // Coordinate the collapsers + this.log('layer.js draw') if (this.mainCollapser.isCollapsed !== this.isMainCollapsed) { - this.mainCollapser.bypassAnimation = true; + this.log('layer.js draw: this.animateCollapser ' + this.animateCollapser) + this.mainCollapser.bypassAnimation = this.animateCollapser; this.mainCollapser.toggle(); } if (this.positionCollapser.isCollapsed !== this.isPositionCollapsed) { - this.positionCollapser.bypassAnimation = true; + this.positionCollapser.bypassAnimation = this.animateCollapser; this.positionCollapser.toggle(); } if (this.transformCollapser.isCollapsed !== this.isTransformCollapsed) { - this.transformCollapser.bypassAnimation = true; + this.transformCollapser.bypassAnimation = this.animateCollapser; this.transformCollapser.toggle(); } if (this.styleCollapser.isCollapsed !== this.isStyleCollapsed) { - this.styleCollapser.bypassAnimation = true; + this.styleCollapser.bypassAnimation = this.animateCollapser; this.styleCollapser.toggle(); } if (this.isSelected) { @@ -597,7 +663,7 @@ var Layer = exports.Layer = Montage.create(Component, { // Set up the event info and dispatch the event newEvent.styleSelection = mySelection; - defaultEventManager.dispatchEvent(newEvent); + //defaultEventManager.dispatchEvent(newEvent); } }, @@ -617,7 +683,7 @@ var Layer = exports.Layer = Montage.create(Component, { newEvent.layerID = this.layerID; newEvent.styleID = this.arrLayerStyles[selectedIndex].styleID; newEvent.styleSelection = selectedIndex; - defaultEventManager.dispatchEvent(newEvent); + //defaultEventManager.dispatchEvent(newEvent); // Delete the style from the view this.arrLayerStyles.splice(selectedIndex, 1); @@ -724,6 +790,50 @@ var Layer = exports.Layer = Montage.create(Component, { } } }, + handleMainCollapserClick : { + value: function(event) { + this.mainCollapser.bypassAnimation = false; + this.animateCollapser = true; + if (this.isMainCollapsed) { + this.isMainCollapsed = false; + } else { + this.isMainCollapsed = true; + } + } + }, + handlePositionCollapserClick : { + value: function(event) { + this.positionCollapser.bypassAnimation = false; + //this.animateCollapser = true; + if (this.isPositionCollapsed) { + this.isPositionCollapsed = false; + } else { + this.isPositionCollapsed = true; + } + } + }, + handleTransformCollapserClick : { + value: function(event) { + this.transformCollapser.bypassAnimation = false; + //this.animateCollapser = true; + if (this.isTransformCollapsed) { + this.isTransformCollapsed = false; + } else { + this.isTransformCollapsed = true; + } + } + }, + handleStyleCollapserClick : { + value: function(event) { + this.styleCollapser.bypassAnimation = false; + //this.animateCollapser = true; + if (this.isStyleCollapsed) { + this.isStyleCollapsed = false; + } else { + this.isStyleCollapsed = true; + } + } + }, /* End: Event handlers */ /* Begin: Logging routines */ diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.html b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.html index 92adee05..77481ac0 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.html +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.html @@ -101,6 +101,11 @@ "boundObjectPropertyPath" : "objectAtCurrentIteration.isTransformCollapsed", "oneway" : false }, + "animateCollapser" : { + "boundObject" : {"@" : "repetition1"}, + "boundObjectPropertyPath" : "objectAtCurrentIteration.animateCollapser", + "oneway" : false + }, "isSelected" : { "boundObject" : {"@" : "repetition1"}, "boundObjectPropertyPath" : "objectAtCurrentIteration.isSelected", @@ -116,6 +121,11 @@ "boundObjectPropertyPath" : "objectAtCurrentIteration.isStyleCollapsed", "oneway" : false }, + "animateCollapser" : { + "boundObject" : {"@" : "repetition1"}, + "boundObjectPropertyPath" : "objectAtCurrentIteration.animateCollapser", + "oneway" : false + }, "dtextPositionX" : { "boundObject" : {"@" : "repetition1"}, "boundObjectPropertyPath" : "objectAtCurrentIteration.dtextPositionX", @@ -164,7 +174,7 @@ "bindings": { "objects": { "boundObject": {"@": "owner"}, - "boundObjectPropertyPath": "arrTracks", + "boundObjectPropertyPath": "arrLayers", "oneway": false } } @@ -178,7 +188,7 @@ "bindings" : { "trackID" : { "boundObject" : {"@" : "repetition2"}, - "boundObjectPropertyPath" : "objectAtCurrentIteration.trackID", + "boundObjectPropertyPath" : "objectAtCurrentIteration.layerID", "oneway" : false }, "tweens" : { @@ -231,6 +241,11 @@ "boundObjectPropertyPath" : "objectAtCurrentIteration.isTransformCollapsed", "oneway" : false }, + "animateCollapser" : { + "boundObject" : {"@" : "repetition2"}, + "boundObjectPropertyPath" : "objectAtCurrentIteration.animateCollapser", + "oneway" : false + }, "isStyleCollapsed" : { "boundObject" : {"@" : "repetition2"}, "boundObjectPropertyPath" : "objectAtCurrentIteration.isStyleCollapsed", diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 59306705..49f044d7 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js @@ -47,11 +47,11 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { _cacheArrays : { value: function() { // Cache this.arrLayers and this.arrTracks. - this.log('cacheArrays ' + this._boolCacheArrays) + //this.log('cacheArrays ' + this._boolCacheArrays) if (this._boolCacheArrays) { - this.log('caching arrays for ', this.application.ninja.currentDocument.name); + //this.log('caching arrays for ', this.application.ninja.currentDocument.name); this.application.ninja.currentDocument.tlArrLayers = this.arrLayers; - this.application.ninja.currentDocument.tlArrTracks = this.arrTracks; + //this.application.ninja.currentDocument.tlArrTracks = this.arrTracks; } } }, @@ -530,6 +530,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { while (layerResult = this.returnedObject[hashIndex]) { trackResult = this.returnedTrack[hashIndex]; if (layerResult.deleted !== true) { + + // TODO: Help from Kruti this.arrTracks.push(trackResult); this.arrLayers.push(layerResult); @@ -545,6 +547,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { while (dLayer[hashVariable]) { if (dLayer[hashVariable]._layerID === event.detail._el._layerID) { dLayer[hashVariable].deleted = false; + + // TODO: Help from Kruti this.arrTracks.splice(event.detail._layerPosition, 0, event.detail._track); this.arrLayers.splice(event.detail._layerPosition, 0, event.detail._el); this.selectLayer(event.detail._layerPosition); @@ -572,6 +576,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { while (dLayer[hashVariable]) { if (dLayer[hashVariable]._layerID === event.detail._el._layerID) { dLayer[hashVariable].deleted = false; + + // TODO: Help from Kruti this.arrTracks.splice(event.detail._layerPosition, 0, event.detail._track); this.arrLayers.splice(event.detail._layerPosition, 0, event.detail._el); this.selectLayer(event.detail._layerPosition); @@ -608,6 +614,11 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { thingToPush.deleted = false; thingToPush.isSelected = false; thingToPush.created=false; + thingToPush.isTrackAnimated = false; + thingToPush.currentKeyframeRule = null; + thingToPush.trackPosition = 0; + thingToPush.arrStyleTracks = []; + thingToPush.tweens = []; if (_firstLayerDraw) { this.application.ninja.currentSelectedContainer.uuid=this._hashKey; @@ -619,7 +630,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { event.detail.ele.uuid =nj.generateRandom(); thingToPush.elementsList.push(event.detail.ele); } - + /* newTrack.trackID = this.currentLayerNumber; newTrack.isMainCollapsed = true; newTrack.isPositionCollapsed = true; @@ -630,6 +641,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { newTrack.trackPosition = 0; newTrack.arrStyleTracks = []; newTrack.tweens = []; + */ if (_firstLayerDraw) { if (this.application.ninja.currentSelectedContainer.id === "UserContent") { @@ -643,18 +655,23 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { myIndex = this.layerRepetition.selectedIndexes[0]; thingToPush.layerPosition = myIndex; thingToPush.isSelected = true; - newTrack.trackPosition = myIndex; - this.arrTracks.splice(myIndex, 0, newTrack); + //newTrack.trackPosition = myIndex; + thingToPush.trackPosition = myIndex; + //this.arrTracks.splice(myIndex, 0, newTrack); this.arrLayers.splice(myIndex, 0, thingToPush); this._LayerUndoPosition = myIndex; this.selectLayer(myIndex); this.hashLayerNumber.setItem(this._hashKey, thingToPush); this.hashInstance.setItem(this._hashKey, thingToPush, myIndex); + + // TODO: Help from Kruti this.hashTrackInstance.setItem(this._hashKey, newTrack, myIndex); } else { - this.arrTracks.splice(0, 0, newTrack); + //this.arrTracks.splice(0, 0, newTrack); this.arrLayers.splice(0, 0, thingToPush); thingToPush.layerPosition = this.arrLayers.length - 1; + + // TODO: Help from Kruti newTrack.trackPosition = this.arrTracks.length - 1; this._LayerUndoPosition = this.arrLayers.length - 1; this.hashLayerNumber.setItem(this._hashKey, thingToPush); @@ -697,7 +714,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { dLayer[hashVariable].deleted = true; // ElementMediator.deleteElements(dLayer[myIndex].element); this.arrLayers.splice(k, 1); - this.arrTracks.splice(k, 1); + //this.arrTracks.splice(k, 1); if(k>0){ this.selectLayer(k-1); }else{ @@ -735,7 +752,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { dLayer[hashVariable].deleted = true; // ElementMediator.deleteElements(dLayer[myIndex].element); this.arrLayers.splice(k, 1); - this.arrTracks.splice(k, 1); + //this.arrTracks.splice(k, 1); if(k>0){ this.selectLayer(k-1); }else{ @@ -754,6 +771,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { if (!!this.layerRepetition.selectedIndexes) { var myIndex = this.layerRepetition.selectedIndexes[0]; this._LayerUndoObject = this.arrLayers[myIndex]; + + // TODO: Help from Kruti this._TrackUndoObject = this.arrTracks[myIndex]; dLayer = this.hashInstance.getItem(this._hashKey); @@ -761,7 +780,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { dLayer[myIndex].deleted = true; this.arrLayers.splice(myIndex, 1); - this.arrTracks.splice(myIndex, 1); + //this.arrTracks.splice(myIndex, 1); this._LayerUndoIndex = this._LayerUndoObject.layerID; this._LayerUndoPosition = myIndex; @@ -781,6 +800,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.cre