aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-web
diff options
context:
space:
mode:
authorfschneider <florian.schneider@student.tugraz.at>2015-08-13 09:41:51 +0200
committerfschneider <florian.schneider@student.tugraz.at>2015-08-13 09:41:51 +0200
commit8e4965691bb325cda56d6d3f2abc0e2da18c45ca (patch)
treef05084d4e9b130c5078e7f748185449d5956536f /pdf-as-web
parent35a7156138f97b9a4571637e434aa24bc0a5b1d8 (diff)
downloadpdf-as-4-8e4965691bb325cda56d6d3f2abc0e2da18c45ca.tar.gz
pdf-as-4-8e4965691bb325cda56d6d3f2abc0e2da18c45ca.tar.bz2
pdf-as-4-8e4965691bb325cda56d6d3f2abc0e2da18c45ca.zip
OnePageScrolling
Diffstat (limited to 'pdf-as-web')
-rw-r--r--pdf-as-web/src/main/webapp/assets/css/style.css38
-rw-r--r--pdf-as-web/src/main/webapp/assets/js/pdf.js/web/app.js1
-rw-r--r--pdf-as-web/src/main/webapp/assets/js/pdf.js/web/viewer.js48
-rw-r--r--pdf-as-web/src/main/webapp/index.jsp7
4 files changed, 55 insertions, 39 deletions
diff --git a/pdf-as-web/src/main/webapp/assets/css/style.css b/pdf-as-web/src/main/webapp/assets/css/style.css
index 4b49b238..f5b31212 100644
--- a/pdf-as-web/src/main/webapp/assets/css/style.css
+++ b/pdf-as-web/src/main/webapp/assets/css/style.css
@@ -44,24 +44,26 @@ iframe {
}
#ViewerExternToolbar {
- margin-bottom: 2em !important;
+ margin-bottom: 1em !important;
min-width: 25em;
}
-#ViewerExternToolbar button {
+#ViewerExternToolbar div {
margin-left:0.5em;
margin-right:0.5em;
- width: 3em;
- height: 3em;
+ text-align:center;
+ width:5em;
+ height:5em;
}
-#ViewerExternToolbar div {
- margin-left:0.5em;
- margin-right:0.5em;
- width: 3em;
- height: 3em;
- text-align: center;
- font-size: 1em;
+#ViewerExternToolbar div:hover {
+ cursor:hand;
+ cursor:pointer;
+ margin:0.5em;
+ margin-top:0em;
+ margin-bottom:0em;
+
+ border: 0.1em dashed;
}
#ViewerExternToolbar img {
@@ -69,20 +71,6 @@ iframe {
height: 3em;
}
-#ViewerExternToolbar img:hover {
- cursor: hand;
- cursor: pointer;
-}
-
-#ViewerExternToolbar span {
- font-size: 2em;
-}
-
-#ViewerExternToolbar span:hover {
- cursor: hand;
- cursor: pointer;
-}
-
#fileSelector {
height: 20em;
}
diff --git a/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/app.js b/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/app.js
index 47720d42..af161a14 100644
--- a/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/app.js
+++ b/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/app.js
@@ -119,6 +119,7 @@ function displayPdf() {
registerSignaturePlacementEventHandlers();
};
fileReader.readAsArrayBuffer(file);
+ console.log("now finished");
}
/*$("#placeSignatureExtern").bind("click", function(evt) {
diff --git a/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/viewer.js b/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/viewer.js
index 7abe3a52..605d49a9 100644
--- a/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/viewer.js
+++ b/pdf-as-web/src/main/webapp/assets/js/pdf.js/web/viewer.js
@@ -179,6 +179,8 @@ function scrollIntoView(element, spot) {
* PDF.js friendly one: with scroll debounce and scroll direction.
*/
function watchScroll(viewAreaElement, callback) {
+
+ console.log("watch scroll");
var debounceScroll = function debounceScroll(evt) {
if (rAF) {
return;
@@ -188,12 +190,16 @@ function watchScroll(viewAreaElement, callback) {
rAF = null;
var currentY = viewAreaElement.scrollTop;
+ console.log("currentY: " + currentY);
var lastY = state.lastY;
if (currentY !== lastY) {
state.down = currentY > lastY;
}
+
state.lastY = currentY;
+
callback(state);
+
});
};
@@ -392,7 +398,7 @@ var ProgressBar = (function ProgressBarClosure() {
setWidth: function ProgressBar_setWidth(viewer) {
if (viewer) {
var container = viewer.parentNode;
- var scrollbarWidth = container.offsetWidth - viewer.offsetWidth;
+ var scrollbarWidth = 0; //container.offsetWidth - viewer.offsetWidth;
if (scrollbarWidth > 0) {
this.bar.setAttribute('style', 'width: calc(100% - ' +
scrollbarWidth + 'px);');
@@ -2948,6 +2954,8 @@ var PDFRenderingQueue = (function PDFRenderingQueueClosure() {
var previousPageIndex = visible.first.id - 2;
if (views[previousPageIndex] &&
!this.isViewFinished(views[previousPageIndex])) {
+ console.log("got to page: " + nextPageIndex);
+ $("#placeSignature").click();
return views[previousPageIndex];
}
}
@@ -3556,7 +3564,7 @@ var TextLayerBuilder = (function TextLayerBuilderClosure() {
this.viewport = options.viewport;
this.textDivs = [];
this.findController = options.findController || null;
- }
+ }
TextLayerBuilder.prototype = {
_finishRendering: function TextLayerBuilder_finishRendering() {
@@ -4178,7 +4186,6 @@ var PDFViewer = (function pdfViewer() {
this.container.dispatchEvent(event);
return;
}
-
event.previousPageNumber = this._currentPageNumber;
this._currentPageNumber = val;
event.pageNumber = val;
@@ -4382,14 +4389,14 @@ var PDFViewer = (function pdfViewer() {
}
},
- _scrollUpdate: function () {
+ _scrollUpdate: function () {
if (this.pagesCount === 0) {
return;
}
this.update();
for (var i = 0, ii = this.pages.length; i < ii; i++) {
this.pages[i].updatePosition();
- }
+ }
},
_setScaleDispatchEvent: function pdfViewer_setScaleDispatchEvent(
@@ -4496,6 +4503,7 @@ var PDFViewer = (function pdfViewer() {
*/
scrollPageIntoView: function PDFViewer_scrollPageIntoView(pageNumber,
dest) {
+
var pageView = this.pages[pageNumber - 1];
if (this.presentationModeState ===
@@ -4565,7 +4573,7 @@ var PDFViewer = (function pdfViewer() {
height / CSS_UNITS;
scale = Math.min(Math.abs(widthScale), Math.abs(heightScale));
break;
- default:
+ default:
return;
}
@@ -4587,10 +4595,11 @@ var PDFViewer = (function pdfViewer() {
var left = Math.min(boundingRect[0][0], boundingRect[1][0]);
var top = Math.min(boundingRect[0][1], boundingRect[1][1]);
- scrollIntoView(pageView.div, { left: left, top: top });
+ scrollIntoView(pageView.div, { left: left, top: top });
},
_updateLocation: function (firstPage) {
+ console.log("update location");
var currentScale = this._currentScale;
var currentScaleValue = this._currentScaleValue;
var normalizedScaleValue =
@@ -4608,6 +4617,8 @@ var PDFViewer = (function pdfViewer() {
var intLeft = Math.round(topLeft[0]);
var intTop = Math.round(topLeft[1]);
pdfOpenParams += ',' + intLeft + ',' + intTop;
+
+ console.log("stats: " + topLeft +" "+ intLeft +" "+ intTop);
this.location = {
pageNumber: pageNumber,
@@ -4615,7 +4626,7 @@ var PDFViewer = (function pdfViewer() {
top: intTop,
left: intLeft,
pdfOpenParams: pdfOpenParams
- };
+ };
},
update: function () {
@@ -6318,8 +6329,12 @@ var PDFViewerApplication = {
console.warn('Warning: AcroForm/XFA is not supported');
self.fallback(PDFJS.UNSUPPORTED_FEATURES.forms);
}
+
+
});
+
+ console.log("pdfview just finished loading");
},
setInitialView: function pdfViewSetInitialView(storedHash, scale) {
@@ -7149,10 +7164,11 @@ window.addEventListener('pagechange', function pagechange(evt) {
}, true);
function handleMouseWheel(evt) {
+
var MOUSE_WHEEL_DELTA_FACTOR = 40;
var ticks = (evt.type === 'DOMMouseScroll') ? -evt.detail :
evt.wheelDelta / MOUSE_WHEEL_DELTA_FACTOR;
- var direction = (ticks < 0) ? 'zoomOut' : 'zoomIn';
+ /*var direction = (ticks < 0) ? 'zoomOut' : 'zoomIn';
if (PresentationMode.active) {
evt.preventDefault();
@@ -7161,7 +7177,21 @@ function handleMouseWheel(evt) {
// Only zoom the pages, not the entire viewer
evt.preventDefault();
PDFViewerApplication[direction](Math.abs(ticks));
+ } */
+
+ if(ticks > 0)
+ {
+ PDFViewerApplication.page--;
+ }
+ else
+ {
+ PDFViewerApplication.page++;
}
+
+ if (evt.preventDefault) //disable default wheel action of scrolling page
+ evt.preventDefault()
+ else
+ return false
}
window.addEventListener('DOMMouseScroll', handleMouseWheel);
diff --git a/pdf-as-web/src/main/webapp/index.jsp b/pdf-as-web/src/main/webapp/index.jsp
index 2272662e..fdd3c53e 100644
--- a/pdf-as-web/src/main/webapp/index.jsp
+++ b/pdf-as-web/src/main/webapp/index.jsp
@@ -164,13 +164,10 @@
<div class="center">
<div id="ViewerExternToolbar" class="center">
<div id="placeSignatureExtern">
- <span class="glyphicon glyphicon-pencil"></span><!--<img src="assets/img/federohne.svg" title="Place Signature on current Page"> --><caption>Add</caption>
- </div>
- <div id="delSignatureExtern">
- <span class="glyphicon glyphicon-ban-circle"></span><!-- <img src="assets/img/federohne.svg" title="Remove Signature from current Page"> --><caption>Remove</caption>
+ <img src="assets/img/federohne.svg" title="Place Signature on current Page"><br>Add
</div>
<div id="placeContinue">
- <span class="glyphicon glyphicon-ok"></span><!-- <img src="assets/img/federohne.svg" title="Continue"> --><caption>Continue</caption>
+ <img src="assets/img/federohne.svg" title="Continue"><br>Continue
</div>
</div>
</div>