Fix drag and drop indicator positioning when not using desktop preview

This commit is contained in:
Andrew Kingston 2021-10-06 13:59:25 +01:00
parent f6a18ca550
commit fe35d08422
1 changed files with 11 additions and 1 deletions

View File

@ -17,7 +17,17 @@
if (!bounds || !side) { if (!bounds || !side) {
return null return null
} }
const { left, top, width, height } = bounds
// Get preview offset
const root = document.getElementById("clip-root")
const rootBounds = root.getBoundingClientRect()
// Subtract preview offset from bounds
let { left, top, width, height } = bounds
left -= rootBounds.left
top -= rootBounds.top
// Determine position
if (side === Sides.Top || side === Sides.Bottom) { if (side === Sides.Top || side === Sides.Bottom) {
return { return {
top: side === Sides.Top ? top - 4 : top + height, top: side === Sides.Top ? top - 4 : top + height,