* defines an element that is used to get the offset and scale from grid transforms * returns the scale and offsets from said element
(parent: HTMLElement)
| 725 | * returns the scale and offsets from said element |
| 726 | */ |
| 727 | public static getValuesFromTransformedElement(parent: HTMLElement): DragTransform { |
| 728 | const transformReference = document.createElement('div'); |
| 729 | Utils.addElStyles(transformReference, { |
| 730 | opacity: '0', |
| 731 | position: 'fixed', |
| 732 | top: 0 + 'px', |
| 733 | left: 0 + 'px', |
| 734 | width: '1px', |
| 735 | height: '1px', |
| 736 | zIndex: '-999999', |
| 737 | }); |
| 738 | parent.appendChild(transformReference); |
| 739 | const transformValues = transformReference.getBoundingClientRect(); |
| 740 | parent.removeChild(transformReference); |
| 741 | transformReference.remove(); |
| 742 | return { |
| 743 | xScale: 1 / transformValues.width, |
| 744 | yScale: 1 / transformValues.height, |
| 745 | xOffset: transformValues.left, |
| 746 | yOffset: transformValues.top, |
| 747 | } |
| 748 | } |
| 749 | |
| 750 | /** swap the given object 2 field values */ |
| 751 | public static swap(o: unknown, a: string, b: string): void { |
no test coverage detected