export class ClipPathManager { param clipPathString returns static clipPathToPoints ( clipPathString ) { const A = [ ] ; const strPointsInClipPath = clipPathString . substr ( "polygon(" . length , clipPathString . length - "polygon(" . length - ")" . length ) ; for ( const pointStr of strPointsInClipPath . split ( "," ) ) { const point = pointStr . trim ( ) . split ( " " ) ; A . push ( { x : parseInt ( point [ 0 ] ) , y : parseInt ( point [ 1 ] ) } ) ; } return A ; } param clipPathString param ratio returns static clipPathChangeSize ( clipPathString , ratio ) { if ( clipPathString == "" ) return "" ; return ClipPathManager . pointsToClipPath ( ClipPathManager . clipPathToPoints ( clipPathString ) . map ( ( p ) => ( { x : Math . round ( p . x * ratio ) , y : Math . round ( p . y * ratio ) } ) ) ) ; } param points returns static pointsToClipPath ( points ) { return "polygon(" + points . map ( point => `${ point . x }px ${ point . y }px` ) . join ( ", " ) + ")" ; } }