45 lines
1.4 KiB
TypeScript
45 lines
1.4 KiB
TypeScript
/*
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
/**
|
|
* Ein Buchstabe. Hilfsklasse für den Renderer und Inhalt der Layout-Arrays.
|
|
* @param value Der Buchstabe, der Dargestellt werden soll.
|
|
* @param style Die CSS-Styleklassen des Buchstabens.
|
|
*/
|
|
export class Letter {
|
|
// private readonly value: string;
|
|
private style: string;
|
|
|
|
public constructor(private readonly value: string, style: string = '') {
|
|
this.value = value;
|
|
this.style = style;
|
|
// if (style) {
|
|
// this.style = style;
|
|
// }
|
|
}
|
|
|
|
public addStyle(style: string): void {
|
|
if (this.style === '') {
|
|
this.style = style;
|
|
} else {
|
|
this.style += ` ${style}`;
|
|
}
|
|
}
|
|
|
|
public toString(): string {
|
|
return `<span class="item letter ${this.style}">${this.value}</span>`;
|
|
}
|
|
}
|