Compare commits
3 Commits
ab6bdeaba3
...
v0.7.1
| Author | SHA1 | Date | |
|---|---|---|---|
| 3b4ab56914 | |||
| e7f16645eb | |||
| ccbbb735fd |
2
go.mod
2
go.mod
@@ -3,7 +3,7 @@ module git.tebibyte.media/tomo/backend
|
||||
go 1.20
|
||||
|
||||
require (
|
||||
git.tebibyte.media/tomo/tomo v0.46.0
|
||||
git.tebibyte.media/tomo/tomo v0.46.1
|
||||
git.tebibyte.media/tomo/typeset v0.7.1
|
||||
git.tebibyte.media/tomo/xgbkb v1.0.1
|
||||
github.com/jezek/xgb v1.1.1
|
||||
|
||||
4
go.sum
4
go.sum
@@ -1,6 +1,6 @@
|
||||
git.tebibyte.media/sashakoshka/xgbkb v1.0.0/go.mod h1:pNcE6TRO93vHd6q42SdwLSTTj25L0Yzggz7yLe0JV6Q=
|
||||
git.tebibyte.media/tomo/tomo v0.46.0 h1:OC18hlnE2PaZmQ5IQx3weMI4ePbZc4kbQDfWP191Bn0=
|
||||
git.tebibyte.media/tomo/tomo v0.46.0/go.mod h1:WrtilgKB1y8O2Yu7X4mYcRiqOlPR8NuUnoA/ynkQWrs=
|
||||
git.tebibyte.media/tomo/tomo v0.46.1 h1:/8fT6I9l4TK529zokrThbNDHGRvUsNgif1Zs++0PBSQ=
|
||||
git.tebibyte.media/tomo/tomo v0.46.1/go.mod h1:WrtilgKB1y8O2Yu7X4mYcRiqOlPR8NuUnoA/ynkQWrs=
|
||||
git.tebibyte.media/tomo/typeset v0.7.1 h1:aZrsHwCG5ZB4f5CruRFsxLv5ezJUCFUFsQJJso2sXQ8=
|
||||
git.tebibyte.media/tomo/typeset v0.7.1/go.mod h1:PwDpSdBF3l/EzoIsa2ME7QffVVajnTHZN6l3MHEGe1g=
|
||||
git.tebibyte.media/tomo/xgbkb v1.0.1 h1:b3HDUopjdQp1MZrb5Vpil4bOtk3NnNXtfQW27Blw2kE=
|
||||
|
||||
@@ -75,7 +75,8 @@ func (this *System) newBox (outer anyBox) *box {
|
||||
if box.parent == nil { return nil }
|
||||
parentCanvas := box.parent.getCanvas()
|
||||
if parentCanvas == nil { return nil }
|
||||
return parentCanvas.SubCanvas(box.bounds)
|
||||
drawableArea := box.bounds.Intersect(box.parent.getInnerClippingBounds())
|
||||
return parentCanvas.SubCanvas(drawableArea)
|
||||
})
|
||||
if outer == nil {
|
||||
box.drawer = box
|
||||
@@ -259,6 +260,24 @@ func (this *box) unsetAttr (kind tomo.AttrKind, user bool) {
|
||||
}
|
||||
}
|
||||
|
||||
func (this *box) unsetAllAttrs (user bool) {
|
||||
// keep this in sync with tomo.AttrKind!
|
||||
this.outer.unsetAttr(tomo.AttrKindColor, user)
|
||||
this.outer.unsetAttr(tomo.AttrKindTexture, user)
|
||||
this.outer.unsetAttr(tomo.AttrKindTextureMode, user)
|
||||
this.outer.unsetAttr(tomo.AttrKindBorder, user)
|
||||
this.outer.unsetAttr(tomo.AttrKindMinimumSize, user)
|
||||
this.outer.unsetAttr(tomo.AttrKindPadding, user)
|
||||
this.outer.unsetAttr(tomo.AttrKindGap, user)
|
||||
this.outer.unsetAttr(tomo.AttrKindTextColor, user)
|
||||
this.outer.unsetAttr(tomo.AttrKindDotColor, user)
|
||||
this.outer.unsetAttr(tomo.AttrKindFace, user)
|
||||
this.outer.unsetAttr(tomo.AttrKindWrap, user)
|
||||
this.outer.unsetAttr(tomo.AttrKindAlign, user)
|
||||
this.outer.unsetAttr(tomo.AttrKindOverflow, user)
|
||||
this.outer.unsetAttr(tomo.AttrKindLayout, user)
|
||||
}
|
||||
|
||||
func (this *box) setBounds (bounds image.Rectangle) {
|
||||
if this.bounds == bounds { return }
|
||||
this.bounds = bounds
|
||||
@@ -624,6 +643,7 @@ func (this *box) recursiveReApply () {
|
||||
// applicator for every box, it's so style applicators can cache
|
||||
// information about the boxes they're linked to (like all rules
|
||||
// with a matching role).
|
||||
this.unsetAllAttrs(false)
|
||||
this.lastStyleNonce = hierarchyStyleNonce
|
||||
this.styleApplicator = hierarchy.newStyleApplicator()
|
||||
this.invalidateStyle()
|
||||
|
||||
@@ -298,6 +298,10 @@ func (this *containerBox) getCanvas () canvas.Canvas {
|
||||
return this.canvas.Value()
|
||||
}
|
||||
|
||||
func (this *containerBox) getInnerClippingBounds () image.Rectangle {
|
||||
return this.innerClippingBounds
|
||||
}
|
||||
|
||||
func (this *containerBox) notifyMinimumSizeChange (child anyBox) {
|
||||
this.invalidateMinimum()
|
||||
size := child.minimumSize()
|
||||
|
||||
@@ -193,6 +193,10 @@ func (this *Hierarchy) getCanvas () canvas.Canvas {
|
||||
return this.canvas
|
||||
}
|
||||
|
||||
func (this *Hierarchy) getInnerClippingBounds () image.Rectangle {
|
||||
return this.canvas.Bounds()
|
||||
}
|
||||
|
||||
func (this *Hierarchy) getModifiers () input.Modifiers {
|
||||
return this.modifiers
|
||||
}
|
||||
|
||||
@@ -12,6 +12,9 @@ type parent interface {
|
||||
getHierarchy () *Hierarchy
|
||||
// canvas returns the canvas held by the parent.
|
||||
getCanvas () canvas.Canvas
|
||||
// getInnerClippingBounds returns the area of the canvas that children
|
||||
// can draw to.
|
||||
getInnerClippingBounds () image.Rectangle
|
||||
// notifyMinimumSizeChange informs the parent that the minimum size of
|
||||
// one of its children has changed.
|
||||
notifyMinimumSizeChange (anyBox)
|
||||
|
||||
Reference in New Issue
Block a user