Fix setHighlight having no effect if called before initial render [#50]

This commit is contained in:
David Evans 2018-04-05 19:38:43 +01:00
parent 3d89dc3548
commit ba8232da3b
3 changed files with 7 additions and 9 deletions

View File

@ -6489,7 +6489,6 @@ define('sequence/Renderer',[
this.knownDefs.clear(); this.knownDefs.clear();
this.highlights.clear(); this.highlights.clear();
this.currentHighlight = -1;
svg.empty(this.defs); svg.empty(this.defs);
svg.empty(this.fullMask); svg.empty(this.fullMask);
svg.empty(this.lineMask); svg.empty(this.lineMask);
@ -6506,18 +6505,18 @@ define('sequence/Renderer',[
} }
setHighlight(line = null) { setHighlight(line = null) {
if(line === null || !this.highlights.has(line)) { if(line === null) {
line = -1; line = -1;
} }
if(this.currentHighlight === line) { if(this.currentHighlight === line) {
return; return;
} }
if(this.currentHighlight !== -1) { if(this.highlights.has(this.currentHighlight)) {
this.highlights.get(this.currentHighlight).forEach((o) => { this.highlights.get(this.currentHighlight).forEach((o) => {
o.setAttribute('class', 'region'); o.setAttribute('class', 'region');
}); });
} }
if(line !== -1) { if(this.highlights.has(line)) {
this.highlights.get(line).forEach((o) => { this.highlights.get(line).forEach((o) => {
o.setAttribute('class', 'region focus'); o.setAttribute('class', 'region focus');
}); });

File diff suppressed because one or more lines are too long

View File

@ -559,7 +559,6 @@ define([
this.knownDefs.clear(); this.knownDefs.clear();
this.highlights.clear(); this.highlights.clear();
this.currentHighlight = -1;
svg.empty(this.defs); svg.empty(this.defs);
svg.empty(this.fullMask); svg.empty(this.fullMask);
svg.empty(this.lineMask); svg.empty(this.lineMask);
@ -576,18 +575,18 @@ define([
} }
setHighlight(line = null) { setHighlight(line = null) {
if(line === null || !this.highlights.has(line)) { if(line === null) {
line = -1; line = -1;
} }
if(this.currentHighlight === line) { if(this.currentHighlight === line) {
return; return;
} }
if(this.currentHighlight !== -1) { if(this.highlights.has(this.currentHighlight)) {
this.highlights.get(this.currentHighlight).forEach((o) => { this.highlights.get(this.currentHighlight).forEach((o) => {
o.setAttribute('class', 'region'); o.setAttribute('class', 'region');
}); });
} }
if(line !== -1) { if(this.highlights.has(line)) {
this.highlights.get(line).forEach((o) => { this.highlights.get(line).forEach((o) => {
o.setAttribute('class', 'region focus'); o.setAttribute('class', 'region focus');
}); });