From 5d0a58cc6ada0626f25d09eceeca3946181ab7ef Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Thu, 25 Apr 2024 15:59:33 +1000 Subject: [PATCH] Update GetRelative/AbsolutePosition to take border size into account --- v3/pkg/application/webview_window_windows.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/v3/pkg/application/webview_window_windows.go b/v3/pkg/application/webview_window_windows.go index 88494efd9..c1389b91c 100644 --- a/v3/pkg/application/webview_window_windows.go +++ b/v3/pkg/application/webview_window_windows.go @@ -90,7 +90,10 @@ func (w *windowsWebviewWindow) setAbsolutePosition(x int, y int) { func (w *windowsWebviewWindow) absolutePosition() (int, int) { rect := w32.GetWindowRect(w.hwnd) - left, right := w.scaleToDefaultDPI(int(rect.Left), int(rect.Right)) + borderSizes := w.getBorderSizes() + x := int(rect.Left) + borderSizes.Left + y := int(rect.Top) + borderSizes.Top + left, right := w.scaleToDefaultDPI(x, y) return left, right } @@ -415,6 +418,10 @@ func (w *windowsWebviewWindow) relativePosition() (int, int) { x := int(rect.Left) - int(monitorInfo.RcWork.Left) y := int(rect.Top) - int(monitorInfo.RcWork.Top) + borderSize := w.getBorderSizes() + x += borderSize.Left + y += borderSize.Top + return w.scaleToDefaultDPI(x, y) }