@ -46,31 +43,27 @@ var TextLayerBuilder = function textLayerBuilder(options) {
@@ -46,31 +43,27 @@ var TextLayerBuilder = function textLayerBuilder(options) {
@ -87,19 +80,17 @@ var TextLayerBuilder = function textLayerBuilder(options) {
@@ -87,19 +80,17 @@ var TextLayerBuilder = function textLayerBuilder(options) {
// Schedule renderLayout() if the user has been scrolling,
// otherwise run it right away.
varself=this;
varlastScroll=(this.lastScrollSource===null?
0:this.lastScrollSource.lastScroll);
if(Date.now()-lastScroll>RENDER_DELAY){
// Render right away
if(Date.now()-lastScroll>RENDER_DELAY){// Render right away
this.renderLayer();
}else{
// Schedule
}else{// Schedule
if(this.renderTimer){
clearTimeout(this.renderTimer);
}
@ -109,7 +100,7 @@ var TextLayerBuilder = function textLayerBuilder(options) {
@@ -109,7 +100,7 @@ var TextLayerBuilder = function textLayerBuilder(options) {
@ -140,35 +131,31 @@ var TextLayerBuilder = function textLayerBuilder(options) {
@@ -140,35 +131,31 @@ var TextLayerBuilder = function textLayerBuilder(options) {
@ -176,9 +163,8 @@ var TextLayerBuilder = function textLayerBuilder(options) {
@@ -176,9 +163,8 @@ var TextLayerBuilder = function textLayerBuilder(options) {
i++;
}
// TODO: Do proper handling here if something goes wrong.
if(i==bidiTexts.length){
console.error('Could not find matching mapping');
if(i===bidiTexts.length){
console.error('Could not find a matching mapping');
}
varmatch={
@ -188,11 +174,11 @@ var TextLayerBuilder = function textLayerBuilder(options) {
@@ -188,11 +174,11 @@ var TextLayerBuilder = function textLayerBuilder(options) {
}
};
// # Calculate the end position.
// Calculate the end position.
matchIdx+=queryLen;
// Somewhat same array as above, but use a > instead of >= to get the end
// position right.
// Somewhat the same array as above, but use > instead of >= to get
@ -219,32 +205,23 @@ var TextLayerBuilder = function textLayerBuilder(options) {
@@ -219,32 +205,23 @@ var TextLayerBuilder = function textLayerBuilder(options) {
@ -257,12 +234,7 @@ var TextLayerBuilder = function textLayerBuilder(options) {
@@ -257,12 +234,7 @@ var TextLayerBuilder = function textLayerBuilder(options) {
div.appendChild(node);
}
functionhighlightDiv(divIdx,className){
textDivs[divIdx].className=className;
}
vari0=selectedMatchIdx,i1=i0+1,i;
vari0=selectedMatchIdx,i1=i0+1;
if(highlightAll){
i0=0;
i1=matches.length;
@ -271,36 +243,39 @@ var TextLayerBuilder = function textLayerBuilder(options) {
@@ -271,36 +243,39 @@ var TextLayerBuilder = function textLayerBuilder(options) {
@ -308,27 +283,27 @@ var TextLayerBuilder = function textLayerBuilder(options) {
@@ -308,27 +283,27 @@ var TextLayerBuilder = function textLayerBuilder(options) {
@ -340,11 +315,10 @@ var TextLayerBuilder = function textLayerBuilder(options) {
@@ -340,11 +315,10 @@ var TextLayerBuilder = function textLayerBuilder(options) {
return;
}
// Convert the matches on the page controller into the match format used