Page 1 of 1

Allow a sprite to be the drag handle for an empty-widget (or something else that helps?)

Posted: Tue Aug 13, 2019 4:30 pm
by Godmave
I would like the user to be able to click and drag around the hud in https://mods.factorio.com/mod/vehiclehud

The code would look somewhat like this:

Code: Select all

    local gui = player.gui.screen.add({
        type = "empty-widget",
        name = "vehiclehud"
    })
...

    local face = gui.add{
        type = "sprite",
        name = "vehiclehud-face",
        sprite = "vehiclehud-face-300"
    }

face.drag_target = gui

Re: Allow a sprite to be the drag handle for an empty-widget (or something else that helps?)

Posted: Wed Aug 14, 2019 1:04 am
by Rseding91
I made every widget type that supports having a drag target set support it in the Lua API. Sprites do not support having drag targets set at the widget level.