2021-05-17 04:26:18 +00:00
|
|
|
import { Mask } from './mask.js';
|
|
|
|
|
|
2021-05-11 02:57:17 +00:00
|
|
|
export abstract class Tile {
|
|
|
|
|
elem: HTMLElement;
|
2021-05-17 04:26:18 +00:00
|
|
|
masks: Map<string, Mask>;
|
|
|
|
|
|
|
|
|
|
constructor(width: number, height: number, masks: Map<string, Mask>) {
|
|
|
|
|
this.masks = masks;
|
2021-05-11 02:57:17 +00:00
|
|
|
|
|
|
|
|
this.elem = document.createElement('div');
|
|
|
|
|
this.elem.style.gridColumnEnd = `span ${width}`;
|
|
|
|
|
this.elem.style.gridRowEnd = `span ${height}`;
|
2021-05-17 04:26:18 +00:00
|
|
|
// Hack to avoid floating point stitching gaps
|
|
|
|
|
this.elem.style.width = 'calc(100% + 1px)';
|
|
|
|
|
this.elem.style.height = 'calc(100% + 1px)';
|
2021-05-11 02:57:17 +00:00
|
|
|
}
|
|
|
|
|
|
2021-05-11 05:17:16 +00:00
|
|
|
abstract play(name: string): Animation | undefined;
|
|
|
|
|
|
|
|
|
|
remove(): void {
|
|
|
|
|
this.elem.remove();
|
|
|
|
|
}
|
2021-05-11 02:57:17 +00:00
|
|
|
}
|