mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 01:10:08 +02:00
Replaces all preprocessor directives with PDFJSDev calls.
This commit is contained in:
parent
bf52ff156d
commit
0576c9c6c6
32 changed files with 1145 additions and 904 deletions
|
@ -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');
|
||||
});
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue