forked from joejulian/gio
ui/gesture,ui/editor: don't focus and show keyboard on touch press
Wait until click for touches. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -16,6 +16,7 @@ import (
|
||||
type ClickEvent struct {
|
||||
Type ClickType
|
||||
Position f32.Point
|
||||
Source pointer.Source
|
||||
}
|
||||
|
||||
type ClickState uint8
|
||||
@@ -94,7 +95,7 @@ func (c *Click) Update(q pointer.Events) []ClickEvent {
|
||||
switch e.Type {
|
||||
case pointer.Release:
|
||||
if c.State == StatePressed {
|
||||
events = append(events, ClickEvent{Type: TypeClick, Position: e.Position})
|
||||
events = append(events, ClickEvent{Type: TypeClick, Position: e.Position, Source: e.Source})
|
||||
}
|
||||
c.State = StateNormal
|
||||
case pointer.Cancel:
|
||||
@@ -104,7 +105,7 @@ func (c *Click) Update(q pointer.Events) []ClickEvent {
|
||||
break
|
||||
}
|
||||
c.State = StatePressed
|
||||
events = append(events, ClickEvent{Type: TypePress, Position: e.Position})
|
||||
events = append(events, ClickEvent{Type: TypePress, Position: e.Position, Source: e.Source})
|
||||
case pointer.Move:
|
||||
if c.State == StatePressed && !e.Hit {
|
||||
c.State = StateNormal
|
||||
|
||||
+3
-2
@@ -86,8 +86,9 @@ func (e *Editor) Update(c *ui.Config, pq pointer.Events, kq key.Events) {
|
||||
}
|
||||
scrollTo := false
|
||||
for _, evt := range e.clicker.Update(pq) {
|
||||
switch evt.Type {
|
||||
case gesture.TypePress:
|
||||
switch {
|
||||
case evt.Type == gesture.TypePress && evt.Source == pointer.Mouse,
|
||||
evt.Type == gesture.TypeClick && evt.Source == pointer.Touch:
|
||||
scrollTo = true
|
||||
e.blinkStart = c.Now
|
||||
e.moveCoord(image.Point{
|
||||
|
||||
Reference in New Issue
Block a user