Replaces all preprocessor directives with PDFJSDev calls.

This commit is contained in:
Yury Delendik 2016-10-14 10:57:53 -05:00
parent bf52ff156d
commit 0576c9c6c6
32 changed files with 1145 additions and 904 deletions

View file

@ -333,58 +333,61 @@ var TextLayerBuilder = (function TextLayerBuilderClosure() {
div.addEventListener('mousedown', function (e) {
if (self.enhanceTextSelection && self.textLayerRenderTask) {
self.textLayerRenderTask.expandTextDivs(true);
//#if !(MOZCENTRAL || FIREFOX)
if (expandDivsTimer) {
if ((typeof PDFJSDev === 'undefined' ||
!PDFJSDev.test('FIREFOX || MOZCENTRAL')) &&
expandDivsTimer) {
clearTimeout(expandDivsTimer);
expandDivsTimer = null;
}
//#endif
return;
}
var end = div.querySelector('.endOfContent');
if (!end) {
return;
}
//#if !(MOZCENTRAL || FIREFOX)
if (typeof PDFJSDev === 'undefined' ||
!PDFJSDev.test('FIREFOX || MOZCENTRAL')) {
// 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 GENERIC
adjustTop = adjustTop && window.getComputedStyle(end).
getPropertyValue('-moz-user-select') !== 'none';
//#endif
if (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC')) {
adjustTop = adjustTop && window.getComputedStyle(end).
getPropertyValue('-moz-user-select') !== 'none';
}
if (adjustTop) {
var divBounds = div.getBoundingClientRect();
var r = Math.max(0, (e.pageY - divBounds.top) / divBounds.height);
end.style.top = (r * 100).toFixed(2) + '%';
}
//#endif
}
end.classList.add('active');
});
div.addEventListener('mouseup', function (e) {
if (self.enhanceTextSelection && self.textLayerRenderTask) {
//#if !(MOZCENTRAL || FIREFOX)
expandDivsTimer = setTimeout(function() {
if (self.textLayerRenderTask) {
self.textLayerRenderTask.expandTextDivs(false);
}
expandDivsTimer = null;
}, EXPAND_DIVS_TIMEOUT);
//#else
// self.textLayerRenderTask.expandTextDivs(false);
//#endif
if (typeof PDFJSDev === 'undefined' ||
!PDFJSDev.test('FIREFOX || MOZCENTRAL')) {
expandDivsTimer = setTimeout(function() {
if (self.textLayerRenderTask) {
self.textLayerRenderTask.expandTextDivs(false);
}
expandDivsTimer = null;
}, EXPAND_DIVS_TIMEOUT);
} else {
self.textLayerRenderTask.expandTextDivs(false);
}
return;
}
var end = div.querySelector('.endOfContent');
if (!end) {
return;
}
//#if !(MOZCENTRAL || FIREFOX)
end.style.top = '';
//#endif
if (typeof PDFJSDev === 'undefined' ||
!PDFJSDev.test('FIREFOX || MOZCENTRAL')) {
end.style.top = '';
}
end.classList.remove('active');
});
},