import { ActionSerialized } from './ActionSerialized' ; import { Drawing } from './Drawing' ; import { Action } from "./Action" ; import { getCanvas } from './main' ; export class ActionLine extends Action { get xMax ( ) : number { return Math . max ( this . x1 , this . x2 ) ; } serializeData ( ) { return { type : "line" , userid : this . userid , x1 : this . x1 , y1 : this . y1 , x2 : this . x2 , y2 : this . y2 , color : this . color } ; } constructor ( userid , private x1 , private y1 , private x2 , private y2 , private color ) { super ( userid ) ; } async redo ( ) { Drawing . drawLine ( getCanvas ( ) . getContext ( "2d" ) , this . x1 , this . y1 , this . x2 , this . y2 , 1.0 , this . color ) ; } }