mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 14:45:49 +01:00
Update GetRelative/AbsolutePosition to take border size into account
This commit is contained in:
parent
368ca13314
commit
5d0a58cc6a
1 changed files with 8 additions and 1 deletions
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue