import { Share } from './share' ; import { BoardManager } from './boardManager' ; import { Action } from "Action" ; import { Operation } from "./Operation" ; /**
 * add a specific action (draw a line, erase, etc.) at time t
 */ export class OperationAddAction extends Operation { constructor ( private action , private t ) { super ( ) ; } undo ( ) { const t0 = BoardManager . timeline . getTimeStepForActionCloseTo ( this . action , this . t ) ; console . log ( `undo by removing the corresponding action that is at timestep ${ t0 }` ) ; if ( t0 >= 0 ) Share . execute ( "timelineRemoveAction" , [ t0 ] ) ; } redo ( ) { Share . execute ( "timelineAddAction" , [ this . t , JSON . stringify ( this . action . serialize ( ) ) ] ) ; } }