colors closer to FF's, add highlightAll support

This commit is contained in:
Artur Adib 2012-09-27 12:21:04 -04:00
parent e2a2085f62
commit 6090b3edf9
2 changed files with 16 additions and 12 deletions

View File

@ -1067,7 +1067,7 @@ canvas {
margin: -1px; margin: -1px;
padding: 1px; padding: 1px;
background-color: rgba(0, 137, 26, 0.2); background-color: rgba(180, 0, 170, 0.2);
border-radius: 4px; border-radius: 4px;
} }
@ -1084,7 +1084,7 @@ canvas {
} }
.textLayer .highlight.selected { .textLayer .highlight.selected {
background-color: rgba(255, 0, 0, 0.2); background-color: rgba(0, 100, 0, 0.2);
} }
/* TODO: file FF bug to support ::-moz-selection:window-inactive /* TODO: file FF bug to support ::-moz-selection:window-inactive

View File

@ -458,22 +458,18 @@ var PDFFindBar = {
// next match when the findField is selected. // next match when the findField is selected.
document.getElementById('findPrevious').addEventListener('click', document.getElementById('findPrevious').addEventListener('click',
function() { function() { self.dispatchEvent('again', true); }
self.dispatchEvent('again', true); );
});
document.getElementById('findNext').addEventListener('click', document.getElementById('findNext').addEventListener('click', function() {
function() {
self.dispatchEvent('again', false); self.dispatchEvent('again', false);
}); });
this.highlightAll.addEventListener('click', this.highlightAll.addEventListener('click', function() {
function() {
self.dispatchEvent('highlightallchange'); self.dispatchEvent('highlightallchange');
}); });
this.caseSensitive.addEventListener('click', this.caseSensitive.addEventListener('click', function() {
function() {
self.dispatchEvent('casesensitivitychange'); self.dispatchEvent('casesensitivitychange');
}); });
}, },
@ -2276,6 +2272,7 @@ var TextLayerBuilder = function textLayerBuilder(textLayerDiv, pageIdx) {
var prevEnd = null; var prevEnd = null;
var isSelectedPage = this.pageIdx === PDFFindController.selected.pageIdx; var isSelectedPage = this.pageIdx === PDFFindController.selected.pageIdx;
var selectedMatchIdx = PDFFindController.selected.matchIdx; var selectedMatchIdx = PDFFindController.selected.matchIdx;
var highlightAll = PDFFindController.state.highlightAll;
this.clearMatches(); this.clearMatches();
@ -2323,7 +2320,14 @@ var TextLayerBuilder = function textLayerBuilder(textLayerDiv, pageIdx) {
textDivs[divIdx].className = className; textDivs[divIdx].className = className;
} }
for (var i = 0; i < matches.length; i++) { var i0 = selectedMatchIdx, i1 = i0 + 1, i;
if (highlightAll) {
i0 = 0;
i1 = matches.length;
}
for (i = i0; i < i1; i++) {
var match = matches[i]; var match = matches[i];
var begin = match.begin; var begin = match.begin;
var end = match.end; var end = match.end;