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

function updateFloorLines(
    onlyFloorlines: Types.RefOnlyFloorLines,
    DragedPoint: Types.Mesh | { uuid: string, position: Types.Vector3 }
): void {

    //////////  Update onlyFloorlines.current if it contains the dragged point //////////

    onlyFloorlines.current.forEach((floorline) => {
        floorline.forEach((line) => {
            line.forEach((point) => {
                const [position, uuid] = point;
                if (uuid === DragedPoint.uuid) {
                    position.x = DragedPoint.position.x;
                    position.y = 0.01;
                    position.z = DragedPoint.position.z;
                }
            });
        });
    });
}

export default updateFloorLines;
