aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rwxr-xr-xjs/controllers/elements/video-controller.js13
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js40
-rwxr-xr-xjs/tools/TagTool.js24
3 files changed, 55 insertions, 22 deletions
diff --git a/js/controllers/elements/video-controller.js b/js/controllers/elements/video-controller.js
index 44ba5aa1..c36752f5 100755
--- a/js/controllers/elements/video-controller.js
+++ b/js/controllers/elements/video-controller.js
@@ -28,19 +28,6 @@ exports.VideoController = Montage.create(ElementController, {
28 value: function(el, p, value) { 28 value: function(el, p, value) {
29 switch(p) { 29 switch(p) {
30 case "src": 30 case "src":
31
32 //TODO: Move this to the location where the element is created
33 el.addEventListener('canplay', function(e) {
34 //TODO: Figure out why the video must be seeked to the end before pausing
35 var time = Math.ceil(this.duration);
36 //Trying to display the last frame (doing minus 2 seconds if long video)
37 if (time > 2) this.currentTime = time - 2;
38 else if (time > 1) this.currentTime = time - 1;
39 else this.currentTime = time || 0;
40 //Pauing video
41 this.pause();
42 }, false);
43
44 el.setAttribute(p, value); 31 el.setAttribute(p, value);
45 break; 32 break;
46 case "poster": 33 case "poster":
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index 45353a08..3d31a50b 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -1217,8 +1217,21 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
1217 arrCurrentElementsSelected = []; 1217 arrCurrentElementsSelected = [];
1218 var matchedValues = 0; 1218 var matchedValues = 0;
1219 1219
1220 for(i=0;i<arrSelectedIndexesLength;i++){ 1220 /*
1221 for(j=0;j<currentLayersSelectedLength;j++){ 1221 if (arrSelectedIndexesLength !== 0) {
1222 for(i=0;i<arrSelectedIndexesLength;i++){
1223 for(j=0;j<currentLayersSelectedLength;j++){
1224
1225 if(this.arrLayers[arrSelectedIndexes[i]] === this.arrLayers[this.currentLayerSelected[j]]){
1226 matchedValues+=1;
1227 }
1228 }
1229 }
1230
1231 if(matchedValues === arrSelectedIndexesLength){
1232 return;
1233 }
1234 }
1222 1235
1223 if(this.arrLayers[arrSelectedIndexes[i]] === this.arrLayers[this.currentLayersSelected[j]]){ 1236 if(this.arrLayers[arrSelectedIndexes[i]] === this.arrLayers[this.currentLayersSelected[j]]){
1224 matchedValues+=1; 1237 matchedValues+=1;
@@ -1226,11 +1239,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
1226 } 1239 }
1227 } 1240 }
1228 1241
1229 if(matchedValues === arrSelectedIndexesLength){
1230 return;
1231 }
1232 1242
1233 /*
1234 // TODO: this should probably check to see if it actually needs to run. 1243 // TODO: this should probably check to see if it actually needs to run.
1235 1244
1236 console.log(arrSelectedIndexes); 1245 console.log(arrSelectedIndexes);
@@ -1266,6 +1275,21 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
1266 if (arrSelectedIndexes.indexOf(i) < 0) { 1275 if (arrSelectedIndexes.indexOf(i) < 0) {
1267 this.arrLayers[i].layerData.isSelected = false; 1276 this.arrLayers[i].layerData.isSelected = false;
1268 this.triggerLayerBinding(i); 1277 this.triggerLayerBinding(i);
1278
1279 // Check to see if this layer, that we're deselecting, has
1280 // any selected keyframes associated with it. If it does, deselect them.
1281 for (var j = 0; j < this.selectedTweens.length; j++) {
1282 var currentStageElement;
1283 if (typeof(this.selectedTweens[j].parentComponent.parentComponent.trackType) === "undefined") {
1284 currentStageElement = this.selectedTweens[j].parentComponent.parentComponent.stageElement;
1285 } else {
1286 currentStageElement = this.selectedTweens[j].parentComponent.parentComponent.parentComponent.parentComponent.parentComponent.parentComponent.stageElement;
1287 }
1288 if (this.arrLayers[i].layerData.stageElement === currentStageElement) {
1289 this.selectedTweens[j].deselectTween();
1290 this.selectedTweens.splice(j, 1);
1291 }
1292 }
1269 } 1293 }
1270 } 1294 }
1271 } 1295 }
@@ -1273,8 +1297,8 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
1273 this.currentLayersSelected = false; 1297 this.currentLayersSelected = false;
1274 } 1298 }
1275 1299
1276 // Deselect any tweens 1300 // Deselect tweens
1277 this.deselectTweens(); 1301 //this.deselectTweens();
1278 1302
1279 1303
1280 // If we are actually going to be selecting things, create an empty array to use 1304 // If we are actually going to be selecting things, create an empty array to use
diff --git a/js/tools/TagTool.js b/js/tools/TagTool.js
index 31918f92..27665ee6 100755
--- a/js/tools/TagTool.js
+++ b/js/tools/TagTool.js
@@ -86,11 +86,15 @@ exports.TagTool = Montage.create(DrawingTool, {
86 // Create the element 86 // Create the element
87 if(this.options.selectedElement === "custom") { 87 if(this.options.selectedElement === "custom") {
88 element = document.application.njUtils.make(this.options.customName.value, null, this.application.ninja.currentDocument); 88 element = document.application.njUtils.make(this.options.customName.value, null, this.application.ninja.currentDocument);
89
90 } else { 89 } else {
91 element = document.application.njUtils.make(this.options.selectedElement, null, this.application.ninja.currentDocument); 90 element = document.application.njUtils.make(this.options.selectedElement, null, this.application.ninja.currentDocument);
92 } 91 }
93 92
93 // Adding a canplay event to videos to pause them and prevent autoplay on stage
94 if(this.options.selectedElement === "video") {
95 element.addEventListener("canplay", this, false);
96 }
97
94 // Create the styles 98 // Create the styles
95 styles = document.application.njUtils.stylesFromDraw(element, ~~drawData.width, ~~drawData.height, drawData); 99 styles = document.application.njUtils.stylesFromDraw(element, ~~drawData.width, ~~drawData.height, drawData);
96 100
@@ -109,6 +113,24 @@ exports.TagTool = Montage.create(DrawingTool, {
109 // Add the element and styles 113 // Add the element and styles
110 this.application.ninja.elementMediator.addElements(element, styles); 114 this.application.ninja.elementMediator.addElements(element, styles);
111 } 115 }
116 },
117
118 handleCanplay: {
119 value: function(event) {
120 //TODO: Figure out why the video must be seeked to the end before pausing
121 var time = Math.ceil(this.duration);
122 //Trying to display the last frame (doing minus 2 seconds if long video)
123 if (time > 2) {
124 this.currentTime = time - 2;
125 } else if (time > 1) {
126 this.currentTime = time - 1;
127 } else {
128 this.currentTime = time || 0;
129 }
130 //Pauing video
131 event.target.pause();
132 }
112 } 133 }
134
113}); 135});
114 136