import { OptionManager } from './OptionManager' ; import { User } from './User' ; /**
 * This is an abstract tool (like erasing, drawing, drawing a line, rectangle, drawing a circle)
 */ export abstract class Tool { xInit = 0 ; yInit = 0 ; x = 0 ; y = 0 ; isDrawing = false ; user : User ; constructor ( user ) { this . user = user ; } static cursorVisible = true ; static cursor : string ; static init ( ) { OptionManager . boolean ( { name : "cursorVisible" , defaultValue : true , onChange : ( b ) => { Tool . cursorVisible = b ; document . getElementById ( "canvas" ) . style . cursor = Tool . cursorVisible ? Tool . cursor : "none" ; } } ) ; } destructor ( ) { } abstract mousedown ( evt ) ; abstract mousemove ( evt ) ; abstract mouseup ( evt ) ; setToolCursorImage ( srcImage ) { Tool . cursor = `url(${ srcImage . data }) ${ srcImage . x } ${ srcImage . y }, auto` ; document . getElementById ( "canvas" ) . style . cursor = Tool . cursorVisible ? Tool . cursor : "none" ; } updateCursor ( ) { } }