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,
|
system: this,
|
||||||
outer: outer,
|
outer: outer,
|
||||||
drawer: outer,
|
drawer: outer,
|
||||||
|
tags: make(util.Set[string]),
|
||||||
}
|
}
|
||||||
box.canvas = util.NewMemo (func () canvas.Canvas {
|
box.canvas = util.NewMemo (func () canvas.Canvas {
|
||||||
if box.parent == nil { return nil }
|
if box.parent == nil { return nil }
|
||||||
@@ -614,7 +615,8 @@ func (this *box) propagateAlt (callback func (anyBox) bool) bool {
|
|||||||
func (this *box) transparent () bool {
|
func (this *box) transparent () bool {
|
||||||
// TODO uncomment once we have
|
// TODO uncomment once we have
|
||||||
// a way to detect texture transparency
|
// 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())*/
|
(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
|
// if so, windows should be transparent if the color has transparency
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// var minimumSizeCount = 0
|
||||||
func (this *Hierarchy) doMinimumSize () {
|
func (this *Hierarchy) doMinimumSize () {
|
||||||
this.minimumClean = true
|
this.minimumClean = true
|
||||||
|
// println("doMinimumSize", minimumSizeCount)
|
||||||
|
// minimumSizeCount ++
|
||||||
|
|
||||||
|
previousMinimumSize := this.minimumSize
|
||||||
this.minimumSize = image.Point { }
|
this.minimumSize = image.Point { }
|
||||||
if this.root != nil {
|
if this.root != nil {
|
||||||
this.minimumSize = this.root.minimumSize()
|
this.minimumSize = this.root.minimumSize()
|
||||||
}
|
}
|
||||||
|
|
||||||
this.link.NotifyMinimumSizeChange()
|
if previousMinimumSize != this.minimumSize {
|
||||||
|
this.link.NotifyMinimumSizeChange()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Hierarchy) newStyleApplicator () *styleApplicator {
|
func (this *Hierarchy) newStyleApplicator () *styleApplicator {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ type styleApplicator struct {
|
|||||||
func (this *styleApplicator) apply (box anyBox) {
|
func (this *styleApplicator) apply (box anyBox) {
|
||||||
if box.Role() != this.role {
|
if box.Role() != this.role {
|
||||||
// the role has changed, so re-cache the list of rules
|
// 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 {
|
for _, rule := range this.style.Rules {
|
||||||
role := box.Role()
|
role := box.Role()
|
||||||
// blank fields match anything
|
// blank fields match anything
|
||||||
@@ -27,10 +27,12 @@ func (this *styleApplicator) apply (box anyBox) {
|
|||||||
attrs := make(tomo.AttrSet)
|
attrs := make(tomo.AttrSet)
|
||||||
for _, rule := range this.rules {
|
for _, rule := range this.rules {
|
||||||
satisifed := true
|
satisifed := true
|
||||||
for _, tag := range rule.Tags {
|
if rule.Tags != nil {
|
||||||
if !box.Tag(tag) {
|
for _, tag := range rule.Tags {
|
||||||
satisifed = false
|
if !box.Tag(tag) {
|
||||||
break
|
satisifed = false
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ func NewMemo[T any] (update func () T) Memo[T] {
|
|||||||
func (this *Memo[T]) Value () T {
|
func (this *Memo[T]) Value () T {
|
||||||
if !this.valid {
|
if !this.valid {
|
||||||
this.cache = this.update()
|
this.cache = this.update()
|
||||||
|
this.valid = true
|
||||||
}
|
}
|
||||||
return this.cache
|
return this.cache
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user