Compare commits
3 Commits
v0.5.0
...
e4cba4a7c9
| Author | SHA1 | Date | |
|---|---|---|---|
| e4cba4a7c9 | |||
| 6192a1e9cc | |||
| 5864c74691 |
@@ -69,6 +69,7 @@ func (this *System) newBox (outer anyBox) *box {
|
||||
system: this,
|
||||
outer: outer,
|
||||
drawer: outer,
|
||||
tags: make(util.Set[string]),
|
||||
}
|
||||
box.canvas = util.NewMemo (func () canvas.Canvas {
|
||||
if box.parent == nil { return nil }
|
||||
@@ -614,7 +615,8 @@ func (this *box) propagateAlt (callback func (anyBox) bool) bool {
|
||||
func (this *box) transparent () bool {
|
||||
// TODO uncomment once we have
|
||||
// a way to detect texture transparency
|
||||
return util.Transparent(this.attrColor.Value()) /*&&
|
||||
col := this.attrColor.Value().Color
|
||||
return col == nil || util.Transparent(col) /*&&
|
||||
(this.texture == nil || !this.texture.Opaque())*/
|
||||
}
|
||||
|
||||
|
||||
@@ -341,15 +341,21 @@ func (this *Hierarchy) drawBackgroundPart (canvas.Canvas) {
|
||||
// if so, windows should be transparent if the color has transparency
|
||||
}
|
||||
|
||||
// var minimumSizeCount = 0
|
||||
func (this *Hierarchy) doMinimumSize () {
|
||||
this.minimumClean = true
|
||||
// println("doMinimumSize", minimumSizeCount)
|
||||
// minimumSizeCount ++
|
||||
|
||||
previousMinimumSize := this.minimumSize
|
||||
this.minimumSize = image.Point { }
|
||||
if this.root != nil {
|
||||
this.minimumSize = this.root.minimumSize()
|
||||
}
|
||||
|
||||
this.link.NotifyMinimumSizeChange()
|
||||
if previousMinimumSize != this.minimumSize {
|
||||
this.link.NotifyMinimumSizeChange()
|
||||
}
|
||||
}
|
||||
|
||||
func (this *Hierarchy) newStyleApplicator () *styleApplicator {
|
||||
|
||||
@@ -11,7 +11,7 @@ type styleApplicator struct {
|
||||
func (this *styleApplicator) apply (box anyBox) {
|
||||
if box.Role() != this.role {
|
||||
// the role has changed, so re-cache the list of rules
|
||||
this.rules = make([]*tomo.Rule, 4)
|
||||
this.rules = make([]*tomo.Rule, 0, 4)
|
||||
for _, rule := range this.style.Rules {
|
||||
role := box.Role()
|
||||
// blank fields match anything
|
||||
@@ -27,10 +27,12 @@ func (this *styleApplicator) apply (box anyBox) {
|
||||
attrs := make(tomo.AttrSet)
|
||||
for _, rule := range this.rules {
|
||||
satisifed := true
|
||||
for _, tag := range rule.Tags {
|
||||
if !box.Tag(tag) {
|
||||
satisifed = false
|
||||
break
|
||||
if rule.Tags != nil {
|
||||
for _, tag := range rule.Tags {
|
||||
if !box.Tag(tag) {
|
||||
satisifed = false
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -83,6 +83,7 @@ func NewMemo[T any] (update func () T) Memo[T] {
|
||||
func (this *Memo[T]) Value () T {
|
||||
if !this.valid {
|
||||
this.cache = this.update()
|
||||
this.valid = true
|
||||
}
|
||||
return this.cache
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user