Skip to content

bug: when frame_style is nil, Panel_end_drag will never be called to end a Panel resize drag after Panel_begin_drag #5484

@LouisGameDev

Description

@LouisGameDev

https://github.com/DFHack/dfhack/blob/e3165854e80411eec584c74949c73000f2aa0dcb/library/lua/gui/widgets/containers/panel.lua#L497C1-L498C1

when ---@field resizable boolean is set to true, Panel_begin_drag will be reached but Panel_end_drag will never be reached.

function Panel:onRenderFrame(dc, rect)
    Panel.super.onRenderFrame(self, dc, rect)

-- undocumented behaviour causing drag to be stuck without Panel_end_drag ever called
-- early exits
    if not self.frame_style then return end

    local inactive = self.parent_view and self.parent_view.hasFocus
            and not self.parent_view:hasFocus()
    local pause_forced = not self.no_force_pause_badge and safe_index(self.parent_view, 'force_pause')
    gui.paint_frame(dc, rect, self.frame_style, self.frame_title, inactive,
            pause_forced, self.resizable)
    if self.kbd_get_pos then
        local pos = self.kbd_get_pos()
        local pen = to_pen{fg=COLOR_GREEN, bg=COLOR_BLACK}
        dc:seek(pos.x, pos.y):pen(pen):char(string.char(0xDB))
    end
    if self.drag_offset and not self.kbd_get_pos
            and df.global.enabler.mouse_lbut_down == 0 then
-- desired callflow should reach here to properly finish a Panel drag
        Panel_end_drag(self, nil, true)
    end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions