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:
Jeremy Press 2016-08-16 16:06:35 -07:00
parent 31cd23a6df
commit 6faa84abdb
8 changed files with 433 additions and 36 deletions

View file

@ -50,6 +50,8 @@ var TEXT_LAYER_RENDER_DELAY = 200; // ms
* @property {PDFRenderingQueue} renderingQueue - The rendering queue object.
* @property {IPDFTextLayerFactory} textLayerFactory
* @property {IPDFAnnotationLayerFactory} annotationLayerFactory
* @property {boolean} enhanceTextSelection - Turns on the text selection
* enhancement. The default is `false`.
*/
/**
@ -69,6 +71,7 @@ var PDFPageView = (function PDFPageViewClosure() {
var renderingQueue = options.renderingQueue;
var textLayerFactory = options.textLayerFactory;
var annotationLayerFactory = options.annotationLayerFactory;
var enhanceTextSelection = options.enhanceTextSelection || false;
this.id = id;
this.renderingId = 'page' + id;
@ -78,6 +81,7 @@ var PDFPageView = (function PDFPageViewClosure() {
this.viewport = defaultViewport;
this.pdfPageRotate = defaultViewport.rotation;
this.hasRestrictedScaling = false;
this.enhanceTextSelection = enhanceTextSelection;
this.eventBus = options.eventBus || domEvents.getGlobalEventBus();
this.renderingQueue = renderingQueue;
@ -395,9 +399,9 @@ var PDFPageView = (function PDFPageViewClosure() {
div.appendChild(textLayerDiv);
}
textLayer = this.textLayerFactory.createTextLayerBuilder(textLayerDiv,
this.id - 1,
this.viewport);
textLayer = this.textLayerFactory.
createTextLayerBuilder(textLayerDiv, this.id - 1, this.viewport,
this.enhanceTextSelection);
}
this.textLayer = textLayer;