( elm: HTMLElement )
| 128 | * @return An object with left and top offsets. |
| 129 | */ |
| 130 | export function parseTransform( elm: HTMLElement ): { left: number, top: number } { |
| 131 | const position = { left: 0, top: 0 }; |
| 132 | |
| 133 | if ( elm && elm.style.transform ) { |
| 134 | const { transform } = elm.style; |
| 135 | |
| 136 | if ( transform.includes( 'translateX' ) ) { |
| 137 | position.left = parseFloat( transform.replace( /translateX\(|\)/g, '' ) ) || 0; |
| 138 | } |
| 139 | |
| 140 | if ( transform.includes( 'translateY' ) ) { |
| 141 | position.top = parseFloat( transform.replace( /translateY\(|\)/g, '' ) ) || 0; |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | return position; |
| 146 | } |
| 147 | |
| 148 | /** |
| 149 | * Fires any native event manually. |
no outgoing calls
no test coverage detected
searching dependent graphs…