import { ConstraintDrawing } from './ConstraintDrawing' ; import { ActionSerialized } from './ActionSerialized' ; import { Action } from "./Action" ; import { MagnetMovementUpdater } from './MagnetMovementRecorder' ; export class ActionMagnetSwitchBackgroundForeground extends Action { readonly magnetid : string ; readonly points : { x : number ; y : number ; } [ ] = [ ] ; get xMax ( ) : number { return 0 ; } serializeData ( ) { return { type : "magnetswitchbackgroundforeground" , pause : this . pause , userid : this . userid , magnetid : this . magnetid } ; } param userid param magnetid param points constructor ( userid , magnetid ) { super ( userid ) ; this . magnetid = magnetid ; this . isDirectlyUndoable = true ; } createOverviewImage ( ) { return "url(img/icons/E103.svg)" ; } do ( ) { const m = document . getElementById ( this . magnetid ) ; const z = - parseInt ( m . style . zIndex ) ; /** animations */ m . classList . remove ( "magnetToForeground" ) ; m . classList . remove ( "magnetToBackground" ) ; if ( z < 0 ) m . classList . add ( "magnetToBackground" ) ; else m . classList . add ( "magnetToForeground" ) ; m . style . zIndex = z + "" ; } /** switching between back/foreground is an involution */ async redo ( ) { this . do ( ) ; } async undo ( ) { this . do ( ) ; } }