Draggable left edge resize, part 1
This commit is contained in:
@@ -128,17 +128,20 @@ func pillPos(pw, ph int32) (int32, int32) {
|
||||
return defaultPos(pw, ph)
|
||||
}
|
||||
sw, sh := screenSize()
|
||||
x := clampI(customCX-pw/2, 0, sw-pw)
|
||||
y := clampI(customY-ph/2, 0, sh-ph)
|
||||
return x, y
|
||||
l := leftHalf() // the center line stays at the remembered spot
|
||||
if vertical {
|
||||
return clampI(customCX-pw/2, 0, sw-pw), clampI(customY-l, 0, sh-ph)
|
||||
}
|
||||
return clampI(customCX-l, 0, sw-pw), clampI(customY-ph/2, 0, sh-ph)
|
||||
}
|
||||
|
||||
func defaultPos(pw, ph int32) (int32, int32) {
|
||||
sw, sh := screenSize()
|
||||
l := leftHalf() // the center line sits at the middle of the screen
|
||||
if vertical {
|
||||
return sw - pw - barGap(), (sh - ph) / 2
|
||||
return sw - pw - barGap(), sh/2 - l
|
||||
}
|
||||
return (sw - pw) / 2, sh - ph - barGap()
|
||||
return sw/2 - l, sh - ph - barGap()
|
||||
}
|
||||
|
||||
// finishDrag runs when a drag ends: remember the new spot, or snap back to the
|
||||
@@ -152,7 +155,12 @@ func finishDrag(hwnd uintptr) {
|
||||
resetPos(hwnd)
|
||||
return
|
||||
}
|
||||
customPos, customCX, customY = true, (wr.Left+wr.Right)/2, (wr.Top+wr.Bottom)/2
|
||||
l := leftHalf()
|
||||
if vertical {
|
||||
customPos, customCX, customY = true, (wr.Left+wr.Right)/2, wr.Top+l
|
||||
} else {
|
||||
customPos, customCX, customY = true, wr.Left+l, (wr.Top+wr.Bottom)/2
|
||||
}
|
||||
savePos()
|
||||
if appbarOn {
|
||||
// A floating bar no longer reserves screen space.
|
||||
@@ -249,7 +257,7 @@ func appOfSeq(t int) int {
|
||||
func rowLayout(clientW, clientH int32) []rect {
|
||||
n := int32(len(apps))
|
||||
sl := int32(slot())
|
||||
cx := clientW / 2
|
||||
cx := axisX(clientW)
|
||||
bw := px(36)
|
||||
if n > 0 {
|
||||
avail := cx - startWidth() - px(8)
|
||||
|
||||
Reference in New Issue
Block a user