diff --git a/pkg/uix/canvas_scrolling.go b/pkg/uix/canvas_scrolling.go index ae59611..5c627fd 100644 --- a/pkg/uix/canvas_scrolling.go +++ b/pkg/uix/canvas_scrolling.go @@ -67,18 +67,6 @@ func (w *Canvas) loopConstrainScroll() error { var capped bool - // Constrain the top and left edges. - if w.wallpaper.pageType > level.Unbounded { - if w.Scroll.X > 0 { - w.Scroll.X = 0 - capped = true - } - if w.Scroll.Y > 0 { - w.Scroll.Y = 0 - capped = true - } - } - // Constrain the bottom and right for limited world sizes. if w.wallpaper.pageType >= level.Bounded && w.wallpaper.maxWidth+w.wallpaper.maxHeight > 0 { @@ -103,6 +91,18 @@ func (w *Canvas) loopConstrainScroll() error { } } + // Constrain the top and left edges. + if w.wallpaper.pageType > level.Unbounded { + if w.Scroll.X > 0 { + w.Scroll.X = 0 + capped = true + } + if w.Scroll.Y > 0 { + w.Scroll.Y = 0 + capped = true + } + } + if capped { return errors.New("scroll limited by level constraint") }