mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-07 02:15:34 +00:00
ui/pointer: add Transparent to OpArea to allow events to pass through
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -24,6 +24,8 @@ type Event struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type OpArea struct {
|
type OpArea struct {
|
||||||
|
Transparent bool
|
||||||
|
|
||||||
kind areaKind
|
kind areaKind
|
||||||
size image.Point
|
size image.Point
|
||||||
}
|
}
|
||||||
@@ -117,11 +119,15 @@ func (op *OpArea) decode(d []byte) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (op *OpArea) hit(pos f32.Point) HitResult {
|
func (op *OpArea) hit(pos f32.Point) HitResult {
|
||||||
|
res := HitOpaque
|
||||||
|
if op.Transparent {
|
||||||
|
res = HitTransparent
|
||||||
|
}
|
||||||
switch op.kind {
|
switch op.kind {
|
||||||
case areaRect:
|
case areaRect:
|
||||||
if 0 <= pos.X && pos.X < float32(op.size.X) &&
|
if 0 <= pos.X && pos.X < float32(op.size.X) &&
|
||||||
0 <= pos.Y && pos.Y < float32(op.size.Y) {
|
0 <= pos.Y && pos.Y < float32(op.size.Y) {
|
||||||
return HitOpaque
|
return res
|
||||||
} else {
|
} else {
|
||||||
return HitNone
|
return HitNone
|
||||||
}
|
}
|
||||||
@@ -133,7 +139,7 @@ func (op *OpArea) hit(pos f32.Point) HitResult {
|
|||||||
xh := pos.X - rx
|
xh := pos.X - rx
|
||||||
yk := pos.Y - ry
|
yk := pos.Y - ry
|
||||||
if xh*xh*ry2+yk*yk*rx2 <= rx2*ry2 {
|
if xh*xh*ry2+yk*yk*rx2 <= rx2*ry2 {
|
||||||
return HitOpaque
|
return res
|
||||||
} else {
|
} else {
|
||||||
return HitNone
|
return HitNone
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user