import Utils from "../common/utils";
import Layer from "./layer";
import PanTool from "./pantool";




/**
 * Simple image layer 
 */
export default class CanvasLayer extends Layer {

  public canvas: HTMLCanvasElement;


  constructor(width: number, height: number) {
    super(width, height);
    this.addTool(new PanTool());
    this.canvas = Utils.createCanvas(width, height);
  }

  override get defaultToolKey(): string { return new PanTool().key }


  override draw(ctx: CanvasRenderingContext2D): void {

    Utils.setImageSmoothing(ctx, false);
    ctx.drawImage(this.canvas, 0, 0);

  }


}