Skip to content
Snippets Groups Projects
slider-element.ts 1.13 KiB
Newer Older
  • Learn to ignore specific revisions
  • mechtelm's avatar
    mechtelm committed
    import {
      FontElement,
      FontProperties,
      InputElement,
      PositionProperties,
      SurfaceElement, SurfaceProperties,
      UIElement
    } from '../../models/uI-element';
    import { initFontElement, initPositionedElement, initSurfaceElement } from '../../util/unit-interface-initializer';
    
    export class SliderElement extends InputElement implements FontElement, SurfaceElement {
      positionProps: PositionProperties;
      fontProps: FontProperties;
      surfaceProps: SurfaceProperties;
      minValue: number = 0;
      maxValue: number = 100;
      showValues: boolean = true;
      barStyle: boolean = false;
      thumbLabel: boolean = false;
    
    
      constructor(serializedElement: Partial<UIElement>) {
    
    mechtelm's avatar
    mechtelm committed
        super(serializedElement);
        Object.assign(this, serializedElement);
        this.positionProps = initPositionedElement(serializedElement);
        this.fontProps = initFontElement(serializedElement);
        this.surfaceProps = initSurfaceElement(serializedElement);
    
        this.surfaceProps.backgroundColor =
          serializedElement.surfaceProps?.backgroundColor as string || 'transparent';
        this.height = serializedElement.height || 75;
        this.width = serializedElement.width || 300;
      }
    }