Scrollbar, ScrollContainer use ContentObject now

This commit is contained in:
2024-05-27 16:28:48 -04:00
parent a71d81af48
commit 06561bb671
2 changed files with 11 additions and 11 deletions

View File

@@ -60,9 +60,9 @@ func NewHorizontalScrollbar () *Scrollbar {
return newScrollbar("horizontal")
}
// Link assigns this scrollbar to a ContentBox. Closing the returned cookie will
// unlink it.
func (this *Scrollbar) Link (box tomo.ContentBox) event.Cookie {
// Link assigns this scrollbar to a ContentObject. Closing the returned cookie
// will unlink it.
func (this *Scrollbar) Link (box tomo.ContentObject) event.Cookie {
this.layout.linked = box
this.linkCookie = this.newLinkCookie (
box.OnContentBoundsChange(this.handleLinkedContentBoundsChange))
@@ -230,7 +230,7 @@ func (this *Scrollbar) fallbackDragOffset () image.Point {
func (this *Scrollbar) pageSize () int {
if this.layout.linked == nil { return 0 }
viewport := this.layout.linked.InnerBounds()
viewport := this.layout.linked.GetBox().InnerBounds()
if this.layout.vertical {
return viewport.Dy()
} else {
@@ -279,7 +279,7 @@ func (this *scrollbarCookie) Close () {
type scrollbarLayout struct {
vertical bool
value float64
linked tomo.ContentBox
linked tomo.ContentObject
}
func (scrollbarLayout) MinimumSize (hints tomo.LayoutHints, boxes []tomo.Box) image.Point {
@@ -341,9 +341,9 @@ func (this scrollbarLayout) viewportContentRatio () float64 {
func (this scrollbarLayout) viewportLength () float64 {
if this.vertical {
return float64(this.linked.InnerBounds().Dy())
return float64(this.linked.GetBox().InnerBounds().Dy())
} else {
return float64(this.linked.InnerBounds().Dx())
return float64(this.linked.GetBox().InnerBounds().Dx())
}
}