Backend unsets style attributes if they are no longer specified
This commit is contained in:
parent
e4fdde3da1
commit
328ec438b1
@ -4,9 +4,10 @@ import "git.tebibyte.media/tomo/tomo"
|
||||
import "git.tebibyte.media/tomo/backend/style"
|
||||
|
||||
type styleApplicator struct {
|
||||
style *style.Style
|
||||
role tomo.Role
|
||||
rules []style.Rule
|
||||
style *style.Style
|
||||
role tomo.Role
|
||||
rules []style.Rule
|
||||
currentSet style.AttrSet
|
||||
}
|
||||
|
||||
func (this *styleApplicator) apply (box anyBox) {
|
||||
@ -41,7 +42,18 @@ func (this *styleApplicator) apply (box anyBox) {
|
||||
}
|
||||
}
|
||||
|
||||
// reset an attribute if it is no longer specified
|
||||
if this.currentSet != nil {
|
||||
for kind := range this.currentSet {
|
||||
_, exists := attrs[kind]
|
||||
if !exists {
|
||||
box.unsetAttr(kind, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// apply that list of attributes
|
||||
this.currentSet = attrs
|
||||
for _, attr := range attrs {
|
||||
box.setAttr(attr, false)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user