From 60692e2e429d3265113c89fc53ed80ccd6bbcc2e Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 26 Jun 2012 09:18:36 -0700 Subject: Tag tool pre-flight should support gradients. Signed-off-by: Nivesh Rajbhandari --- js/tools/TagTool.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'js/tools/TagTool.js') diff --git a/js/tools/TagTool.js b/js/tools/TagTool.js index fac6798f..31918f92 100755 --- a/js/tools/TagTool.js +++ b/js/tools/TagTool.js @@ -81,7 +81,7 @@ exports.TagTool = Montage.create(DrawingTool, { // TODO: Add position support insertElement: { value: function(drawData) { - var element, styles; + var element, styles, color; // Create the element if(this.options.selectedElement === "custom") { @@ -95,8 +95,15 @@ exports.TagTool = Montage.create(DrawingTool, { styles = document.application.njUtils.stylesFromDraw(element, ~~drawData.width, ~~drawData.height, drawData); // Add color - if(this.options.getProperty("fill.colorMode") !== "nocolor") { - styles['background-color'] = this.options.getProperty("fill.color.css"); + color = this.options.fill; + switch(color.colorMode) { + case "nocolor": + break; + case "gradient": + styles['background-image'] = color.color.css; + break; + default: + styles['background-color'] = color.color.css; } // Add the element and styles -- cgit v1.2.3 From 1b6202d3cd517480aebafdfe97e9b89600d715ce Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Thu, 28 Jun 2012 22:46:07 -0700 Subject: video autopsy fix: moving the event handler on creation Signed-off-by: Valerio Virgillito --- js/tools/TagTool.js | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'js/tools/TagTool.js') 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, { // Create the element if(this.options.selectedElement === "custom") { element = document.application.njUtils.make(this.options.customName.value, null, this.application.ninja.currentDocument); - } else { element = document.application.njUtils.make(this.options.selectedElement, null, this.application.ninja.currentDocument); } + // Adding a canplay event to videos to pause them and prevent autoplay on stage + if(this.options.selectedElement === "video") { + element.addEventListener("canplay", this, false); + } + // Create the styles styles = document.application.njUtils.stylesFromDraw(element, ~~drawData.width, ~~drawData.height, drawData); @@ -109,6 +113,24 @@ exports.TagTool = Montage.create(DrawingTool, { // Add the element and styles this.application.ninja.elementMediator.addElements(element, styles); } + }, + + handleCanplay: { + value: function(event) { + //TODO: Figure out why the video must be seeked to the end before pausing + var time = Math.ceil(this.duration); + //Trying to display the last frame (doing minus 2 seconds if long video) + if (time > 2) { + this.currentTime = time - 2; + } else if (time > 1) { + this.currentTime = time - 1; + } else { + this.currentTime = time || 0; + } + //Pauing video + event.target.pause(); + } } + }); -- cgit v1.2.3 From 54f95bf52f660f5d8bcb3180c203ffd6ce9b8557 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Thu, 28 Jun 2012 23:27:38 -0700 Subject: Fixing reference to object --- js/tools/TagTool.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'js/tools/TagTool.js') diff --git a/js/tools/TagTool.js b/js/tools/TagTool.js index 27665ee6..80e6150d 100755 --- a/js/tools/TagTool.js +++ b/js/tools/TagTool.js @@ -118,14 +118,14 @@ exports.TagTool = Montage.create(DrawingTool, { handleCanplay: { value: function(event) { //TODO: Figure out why the video must be seeked to the end before pausing - var time = Math.ceil(this.duration); + var time = Math.ceil(event.target.duration); //Trying to display the last frame (doing minus 2 seconds if long video) if (time > 2) { - this.currentTime = time - 2; + event.target.currentTime = time - 2; } else if (time > 1) { - this.currentTime = time - 1; + event.target.currentTime = time - 1; } else { - this.currentTime = time || 0; + event.target.currentTime = time || 0; } //Pauing video event.target.pause(); -- cgit v1.2.3