aboutsummaryrefslogtreecommitdiff
path: root/js/tools
diff options
context:
space:
mode:
authorJonathan Duran2012-07-02 08:36:46 -0700
committerJonathan Duran2012-07-02 08:36:46 -0700
commit19c9beab7cd744fa1476dbec3b34995d3c7e1d7a (patch)
tree116d7f6aea60e7caccdc577ba3d2257373e7fcb7 /js/tools
parent5496f0060c5f43e7951a110241a18b9e631761bb (diff)
parent12de4e49a309e210c13eb40b2ffa158ef2eb54a7 (diff)
downloadninja-19c9beab7cd744fa1476dbec3b34995d3c7e1d7a.tar.gz
Merge branch 'refs/heads/NINJAmaster' into TimelineUber
Diffstat (limited to 'js/tools')
-rwxr-xr-xjs/tools/TagTool.js24
1 files changed, 23 insertions, 1 deletions
diff --git a/js/tools/TagTool.js b/js/tools/TagTool.js
index 31918f92..80e6150d 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(event.target.duration);
122 //Trying to display the last frame (doing minus 2 seconds if long video)
123 if (time > 2) {
124 event.target.currentTime = time - 2;
125 } else if (time > 1) {
126 event.target.currentTime = time - 1;
127 } else {
128 event.target.currentTime = time || 0;
129 }
130 //Pauing video
131 event.target.pause();
132 }
112 } 133 }
134
113}); 135});
114 136