Skip to content
Snippets Groups Projects
checkboxElement.ts 949 B
Newer Older
  • Learn to ignore specific revisions
  • import { InputElement, UIElement } from './uIElement';
    
    rhenck's avatar
    rhenck committed
    import { FontElement, SurfaceUIElement } from '../interfaces/UIElementInterfaces';
    
    import { initFontElement, initSurfaceElement } from '../util/unit-interface-initializer';
    
    rhenck's avatar
    rhenck committed
    
    export class CheckboxElement extends InputElement implements FontElement, SurfaceUIElement {
      fontColor: string = 'black';
      font: string = 'Roboto';
      fontSize: number = 18;
      bold: boolean = false;
      italic: boolean = false;
      underline: boolean = false;
    
      backgroundColor: string = 'transparent';
    
      constructor(serializedElement: UIElement, coordinates?: { x: number; y: number }) {
        super(serializedElement, coordinates);
        Object.assign(this, serializedElement);
        Object.assign(this, initFontElement());
        Object.assign(this, initSurfaceElement());
    
    
    rhenck's avatar
    rhenck committed
        this.value = serializedElement.value as boolean || false; // booleans are always initialized false
    
    
    rhenck's avatar
    rhenck committed
        this.backgroundColor = 'transparent';
      }
    }