From 3caa9c53efbc3e33f9d29aab3db8b918f9aac113 Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Tue, 2 May 2023 22:18:34 -0400 Subject: [PATCH] Updated X backend to match --- plugins/x/x/entity.go | 8 ++------ plugins/x/x/system.go | 4 +--- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/plugins/x/x/entity.go b/plugins/x/x/entity.go index a02b484..6d04c02 100644 --- a/plugins/x/x/entity.go +++ b/plugins/x/x/entity.go @@ -18,15 +18,11 @@ type entity struct { selected bool layoutInvalid bool - isContainer bool } func (backend *backend) NewEntity (owner tomo.Element) tomo.Entity { entity := &entity { element: owner } - if _, ok := owner.(ability.Container); ok { - entity.isContainer = true - entity.InvalidateLayout() - } + entity.InvalidateLayout() return entity } @@ -179,7 +175,7 @@ func (entity *entity) DrawBackground (destination artist.Canvas) { func (entity *entity) InvalidateLayout () { if entity.window == nil { return } - if !entity.isContainer { return } + if _, ok := entity.element.(ability.Layoutable); !ok { return } entity.layoutInvalid = true entity.window.system.anyLayoutInvalid = true } diff --git a/plugins/x/x/system.go b/plugins/x/x/system.go index cf77e5c..6817aa5 100644 --- a/plugins/x/x/system.go +++ b/plugins/x/x/system.go @@ -146,9 +146,7 @@ func (system *system) resizeChildToFit () { system.child.bounds = system.canvas.Bounds() system.child.clippedBounds = system.child.bounds system.child.Invalidate() - if system.child.isContainer { - system.child.InvalidateLayout() - } + system.child.InvalidateLayout() } func (system *system) afterEvent () {