import { FillTask, FILL_TYPE } from "../common/filltask";
import Tool from "../core/tool"
import NumberEditLayer from "./number-edit-layer";



export default class NumberSelectTool extends Tool {
  numberEditLayer : NumberEditLayer;

  constructor(numberEditLayer : NumberEditLayer) {
    super('number-edit-select', 'pointer');
    this.numberEditLayer = numberEditLayer;
  }
  
  override onclick(evt: MouseEvent): void {
  
    if (!this.numberEditLayer) return;

    let pp = this.numberEditLayer.translate(evt._contentPoint);
    console.log('NumberSelectTool@onclick', pp.x, pp.y);
    this.numberEditLayer.orderFill(pp.x , pp.y);
  }

  override ondblclick(evt: MouseEvent): void {
    if (!this.numberEditLayer) return;
    let pp = this.numberEditLayer.translate(evt._contentPoint);
    console.log('NumberSelectTool@ondblclick', pp.x, pp.y);
    let color = this.editor.pickColor(evt._canvasPoint, evt._contentPoint);
    this.numberEditLayer.color = color;
  }

  override onSelect(): void {
    if (!this.numberEditLayer) return;
    this.numberEditLayer.showUnorderMask = true;
    this.numberEditLayer.invalidate();
  }

}