import { ClipPathManager } from './ClipPathManager' ; import { Action } from './Action' ; import { ActionSerialized } from './ActionSerialized' ; example export class ActionMagnetChangeSizeRatio extends Action { get xMax ( ) : number { return 0 ; } serializeData ( ) { return { type : "magnetchangesizeratio" , pause : this . pause , userid : this . userid , magnetid : this . magnetid , ratio : this . ratio } ; } param userid param magnetid param ratio constructor ( userid , private readonly magnetid , private readonly ratio ) { super ( userid ) ; this . isDirectlyUndoable = true ; } param ratio description private magnetChangeSize ( ratio ) { const magnet = document . getElementById ( this . magnetid ) ; if ( ! magnet . style . width ) magnet . style . width = magnet . clientWidth + "px" ; magnet . style . clipPath = ClipPathManager . clipPathChangeSize ( magnet . style . clipPath , ratio ) ; magnet . style . width = ( parseInt ( magnet . style . width ) * ratio ) + "px" ; } async redo ( ) { this . magnetChangeSize ( this . ratio ) ; } async undo ( ) { this . magnetChangeSize ( 1 / this . ratio ) ; } }