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