Browse Source

PDF.js version 1.2.68 - See mozilla/pdf.js@8079bdddb9bfc2c8f9050bdd3486db9bdb4e7871

master v1.2.68
Pdf Bot 9 years ago
parent
commit
13ec738798
  1. 2
      bower.json
  2. 4
      build/pdf.combined.js
  3. 4
      build/pdf.js
  4. 4
      build/pdf.worker.js
  5. 2
      package.json
  6. 18
      web/pdf_viewer.css
  7. 41
      web/pdf_viewer.js

2
bower.json

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
{
"name": "pdfjs-dist",
"version": "1.2.66",
"version": "1.2.68",
"main": [
"build/pdf.js",
"build/pdf.worker.js"

4
build/pdf.combined.js

@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') { @@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') {
(typeof window !== 'undefined' ? window : this).PDFJS = {};
}
PDFJS.version = '1.2.66';
PDFJS.build = 'c05416f';
PDFJS.version = '1.2.68';
PDFJS.build = '8079bdd';
(function pdfjsWrapper() {
// Use strict in our context only - users might not want it

4
build/pdf.js

@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') { @@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') {
(typeof window !== 'undefined' ? window : this).PDFJS = {};
}
PDFJS.version = '1.2.66';
PDFJS.build = 'c05416f';
PDFJS.version = '1.2.68';
PDFJS.build = '8079bdd';
(function pdfjsWrapper() {
// Use strict in our context only - users might not want it

4
build/pdf.worker.js vendored

@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') { @@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') {
(typeof window !== 'undefined' ? window : this).PDFJS = {};
}
PDFJS.version = '1.2.66';
PDFJS.build = 'c05416f';
PDFJS.version = '1.2.68';
PDFJS.build = '8079bdd';
(function pdfjsWrapper() {
// Use strict in our context only - users might not want it

2
package.json

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
{
"name": "pdfjs-dist",
"version": "1.2.66",
"version": "1.2.68",
"description": "Generic build of Mozilla's PDF.js library.",
"keywords": [
"Mozilla",

18
web/pdf_viewer.css

@ -62,6 +62,24 @@ @@ -62,6 +62,24 @@
.textLayer ::selection { background: rgb(0,0,255); }
.textLayer ::-moz-selection { background: rgb(0,0,255); }
.textLayer .endOfContent {
display: block;
position: absolute;
left: 0px;
top: 100%;
right: 0px;
bottom: 0px;
z-index: -1;
cursor: default;
-webkit-user-select: none;
-ms-user-select: none;
-moz-user-select: none;
}
.textLayer .endOfContent.active {
top: 0px;
}
.annotationLayer .annotLink > a:hover {
opacity: 0.2;

41
web/pdf_viewer.js

@ -1506,12 +1506,17 @@ var TextLayerBuilder = (function TextLayerBuilderClosure() { @@ -1506,12 +1506,17 @@ var TextLayerBuilder = (function TextLayerBuilderClosure() {
this.viewport = options.viewport;
this.textDivs = [];
this.findController = options.findController || null;
this._bindMouse();
}
TextLayerBuilder.prototype = {
_finishRendering: function TextLayerBuilder_finishRendering() {
this.renderingDone = true;
var endOfContent = document.createElement('div');
endOfContent.className = 'endOfContent';
this.textLayerDiv.appendChild(endOfContent);
var event = document.createEvent('CustomEvent');
event.initCustomEvent('textlayerrendered', true, true, {
pageNumber: this.pageNumber
@ -1847,7 +1852,41 @@ var TextLayerBuilder = (function TextLayerBuilderClosure() { @@ -1847,7 +1852,41 @@ var TextLayerBuilder = (function TextLayerBuilderClosure() {
this.matches = this.convertMatches(this.findController === null ?
[] : (this.findController.pageMatches[this.pageIdx] || []));
this.renderMatches(this.matches);
}
},
/**
* Fixes text selection: adds additional div where mouse was clicked.
* This reduces flickering of the content if mouse slowly dragged down/up.
* @private
*/
_bindMouse: function TextLayerBuilder_bindMouse() {
var div = this.textLayerDiv;
div.addEventListener('mousedown', function (e) {
var end = div.querySelector('.endOfContent');
if (!end) {
return;
}
// On non-Firefox browsers, the selection will feel better if the height
// of the endOfContent div will be adjusted to start at mouse click
// location -- this will avoid flickering when selections moves up.
// However it does not work when selection started on empty space.
var adjustTop = e.target !== div;
if (adjustTop) {
var divBounds = div.getBoundingClientRect();
var r = Math.max(0, (e.pageY - divBounds.top) / divBounds.height);
end.style.top = (r * 100).toFixed(2) + '%';
}
end.classList.add('active');
});
div.addEventListener('mouseup', function (e) {
var end = div.querySelector('.endOfContent');
if (!end) {
return;
}
end.style.top = '';
end.classList.remove('active');
});
},
};
return TextLayerBuilder;
})();

Loading…
Cancel
Save