From 936f59385ad1c92cebcfdc5430282c9c6a57bb8e Mon Sep 17 00:00:00 2001 From: Chintan Soni Date: Sat, 7 Nov 2015 12:24:06 +0530 Subject: [PATCH] Issue : Using arrow keys in "ImagePreviewerPlugin" duplicates the rotate buttons and Image not scroll using arrow keys. Fixed : Create buttons on initialize instead of showPage() and add logic for handling page mechanism to scroll image with arrow keys. --- ImageViewerPlugin.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ImageViewerPlugin.js b/ImageViewerPlugin.js index 955ba8c..d41bac2 100755 --- a/ImageViewerPlugin.js +++ b/ImageViewerPlugin.js @@ -3,7 +3,8 @@ function ImageViewerPlugin() { var imgElement = undefined, self = this, - rotation = 0; + rotation = 0, + currentPage = 1; function initCSS() { var pluginCSS; @@ -79,6 +80,7 @@ function ImageViewerPlugin() { self.onLoad(); initCSS(); + initButtons(); }; this.isSlideshow = function () { @@ -113,11 +115,15 @@ function ImageViewerPlugin() { // return a list of tuples (pagename, pagenode) this.getPages = function () { - return [imgElement]; + return [1, 2]; }; this.showPage = function (n) { - initButtons(); + if(n === currentPage) { + imgElement.parentNode.scrollTop -= 100; + } else { + imgElement.parentNode.scrollTop += 100; + } }; this.getPluginName = function () {