MirrorBar Plus 10: fix buttons going off their click area when the bar is pulled wider (barwidth.go)

This commit is contained in:
2026-11-12 23:54:32 +00:00
parent 9ea41cab49
commit 6ac9164755
+14 -3
View File
@@ -65,7 +65,18 @@ func saveLeftPref() {
// halfLimit is the longest either half may be.
func halfLimit() int32 {
sw, _ := screenSize()
return sw/2 - px(4)
return sw*layerMul()/2 - px(4)
}
// layerMul is how much bigger the layer being drawn is than the real bar (2
// while the icons are drawn at double size, otherwise 1). Lengths kept in real
// pixels, like the chosen bar width and the screen size, are scaled by it so
// the icons land on the same spots the mouse tests.
func layerMul() int32 {
if realScale <= 0 {
return 1
}
return int32(scale/realScale + 0.5)
}
// rightHalf is the length of the right half: the tray items plus a little padding.
@@ -87,7 +98,7 @@ func leftHalf() int32 {
case leftPref < 0:
h = lc
case leftPref > 0:
h = max(lc, leftPref)
h = max(lc, leftPref*layerMul())
default:
h = max(lc, rightHalf())
}
@@ -128,7 +139,7 @@ func overEdge(hwnd uintptr) bool {
func beginResize(hwnd uintptr) {
resizing = true
resizeFrom = cursorAlong()
resizeLen = leftHalf()
resizeLen = leftHalf() // always measured at real size here
pSetCapture.Call(hwnd)
}