* Resize function for * @param {DragOverEvent | DragOverContainer} dragEvent * @private
(dragEvent: DragOverEvent | DragOverContainerEvent)
| 120 | * @private |
| 121 | */ |
| 122 | private resize(dragEvent: DragOverEvent | DragOverContainerEvent) { |
| 123 | requestAnimationFrame(() => { |
| 124 | let over: HTMLElement | null = null; |
| 125 | const {overContainer} = dragEvent; |
| 126 | |
| 127 | if (this.mirror == null || this.mirror.parentNode == null) { |
| 128 | return; |
| 129 | } |
| 130 | |
| 131 | if (this.mirror.parentNode !== overContainer) { |
| 132 | overContainer.appendChild(this.mirror); |
| 133 | } |
| 134 | |
| 135 | if (isDragOverEvent(dragEvent)) { |
| 136 | over = dragEvent.over; |
| 137 | } |
| 138 | |
| 139 | const overElement = |
| 140 | over || |
| 141 | this.draggable.getDraggableElementsForContainer(overContainer)[0]; |
| 142 | |
| 143 | if (!overElement) { |
| 144 | return; |
| 145 | } |
| 146 | |
| 147 | requestNextAnimationFrame(() => { |
| 148 | const overRect = overElement.getBoundingClientRect(); |
| 149 | |
| 150 | if ( |
| 151 | this.mirror == null || |
| 152 | (this.lastHeight === overRect.height && |
| 153 | this.lastWidth === overRect.width) |
| 154 | ) { |
| 155 | return; |
| 156 | } |
| 157 | |
| 158 | this.mirror.style.width = `${overRect.width}px`; |
| 159 | this.mirror.style.height = `${overRect.height}px`; |
| 160 | |
| 161 | this.lastWidth = overRect.width; |
| 162 | this.lastHeight = overRect.height; |
| 163 | }); |
| 164 | }); |
| 165 | } |
| 166 | } |
no test coverage detected