import { toast } from 'react-toastify';

import * as Types from "../../../../types/world/worldTypes";

function DeletePillar(
    hoveredDeletablePillar: Types.RefMesh,
    floorGroup: Types.RefGroup
): void {

    ////////// Deleting the hovered Pillar from the itemsGroup //////////

    if (hoveredDeletablePillar.current) {
        (<any>hoveredDeletablePillar.current.material).dispose();
        (<any>hoveredDeletablePillar.current.geometry).dispose();
        floorGroup.current.remove(hoveredDeletablePillar.current);
        toast.success("Pillar Removed!");
        hoveredDeletablePillar.current = undefined;
    }
}

export default DeletePillar;
