mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-10 02:05:37 +02:00
Continuing fairexpand #6663
1. Expanding divs to improve text selection. (Yury) 2. Adding enhanceTextSelection as an option. 3. Moving feature functionality from text_layer_builder.js to text_layer.js. 4. Added expandTextDivs method to only load expanded divs on first click, and only show on subsequent clicks
This commit is contained in:
parent
31cd23a6df
commit
6faa84abdb
8 changed files with 433 additions and 36 deletions
|
@ -76,6 +76,8 @@ var DEFAULT_CACHE_SIZE = 10;
|
|||
* queue object.
|
||||
* @property {boolean} removePageBorders - (optional) Removes the border shadow
|
||||
* around the pages. The default is false.
|
||||
* @property {boolean} enhanceTextSelection - (optional) Enables the improved
|
||||
* text selection behaviour. The default is `false`.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -127,6 +129,7 @@ var PDFViewer = (function pdfViewer() {
|
|||
this.linkService = options.linkService || new SimpleLinkService();
|
||||
this.downloadManager = options.downloadManager || null;
|
||||
this.removePageBorders = options.removePageBorders || false;
|
||||
this.enhanceTextSelection = options.enhanceTextSelection || false;
|
||||
|
||||
this.defaultRenderingQueue = !options.renderingQueue;
|
||||
if (this.defaultRenderingQueue) {
|
||||
|
@ -352,7 +355,8 @@ var PDFViewer = (function pdfViewer() {
|
|||
defaultViewport: viewport.clone(),
|
||||
renderingQueue: this.renderingQueue,
|
||||
textLayerFactory: textLayerFactory,
|
||||
annotationLayerFactory: this
|
||||
annotationLayerFactory: this,
|
||||
enhanceTextSelection: this.enhanceTextSelection,
|
||||
});
|
||||
bindOnAfterAndBeforeDraw(pageView);
|
||||
this._pages.push(pageView);
|
||||
|
@ -798,13 +802,16 @@ var PDFViewer = (function pdfViewer() {
|
|||
* @param {PageViewport} viewport
|
||||
* @returns {TextLayerBuilder}
|
||||
*/
|
||||
createTextLayerBuilder: function (textLayerDiv, pageIndex, viewport) {
|
||||
createTextLayerBuilder: function (textLayerDiv, pageIndex, viewport,
|
||||
enhanceTextSelection) {
|
||||
return new TextLayerBuilder({
|
||||
textLayerDiv: textLayerDiv,
|
||||
eventBus: this.eventBus,
|
||||
pageIndex: pageIndex,
|
||||
viewport: viewport,
|
||||
findController: this.isInPresentationMode ? null : this.findController
|
||||
findController: this.isInPresentationMode ? null : this.findController,
|
||||
enhanceTextSelection: this.isInPresentationMode ? false :
|
||||
enhanceTextSelection,
|
||||
});
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue