func (e *Map) Update(dt float64) {
	if e.lerpPosition.isEnabled {
		e.shape.Min.X, e.shape.Min.Y = e.lerpPosition.Lerp()
		if !e.lerpPosition.isEnabled {
			if e.lerpPosition.endFunc != nil {
				e.lerpPosition.endFunc()
			}
			if e.lerpPosition.isDestroyed {
				e.isDestroyed = true
				return
			}
		}
	}
	isRecentlyPressed := false
	for _, t := range inpututil.JustPressedTouchIDs() {
		x, y := ebiten.TouchPosition(t)
		fx := float64(x)
		fy := float64(y)
		if e.shape.Min.X <= fx && fx < e.shape.Max.X && e.shape.Min.Y <= fy && fy < e.shape.Max.Y {
			e.isPressed = true
			isRecentlyPressed = true
		} else {
			e.isPressed = false
		}
	}
	if ebiten.IsMouseButtonPressed(ebiten.MouseButtonLeft) {
		x, y := ebiten.CursorPosition()
		fx := float64(x)
		fy := float64(y)
		if e.shape.Min.X <= fx && fx < e.shape.Max.X && e.shape.Min.Y <= fy && fy < e.shape.Max.Y {
			e.isPressed = true
			isRecentlyPressed = true
		} else {
			e.isPressed = false
		}
	}
	if !isRecentlyPressed && e.isPressed {
		if e.onPressed != nil {
			e.onPressed(e)
		}
		if e.onPressFunction != nil {
			e.onPressFunction()
		}
		e.isPressed = false
	}
}
Update is called during a game update
package egui
import (
	"fmt"
	"image"
	"image/color"
	"math"
	"time"
	"github.com/hajimehoshi/ebiten"
	"github.com/hajimehoshi/ebiten/inpututil"
	"github.com/pkg/errors"
	"github.com/xackery/egui/common"
)
type Map struct {
	name            string
	image           *Image
	shape           *common.Rectangle
	text            string
	isEnabled       bool
	isVisible       bool
	isPressed       bool
	onPressed       func(e *Map)
	onPressFunction func()
	renderIndex     int64
	isDestroyed     bool
	lerpPosition    *LerpPosition
	lerpColor       *LerpColor
	color           color.Color
	data            *MapData
	path            *common.Path
}
type MapData struct {
	Source          string `json:"source,omitempty"`
	Width           int64  `json:"width,omitempty"`
	Height          int64  `json:"height,omitempty"`
	TileWidth       int64  `json:"tile_width,omitempty"`
	TileHeight      int64  `json:"tile_height,omitempty"`
	TileCount       int64  `json:"tile_count,omitempty"`
	TileSheetWidth  int64
	TileSheetHeight int64
	TileFrames      []image.Rectangle
	Layers          []MapLayer    `json:"layers,omitempty"`
	Colliders       []MapCollider `json:"colliders,omitempty"`
}
type MapLayer struct {
	Name    string    `json:"name,omitempty"`
	Opacity float32   `json:"opacity,omitempty"`
	Tiles   []MapTile `json:"tiles,omitempty"`
}
type MapCollider struct {
	IsCollider bool    `json:"is_collider,omitempty"`
	Cost       float32 `json:"cost,omitempty"`
}
func (u *UI) NewMap(name string, scene string, shape common.Rectangle, tintColor color.Color, imageName string) (*Map, error) {
	if imageName == "" {
		return nil, ErrImageNotFound
	}
	img, err := u.Image(imageName)
	if err != nil {
		return nil, errors.Wrap(err, imageName)
	}
	s, err := u.Scene(scene)
	if err != nil {
		return nil, ErrSceneNotFound
	}
	newShape := common.Rect(shape.Min.X, shape.Min.Y, shape.Max.X, shape.Max.Y)
	e := &Map{
		name:         name,
		image:        img,
		isEnabled:    true,
		isVisible:    true,
		lerpPosition: &LerpPosition{},
		lerpColor:    &LerpColor{},
		color:        tintColor,
		shape:        &newShape,
		data:         &MapData{},
		path:         common.NewPath(),
	}
	err = s.AddElement(e)
	if err != nil {
		return nil, err
	}
	return e, nil
}
func (e *Map) Name() string {
	return e.name
}
func (e *Map) IsVisible() bool {
	return e.isVisible
}
func (e *Map) IsEnabled() bool {
	return e.isEnabled
}
func (e *Map) SetEnabled(isEnabled bool) {
	e.isEnabled = isEnabled
}
func (e *Map) SetVisible(isVisible bool) {
	e.isVisible = isVisible
}
func (e *Map) RenderIndex() int64 {
	return e.renderIndex
}
func (e *Map) SetRenderIndex(renderIndex int64) {
	e.renderIndex = renderIndex
}