-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathborder.go
68 lines (64 loc) · 1.25 KB
/
border.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package main
import (
"github.com/as/shiny/event/mouse"
"github.com/as/ui/col"
"github.com/as/ui/win"
)
func borderHit(e mouse.Event) bool {
pt := p(e)
return inSizer(pt) || inScroll(pt)
}
func procBorderHit(e mouse.Event) {
apt := p(e)
e = rel(e, act)
pt := p(e)
switch {
case inSizer(pt):
if HasButton(1, down) {
if !apt.In(g.Area()) {
for down != 0 {
g.Move(apt)
g.Refresh()
col.Fill(g)
apt = p(readmouse(<-D.Mouse))
}
} else if canopy(apt) {
dragCol(g, actCol, e, D.Mouse)
} else {
dragTag(actCol, actTag, e, D.Mouse)
}
break
}
switch down {
case Button(2):
case Button(3):
// actCol.PrintList()
actCol.RollUp(actCol.ID(actTag), act.Bounds().Min.Y)
// actCol.PrintList()
moveMouse(act.Bounds().Min)
}
for down != 0 {
readmouse(<-D.Mouse)
}
case inScroll(pt):
switch down {
case Button(1):
scroll(act, ScrollEvent{Dy: 10, Event: e})
case Button(2):
w, _ := act.(*win.Win)
if w == nil {
break
}
w.Clicksb(pt, 0)
repaint()
for HasButton(2, down) {
w.Clicksb(p(rel(readmouse(<-D.Mouse), w)), 0)
repaint()
}
case Button(3):
scroll(act, ScrollEvent{Dy: -10, Event: e})
}
default:
logf("unknown border action at pt: %s", pt)
}
}