Scroll bar background drawing
This commit is contained in:
parent
9c37cb8fef
commit
4367bba602
@ -122,7 +122,7 @@ func (element *ScrollContainer) HandleMouseScroll (
|
||||
x, y int,
|
||||
deltaX, deltaY float64,
|
||||
) {
|
||||
// TODO: do not pass this down to the child
|
||||
// TODO: use this to scroll. do not pass this down to the child
|
||||
}
|
||||
|
||||
func (element *ScrollContainer) Selected () (selected bool) {
|
||||
@ -228,31 +228,35 @@ func (element *ScrollContainer) recalculate () {
|
||||
}
|
||||
|
||||
// move the bars to the edge of the element
|
||||
horizontal.bounds = horizontal.bounds.Add (
|
||||
bounds.Max.Sub(horizontal.bounds.Max))
|
||||
vertical.bounds = vertical.bounds.Add (
|
||||
bounds.Max.Sub(vertical.bounds.Max))
|
||||
horizontal.bounds.Min.Y += bounds.Max.Y - horizontal.bounds.Dy()
|
||||
horizontal.bounds.Max.Y += bounds.Max.Y
|
||||
vertical.bounds.Min.X += bounds.Max.X - vertical.bounds.Dx()
|
||||
vertical.bounds.Max.X += bounds.Max.X
|
||||
}
|
||||
|
||||
func (element *ScrollContainer) draw () {
|
||||
artist.Paste(element.core, element.child, image.Point { })
|
||||
element.drawHorizontalBar()
|
||||
element.drawVerticalBar()
|
||||
artist.FillRectangle (
|
||||
element, theme.BackgroundPattern(),
|
||||
element, theme.DeadPattern(),
|
||||
image.Rect (
|
||||
element.vertical.bounds.Min.X,
|
||||
element.horizontal.bounds.Min.Y,
|
||||
element.vertical.bounds.Max.X,
|
||||
element.horizontal.bounds.Max.Y))
|
||||
element.drawHorizontalBar()
|
||||
element.drawVerticalBar()
|
||||
}
|
||||
|
||||
func (element *ScrollContainer) drawHorizontalBar () {
|
||||
|
||||
artist.FillRectangle (
|
||||
element, theme.SunkenPattern(),
|
||||
element.horizontal.bounds)
|
||||
}
|
||||
|
||||
func (element *ScrollContainer) drawVerticalBar () {
|
||||
|
||||
artist.FillRectangle (
|
||||
element, theme.SunkenPattern(),
|
||||
element.vertical.bounds)
|
||||
}
|
||||
|
||||
func (element *ScrollContainer) updateMinimumSize () {
|
||||
|
@ -34,9 +34,14 @@ var sunkenPattern = artist.NewMultiBorder (
|
||||
},
|
||||
artist.Border { Stroke: artist.NewUniform(hex(0x97a09cFF)) })
|
||||
|
||||
var deadPattern = artist.NewMultiBorder (
|
||||
artist.Border { Weight: 1, Stroke: strokePattern },
|
||||
artist.Border { Stroke: artist.NewUniform(hex(0x97a09cFF)) })
|
||||
|
||||
func AccentPattern () (artist.Pattern) { return accentPattern }
|
||||
func BackgroundPattern () (artist.Pattern) { return backgroundPattern }
|
||||
func SunkenPattern () (artist.Pattern) { return sunkenPattern}
|
||||
func DeadPattern () (artist.Pattern) { return deadPattern }
|
||||
func ForegroundPattern (enabled bool) (artist.Pattern) {
|
||||
if enabled {
|
||||
return foregroundPattern
|
||||
|
Reference in New Issue
Block a user