diff options
| -rw-r--r-- | go/ui/cardView.go | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/go/ui/cardView.go b/go/ui/cardView.go index f30b811c..960f9230 100644 --- a/go/ui/cardView.go +++ b/go/ui/cardView.go @@ -52,21 +52,23 @@ type ToggleCardView struct { expanded bool } -func NewToggleCardView(x, y, wdth, hght int, card string) *ToggleCardView { +func NewToggleCardView(x, y, wdth, hght int, cardPath string) *ToggleCardView { cv := &ToggleCardView{ EventHandlersMap: NewEventHandlersMap(), - cv: NewScaledCardView(x, y, wdth, hght, card), + cv: NewScaledCardView(x, y, wdth, hght, cardPath), expanded: true} cv.tgglBtn = NewSimpleButton(x, y+10, 80, 50, ">", func(b *SimpleButton) { shift := float64(cv.cv.Width - 80) if cv.expanded { b.label = "<" - cv.cv.Op.GeoM.Translate(shift, 0) + // cv.cv.Op.GeoM.Translate(shift, 0) + cv.cv.X = cv.cv.X + int(shift) cv.tgglBtn.X = cv.tgglBtn.X + int(shift) - 20 } else { b.label = ">" - cv.cv.Op.GeoM.Reset() + // cv.cv.Op.GeoM.Reset() + cv.cv.X = cv.cv.X - int(shift) cv.tgglBtn.X = cv.tgglBtn.X - int(shift) + 20 } cv.tgglBtn.ForceRedraw() @@ -81,11 +83,12 @@ func (cv *ToggleCardView) Draw(screen *ebiten.Image) { } func (cv *ToggleCardView) Layout() (int, int) { + // FIXME: include btn layout return cv.cv.Layout() } func (cv *ToggleCardView) Contains(x, y int) bool { - return cv.cv.Contains(x, y) + return cv.cv.Contains(x, y) || cv.tgglBtn.Contains(x, y) } func (cv *ToggleCardView) FindObjectAt(x, y int) interface{} { |
