Added Pos methods to DisplayDrag{Enter,Move}Event.

This commit is contained in:
Sander Schobers 2021-06-07 07:48:24 +02:00
parent b63fc999e1
commit 7fa5601307
3 changed files with 11 additions and 3 deletions

View File

@ -34,7 +34,7 @@ func (t *dragDropEventTarget) DragEnter(pos geom.PointF32, files []string) {
}
func (t *dragDropEventTarget) DragMove(pos geom.PointF32) {
t.pushEvent(&DisplayDragMoveEnter{EventBase: t.eventBase(), X: pos.X, Y: pos.Y})
t.pushEvent(&DisplayDragMoveEvent{EventBase: t.eventBase(), X: pos.X, Y: pos.Y})
}
func (t *dragDropEventTarget) DragLeave() {

View File

@ -12,15 +12,23 @@ type DisplayDragEnterEvent struct {
Files []string
}
func (e DisplayDragEnterEvent) Pos() geom.PointF32 {
return geom.PtF32(e.X, e.Y)
}
type DisplayDragLeaveEvent struct {
EventBase
}
type DisplayDragMoveEnter struct {
type DisplayDragMoveEvent struct {
EventBase
X, Y float32
}
func (e DisplayDragMoveEvent) Pos() geom.PointF32 {
return geom.PtF32(e.X, e.Y)
}
type DisplayDropEvent struct {
EventBase
X, Y float32

View File

@ -45,7 +45,7 @@ func (p *ping) Render(ctx ui.Context) {
func (d *dropFiles) Handle(ctx ui.Context, e ui.Event) bool {
switch e := e.(type) {
case *ui.DisplayDragMoveEnter:
case *ui.DisplayDragMoveEvent:
d.ping.tick = time.Now()
d.ping.position = geom.PtF32(e.X, e.Y)
d.ping.over = true