Merge pull request #7618 from jeremypress/fix-enhanced-double-click
fixing #7590 by delaying div shrink after mouse up
This commit is contained in:
commit
1564dc311a
@ -28,6 +28,8 @@
|
||||
}
|
||||
}(this, function (exports, domEvents, pdfjsLib) {
|
||||
|
||||
var EXPAND_DIVS_TIMEOUT = 300; // ms
|
||||
|
||||
/**
|
||||
* @typedef {Object} TextLayerBuilderOptions
|
||||
* @property {HTMLDivElement} textLayerDiv - The text layer container.
|
||||
@ -321,9 +323,16 @@ var TextLayerBuilder = (function TextLayerBuilderClosure() {
|
||||
_bindMouse: function TextLayerBuilder_bindMouse() {
|
||||
var div = this.textLayerDiv;
|
||||
var self = this;
|
||||
var expandDivsTimer = null;
|
||||
div.addEventListener('mousedown', function (e) {
|
||||
if (self.enhanceTextSelection && self.textLayerRenderTask) {
|
||||
self.textLayerRenderTask.expandTextDivs(true);
|
||||
//#if !(MOZCENTRAL || FIREFOX)
|
||||
if (expandDivsTimer) {
|
||||
clearTimeout(expandDivsTimer);
|
||||
expandDivsTimer = null;
|
||||
}
|
||||
//#endif
|
||||
return;
|
||||
}
|
||||
var end = div.querySelector('.endOfContent');
|
||||
@ -350,7 +359,14 @@ var TextLayerBuilder = (function TextLayerBuilderClosure() {
|
||||
});
|
||||
div.addEventListener('mouseup', function (e) {
|
||||
if (self.enhanceTextSelection && self.textLayerRenderTask) {
|
||||
self.textLayerRenderTask.expandTextDivs(false);
|
||||
//#if !(MOZCENTRAL || FIREFOX)
|
||||
expandDivsTimer = setTimeout(function() {
|
||||
self.textLayerRenderTask.expandTextDivs(false);
|
||||
expandDivsTimer = null;
|
||||
}, EXPAND_DIVS_TIMEOUT);
|
||||
//#else
|
||||
// self.textLayerRenderTask.expandTextDivs(false);
|
||||
//#endif
|
||||
return;
|
||||
}
|
||||
var end = div.querySelector('.endOfContent');
|
||||
|
Loading…
Reference in New Issue
Block a user