Skip to content

Commit

Permalink
187323603 drag over webview bug (#1530)
Browse files Browse the repository at this point in the history
* Adds a pointer capture on component drag

* remove commented out code

* PR fix
  • Loading branch information
eireland authored Oct 2, 2024
1 parent 4409edb commit ab40b73
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions v3/src/components/container/free-tile-component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,20 @@ export const FreeTileComponent = observer(function FreeTileComponent({ row, tile
activeDrag => {
const dragTileId = getDragTileId(activeDrag)
if (dragTileId) {
const draggedElement = document.getElementById(dragTileId)
if (draggedElement) {
// Capture pointer events for the dragged tile
draggedElement.addEventListener('pointermove', (event) => {
if (!draggedElement.hasPointerCapture(event.pointerId)) {
draggedElement.setPointerCapture(event.pointerId)
}
})

draggedElement.addEventListener('pointerup', (event) => {
draggedElement.releasePointerCapture(event.pointerId)
})
}

if (isFreeTileRow(row)) {
const allowBringToFront = dragTileId === tile.id ? tile.content.allowBringToFront : true
row.moveTileToTop(dragTileId, allowBringToFront)
Expand Down

0 comments on commit ab40b73

Please sign in to comment.