mirror of
https://github.com/wavetermdev/wails.git
synced 2026-08-05 13:53:43 -07:00
Update GetRelative/AbsolutePosition to take border size into account
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user