diff options
Diffstat (limited to 'js')
-rwxr-xr-x | js/controllers/document-controller.js | 9 | ||||
-rwxr-xr-x | js/document/html-document.js | 43 | ||||
-rwxr-xr-x | js/helper-classes/3D/draw-utils.js | 10 | ||||
-rwxr-xr-x | js/panels/Panel.reel/Panel.html | 20 | ||||
-rwxr-xr-x | js/panels/Panel.reel/Panel.js | 4 | ||||
-rwxr-xr-x | js/panels/PanelContainer.reel/PanelContainer.js | 77 | ||||
-rw-r--r-- | js/panels/Timeline/Collapser.js | 70 | ||||
-rw-r--r-- | js/panels/Timeline/Layer.reel/Layer.html | 129 | ||||
-rw-r--r-- | js/panels/Timeline/Layer.reel/Layer.js | 190 | ||||
-rw-r--r-- | js/panels/Timeline/TimelinePanel.reel/TimelinePanel.html | 14 | ||||
-rw-r--r-- | js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 560 | ||||
-rw-r--r-- | js/panels/Timeline/TimelineTrack.reel/TimelineTrack.html | 136 | ||||
-rw-r--r-- | js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | 138 | ||||
-rw-r--r-- | js/panels/Timeline/Tween.reel/Tween.js | 10 |
14 files changed, 815 insertions, 595 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 194496a6..a8056519 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js | |||
@@ -336,14 +336,23 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
336 | nextDocumentIndex = closeDocumentIndex - 1; | 336 | nextDocumentIndex = closeDocumentIndex - 1; |
337 | } | 337 | } |
338 | this.application.ninja.stage.stageView.switchDocument(this._documents[nextDocumentIndex]); | 338 | this.application.ninja.stage.stageView.switchDocument(this._documents[nextDocumentIndex]); |
339 | if(typeof this.activeDocument.stopVideos !== "undefined"){doc.stopVideos();} | ||
339 | this._removeDocumentView(doc.container); | 340 | this._removeDocumentView(doc.container); |
340 | }else if(this._documents.length === 0){ | 341 | }else if(this._documents.length === 0){ |
342 | if(typeof this.activeDocument.pauseAndStopVideos !== "undefined"){ | ||
343 | this.activeDocument.pauseAndStopVideos(); | ||
344 | } | ||
341 | this.activeDocument = null; | 345 | this.activeDocument = null; |
342 | this._removeDocumentView(doc.container); | 346 | this._removeDocumentView(doc.container); |
343 | this.application.ninja.stage.stageView.hideRulers(); | 347 | this.application.ninja.stage.stageView.hideRulers(); |
344 | document.getElementById("iframeContainer").style.display="block"; | 348 | document.getElementById("iframeContainer").style.display="block"; |
345 | 349 | ||
346 | this.application.ninja.stage.hideCanvas(true); | 350 | this.application.ninja.stage.hideCanvas(true); |
351 | }else{//closing inactive document tab - just clear DOM | ||
352 | if(typeof doc.pauseAndStopVideos !== "undefined"){ | ||
353 | doc.pauseAndStopVideos(); | ||
354 | } | ||
355 | this._removeDocumentView(doc.container); | ||
347 | } | 356 | } |
348 | 357 | ||
349 | NJevent("closeDocument", doc.uri); | 358 | NJevent("closeDocument", doc.uri); |
diff --git a/js/document/html-document.js b/js/document/html-document.js index b9b68972..23b55e92 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js | |||
@@ -842,6 +842,9 @@ exports.HTMLDocument = Montage.create(TextDocument, { | |||
842 | this.undoStack = this.application.ninja.undocontroller.undoQueue.slice(0); | 842 | this.undoStack = this.application.ninja.undocontroller.undoQueue.slice(0); |
843 | this.redoStack = this.application.ninja.undocontroller.redoQueue.slice(0); | 843 | this.redoStack = this.application.ninja.undocontroller.redoQueue.slice(0); |
844 | this.application.ninja.undocontroller.clearHistory();//clear history to give the next document a fresh start | 844 | this.application.ninja.undocontroller.clearHistory();//clear history to give the next document a fresh start |
845 | |||
846 | //pause videos on switching or closing the document, so that the browser does not keep downloading the media data | ||
847 | this.pauseVideos(); | ||
845 | } | 848 | } |
846 | }, | 849 | }, |
847 | 850 | ||
@@ -870,6 +873,44 @@ exports.HTMLDocument = Montage.create(TextDocument, { | |||
870 | 873 | ||
871 | 874 | ||
872 | } | 875 | } |
873 | } | 876 | }, |
874 | //////////////////////////////////////////////////////////////////// | 877 | //////////////////////////////////////////////////////////////////// |
878 | /** | ||
879 | *pause videos on switching or closing the document, so that the browser does not keep downloading the media data | ||
880 | */ | ||
881 | pauseVideos:{ | ||
882 | value:function(){ | ||
883 | var videosArr = this.documentRoot.getElementsByTagName("video"), i=0; | ||
884 | for(i=0;i<videosArr.length;i++){ | ||
885 | if(!videosArr[i].paused){ | ||
886 | videosArr[i].pause(); | ||
887 | } | ||
888 | } | ||
889 | } | ||
890 | }, | ||
891 | |||
892 | /** | ||
893 | * remove the video src on closing the document, so that the browser does not keep downloading the media data, if the tag does not get garbage collected | ||
894 | *removeSrc : boolean to remove the src if the video... set only in the close document flow | ||
895 | */ | ||
896 | stopVideos:{ | ||
897 | value:function(){ | ||
898 | var videosArr = this.documentRoot.getElementsByTagName("video"), i=0; | ||
899 | for(i=0;i<videosArr.length;i++){ | ||
900 | videosArr[i].src = ""; | ||
901 | } | ||
902 | } | ||
903 | }, | ||
904 | pauseAndStopVideos:{ | ||
905 | value:function(){ | ||
906 | var videosArr = this.documentRoot.getElementsByTagName("video"), i=0; | ||
907 | for(i=0;i<videosArr.length;i++){ | ||
908 | if(!videosArr[i].paused){ | ||
909 | videosArr[i].pause(); | ||
910 | } | ||
911 | videosArr[i].src = ""; | ||
912 | } | ||
913 | } | ||
914 | } | ||
915 | //////////////////////////////////////////////////////////////////// | ||
875 | }); \ No newline at end of file | 916 | }); \ No newline at end of file |
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index 02d946ae..63e7799a 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js | |||
@@ -112,6 +112,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
112 | this.eventManager.addEventListener("elementDeleted", this, false); | 112 | this.eventManager.addEventListener("elementDeleted", this, false); |
113 | this.eventManager.addEventListener("deleteSelection", this, false); | 113 | this.eventManager.addEventListener("deleteSelection", this, false); |
114 | this.eventManager.addEventListener("elementChange", this, false); | 114 | this.eventManager.addEventListener("elementChange", this, false); |
115 | this.eventManager.addEventListener("closeDocument", this, false); | ||
115 | } | 116 | } |
116 | }, | 117 | }, |
117 | 118 | ||
@@ -135,6 +136,15 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
135 | } | 136 | } |
136 | }, | 137 | }, |
137 | 138 | ||
139 | handleCloseDocument:{ | ||
140 | value: function() { | ||
141 | if(this.application.ninja.documentController._documents.length === 0){ | ||
142 | this._eltArray = []; | ||
143 | this._planesArray = []; | ||
144 | } | ||
145 | } | ||
146 | }, | ||
147 | |||
138 | handleElementAdded: { | 148 | handleElementAdded: { |
139 | value: function(event) { | 149 | value: function(event) { |
140 | this.addElement(event.detail); | 150 | this.addElement(event.detail); |
diff --git a/js/panels/Panel.reel/Panel.html b/js/panels/Panel.reel/Panel.html index 04e2930a..43b87940 100755 --- a/js/panels/Panel.reel/Panel.html +++ b/js/panels/Panel.reel/Panel.html | |||
@@ -113,6 +113,21 @@ | |||
113 | } | 113 | } |
114 | }, | 114 | }, |
115 | 115 | ||
116 | "disabledCondition": { | ||
117 | "module": "montage/ui/condition.reel", | ||
118 | "name": "Condition", | ||
119 | "properties": { | ||
120 | "element": {"#": "disabledCondition"} | ||
121 | }, | ||
122 | "bindings": { | ||
123 | "condition": { | ||
124 | "boundObject": {"@": "owner"}, | ||
125 | "boundObjectPropertyPath": "disabled", | ||
126 | "oneway": true | ||
127 | } | ||
128 | } | ||
129 | }, | ||
130 | |||
116 | "owner": { | 131 | "owner": { |
117 | "module": "js/panels/Panel.reel", | 132 | "module": "js/panels/Panel.reel", |
118 | "name": "Panel", | 133 | "name": "Panel", |
@@ -136,9 +151,8 @@ | |||
136 | </div> | 151 | </div> |
137 | <div class="panelBody"> | 152 | <div class="panelBody"> |
138 | <div class="panelBodyContent"> | 153 | <div class="panelBodyContent"> |
139 | <div id="panelObject" class="panelObjects"> | 154 | <div id="disabledCondition" class="panelDisabled"></div> |
140 | 155 | <div id="panelObject" class="panelObjects"></div> | |
141 | </div> | ||
142 | </div> | 156 | </div> |
143 | </div> | 157 | </div> |
144 | <div id="resizeBar" class="resizeBar"></div> | 158 | <div id="resizeBar" class="resizeBar"></div> |
diff --git a/js/panels/Panel.reel/Panel.js b/js/panels/Panel.reel/Panel.js index 2b308258..33f9b3a7 100755 --- a/js/panels/Panel.reel/Panel.js +++ b/js/panels/Panel.reel/Panel.js | |||
@@ -57,6 +57,10 @@ exports.Panel = Montage.create(Component, { | |||
57 | value: null | 57 | value: null |
58 | }, | 58 | }, |
59 | 59 | ||
60 | disabled: { | ||
61 | value:false | ||
62 | }, | ||
63 | |||
60 | collapsed: { | 64 | collapsed: { |
61 | get: function() { | 65 | get: function() { |
62 | return this._collapsed; | 66 | return this._collapsed; |
diff --git a/js/panels/PanelContainer.reel/PanelContainer.js b/js/panels/PanelContainer.reel/PanelContainer.js index dd720bd3..c40bbc21 100755 --- a/js/panels/PanelContainer.reel/PanelContainer.js +++ b/js/panels/PanelContainer.reel/PanelContainer.js | |||
@@ -47,6 +47,7 @@ exports.PanelContainer = Montage.create(Component, { | |||
47 | this['panel_'+i].flexible = p.flexible; | 47 | this['panel_'+i].flexible = p.flexible; |
48 | this['panel_'+i].modulePath = p.modulePath; | 48 | this['panel_'+i].modulePath = p.modulePath; |
49 | this['panel_'+i].moduleName = p.moduleName; | 49 | this['panel_'+i].moduleName = p.moduleName; |
50 | this['panel_'+i].disabled = true; | ||
50 | 51 | ||
51 | this.currentPanelState[p.name] = {}; | 52 | this.currentPanelState[p.name] = {}; |
52 | this.currentPanelState.version = "1.0"; | 53 | this.currentPanelState.version = "1.0"; |
@@ -64,6 +65,8 @@ exports.PanelContainer = Montage.create(Component, { | |||
64 | this.application.localStorage.setItem("panels", this.currentPanelState); | 65 | this.application.localStorage.setItem("panels", this.currentPanelState); |
65 | 66 | ||
66 | 67 | ||
68 | this.eventManager.addEventListener( "onOpenDocument", this, false); | ||
69 | this.eventManager.addEventListener( "closeDocument", this, false); | ||
67 | } | 70 | } |
68 | }, | 71 | }, |
69 | 72 | ||
@@ -81,7 +84,25 @@ exports.PanelContainer = Montage.create(Component, { | |||