Updated X backend to match
This commit is contained in:
		
							parent
							
								
									4a723ff296
								
							
						
					
					
						commit
						3caa9c53ef
					
				| @ -18,15 +18,11 @@ type entity struct { | |||||||
| 
 | 
 | ||||||
| 	selected      bool | 	selected      bool | ||||||
| 	layoutInvalid bool | 	layoutInvalid bool | ||||||
| 	isContainer   bool |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (backend *backend) NewEntity (owner tomo.Element) tomo.Entity { | func (backend *backend) NewEntity (owner tomo.Element) tomo.Entity { | ||||||
| 	entity := &entity { element: owner } | 	entity := &entity { element: owner } | ||||||
| 	if _, ok := owner.(ability.Container); ok { |  | ||||||
| 		entity.isContainer = true |  | ||||||
| 	entity.InvalidateLayout() | 	entity.InvalidateLayout() | ||||||
| 	} |  | ||||||
| 	return entity | 	return entity | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -179,7 +175,7 @@ func (entity *entity) DrawBackground (destination artist.Canvas) { | |||||||
| 
 | 
 | ||||||
| func (entity *entity) InvalidateLayout () { | func (entity *entity) InvalidateLayout () { | ||||||
| 	if entity.window == nil { return } | 	if entity.window == nil { return } | ||||||
| 	if !entity.isContainer { return } | 	if _, ok := entity.element.(ability.Layoutable); !ok { return } | ||||||
| 	entity.layoutInvalid = true | 	entity.layoutInvalid = true | ||||||
| 	entity.window.system.anyLayoutInvalid = true | 	entity.window.system.anyLayoutInvalid = true | ||||||
| } | } | ||||||
|  | |||||||
| @ -146,10 +146,8 @@ func (system *system) resizeChildToFit () { | |||||||
| 	system.child.bounds        = system.canvas.Bounds() | 	system.child.bounds        = system.canvas.Bounds() | ||||||
| 	system.child.clippedBounds = system.child.bounds | 	system.child.clippedBounds = system.child.bounds | ||||||
| 	system.child.Invalidate() | 	system.child.Invalidate() | ||||||
| 	if system.child.isContainer { |  | ||||||
| 	system.child.InvalidateLayout() | 	system.child.InvalidateLayout() | ||||||
| } | } | ||||||
| } |  | ||||||
| 
 | 
 | ||||||
| func (system *system) afterEvent () { | func (system *system) afterEvent () { | ||||||
| 	if system.anyLayoutInvalid { | 	if system.anyLayoutInvalid { | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user