Skip to content

Commit f0c3d08

Browse files
committed
Only drag on window handler
1 parent 5bdcecc commit f0c3d08

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/main/kotlin/com/lambda/gui/components/ClickGuiLayout.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -301,13 +301,15 @@ object ClickGuiLayout : Loadable, Configurable(GuiConfig) {
301301
// For the time being I have removed the ability to collapse the windows so the titles
302302
// have more space lol.
303303
window(tag.name, flags = ImGuiWindowFlags.AlwaysAutoResize or ImGuiWindowFlags.NoCollapse) {
304-
// Start drag if the user just pressed while hovering this window
305304
if (activeDragWindowName == null && mousePressedThisFrameGlobal && ImGui.isWindowHovered()) {
306305
val mx = io.mousePos.x
307306
val my = io.mousePos.y
308-
activeDragWindowName = tag.name
309-
dragOffsetX = mx - windowPos.x
310-
dragOffsetY = my - windowPos.y
307+
val titleBarHeight = ImGui.getFrameHeight()
308+
if (my >= windowPos.y && my <= windowPos.y + titleBarHeight) {
309+
activeDragWindowName = tag.name
310+
dragOffsetX = mx - windowPos.x
311+
dragOffsetY = my - windowPos.y
312+
}
311313
}
312314

313315
ModuleRegistry.modules

0 commit comments

Comments
 (0)