import { AbstractDrawFunction } from "asciiflow/client/draw/function" ; import { Layer } from "asciiflow/client/layer" ; import { store } from "asciiflow/client/store" ; import { Vector } from "asciiflow/client/vector" ; export class DrawFreeform extends AbstractDrawFunction { private currentLayer : Layer ; start ( position ) { this . currentLayer = new Layer ( ) ; this . currentLayer . set ( position , store . freeformCharacter ) ; store . currentCanvas . setScratchLayer ( this . currentLayer ) ; } move ( position ) { [ this . currentLayer ] = new Layer ( ) . apply ( this . currentLayer ) ; this . currentLayer . set ( position , store . freeformCharacter ) ; store . currentCanvas . setScratchLayer ( this . currentLayer ) ; } end ( ) { store . currentCanvas . commitScratch ( ) ; } getCursor ( position ) { return "crosshair" ; } handleKey ( value ) { if ( value && value . length === 1 ) { store . freeformCharacter = value ; } } }