UNPKG

dockview-core

Version:

Zero dependency layout manager supporting tabs, grids and splitviews

13 lines (12 loc) 715 B
import { addClasses, removeClasses } from '../dom'; export function addGhostImage(dataTransfer, ghostElement, options) { var _a, _b; // class dockview provides to force ghost image to be drawn on a different layer and prevent weird rendering issues addClasses(ghostElement, 'dv-dragged'); document.body.appendChild(ghostElement); dataTransfer.setDragImage(ghostElement, (_a = options === null || options === void 0 ? void 0 : options.x) !== null && _a !== void 0 ? _a : 0, (_b = options === null || options === void 0 ? void 0 : options.y) !== null && _b !== void 0 ? _b : 0); setTimeout(() => { removeClasses(ghostElement, 'dv-dragged'); ghostElement.remove(); }, 0); }