Avoid spurious errors while display is initializing
This commit is contained in:
parent
37caa00e5b
commit
36c8f1e48f
1 changed files with 6 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
|||
export default class {
|
||||
constructor(container, config = {}) {
|
||||
this.ready = false;
|
||||
this.svgns = "http://www.w3.org/2000/svg";
|
||||
this.config = Object.assign({
|
||||
templateSvgUrl: "static/geascript-proportional.svg",
|
||||
|
@ -19,6 +20,7 @@ export default class {
|
|||
let parser = new DOMParser();
|
||||
this.segmentsDom = parser.parseFromString(new TextDecoder().decode(blob), 'image/svg+xml');
|
||||
this.buildDisplay()
|
||||
this.ready = true;
|
||||
console.log("Done building display");
|
||||
})
|
||||
.catch(err => console.log(err));
|
||||
|
@ -47,8 +49,6 @@ export default class {
|
|||
rowSvg.id = `geavision__row_${r}_svg`;
|
||||
const width = this.config.stripWidth * this.config.cols
|
||||
rowSvg.setAttribute("viewBox", `0 0 ${parseInt(width)} ${parseInt(viewBox[3])}`);
|
||||
// rowSvg.setAttribute("width", "320");
|
||||
// rowSvg.setAttribute("height", "15");
|
||||
|
||||
for (let c = 0; c < this.config.cols; c++) {
|
||||
let g = document.createElementNS(this.svgns, "g");
|
||||
|
@ -67,6 +67,8 @@ export default class {
|
|||
}
|
||||
|
||||
eraseCol(row, col) {
|
||||
if (!this.ready)
|
||||
return;
|
||||
for (let i = 1; i <= this.config.segments; i++) {
|
||||
const e = this.container.querySelector(`#geavision__row_${row}_${col}_${i}`)
|
||||
if (e) {
|
||||
|
@ -88,6 +90,8 @@ export default class {
|
|||
}
|
||||
|
||||
applyCharacter(row, col, char) {
|
||||
if (!this.ready)
|
||||
return;
|
||||
let f = this.font[char];
|
||||
if (f === undefined)
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue