forked from joejulian/gio
widget/material: fix click area offset for Switch
The click area was mistakenly offset by half the track width, but it really should be offset by half the thumb diameter. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -118,7 +118,7 @@ func (s SwitchStyle) Layout(gtx layout.Context) layout.Dimensions {
|
||||
// Set up click area.
|
||||
clickSize := gtx.Px(unit.Dp(40))
|
||||
clickOff := f32.Point{
|
||||
X: (float32(trackWidth) - float32(clickSize)) * .5,
|
||||
X: thumbRadius - float32(clickSize)*.5,
|
||||
Y: (float32(trackHeight)-float32(clickSize))*.5 + trackOff,
|
||||
}
|
||||
defer op.Offset(clickOff).Push(gtx.Ops).Pop()
|
||||
|
||||
Reference in New Issue
Block a user