[Regression] Fix the FontInspector
in the PDFBug debugging tools
The `FontInspector` was completely broken by PR 10197, and trying to select a particular font (using the checkboxes) or clicking on a piece of text currently does nothing.
This commit is contained in:
parent
f26129de26
commit
6a4dae927c
@ -21,30 +21,26 @@ var FontInspector = (function FontInspectorClosure() {
|
|||||||
var active = false;
|
var active = false;
|
||||||
var fontAttribute = 'data-font-name';
|
var fontAttribute = 'data-font-name';
|
||||||
function removeSelection() {
|
function removeSelection() {
|
||||||
var divs = document.querySelectorAll('div[' + fontAttribute + ']');
|
let divs = document.querySelectorAll(`span[${fontAttribute}]`);
|
||||||
for (var i = 0, ii = divs.length; i < ii; ++i) {
|
for (let div of divs) {
|
||||||
var div = divs[i];
|
|
||||||
div.className = '';
|
div.className = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function resetSelection() {
|
function resetSelection() {
|
||||||
var divs = document.querySelectorAll('div[' + fontAttribute + ']');
|
let divs = document.querySelectorAll(`span[${fontAttribute}]`);
|
||||||
for (var i = 0, ii = divs.length; i < ii; ++i) {
|
for (let div of divs) {
|
||||||
var div = divs[i];
|
|
||||||
div.className = 'debuggerHideText';
|
div.className = 'debuggerHideText';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function selectFont(fontName, show) {
|
function selectFont(fontName, show) {
|
||||||
var divs = document.querySelectorAll('div[' + fontAttribute + '=' +
|
let divs = document.querySelectorAll(`span[${fontAttribute}=${fontName}]`);
|
||||||
fontName + ']');
|
for (let div of divs) {
|
||||||
for (var i = 0, ii = divs.length; i < ii; ++i) {
|
|
||||||
var div = divs[i];
|
|
||||||
div.className = show ? 'debuggerShowText' : 'debuggerHideText';
|
div.className = show ? 'debuggerShowText' : 'debuggerHideText';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function textLayerClick(e) {
|
function textLayerClick(e) {
|
||||||
if (!e.target.dataset.fontName ||
|
if (!e.target.dataset.fontName ||
|
||||||
e.target.tagName.toUpperCase() !== 'DIV') {
|
e.target.tagName.toUpperCase() !== 'SPAN') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var fontName = e.target.dataset.fontName;
|
var fontName = e.target.dataset.fontName;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user