import { Css, Insert, Remove, Replication } from '@ephox/sugar';
import * as DataTransfers from './DataTransfers';
const createGhostClone = (image) => {
    const ghost = Replication.deep(image.element);
    // Firefox will scale down non ghost images to 175px so lets limit the size to 175px in general
    Css.setAll(ghost, {
        'position': 'absolute',
        'top': '-300px',
        'max-width': '175px',
        'max-height': '175px',
        'overflow': 'hidden'
    });
    return ghost;
};
// Inspired by the ideas here. On mousedown, spawn an image at pageX, pageY
// Fire dragDrop on that image
// remove the image in a setTimeout( 0 )
// http://jsfiddle.net/stevendwood/akScu/21/
const setDragImageFromClone = (transfer, parent, image) => {
    const ghost = createGhostClone(image);
    Insert.append(parent, ghost);
    DataTransfers.setDragImage(transfer, ghost.dom, image.x, image.y);
    setTimeout(() => {
        Remove.remove(ghost);
    }, 0);
};
const setImageClone = (transfer, image, parent) => {
    setDragImageFromClone(transfer, parent, image);
};
export { setImageClone };
//# sourceMappingURL=ImageClone.js.map