-
-
Notifications
You must be signed in to change notification settings - Fork 93
Closed
Labels
bugSomething isn't working correctlySomething isn't working correctly
Description
Describe the bug
While creating a UI layout for large content in the center of a split I ran in to an issue where the scrollbars get doubled. It looks like the split's "handles" maybe aren't accounted for? The outer scrollbar is very small but very confusing, it can be fixed by setting the overflow of the center to be hidden, but I worry that I may be masking some other issue?
How to reproduce
- Run example code
- Scroll in center to see two scroll bars for outer and inner frames
- Un-comment line 31 to hide overflow in the "centerFrame"
- Re-run code, only one set of scroll bars, works nice
Example code
package main
import (
"cogentcore.org/core/core"
"cogentcore.org/core/styles"
"cogentcore.org/core/styles/units"
)
func main() {
b := core.NewBody("Split Scrollbar Bug?")
splitFrame := core.NewSplits(b)
splitFrame.Styler(func(s *styles.Style) {
s.Grow.Set(1, 1)
s.Direction = styles.Row
})
splitFrame.SetSplits(20, 60, 20)
firstFrame := core.NewFrame(splitFrame)
firstFrame.Styler(func(s *styles.Style) {
s.Grow.Set(1, 1)
s.Border.Width.Set(units.Dp(4))
s.CenterAll()
})
core.NewText(firstFrame).SetText("20% Split Frame")
// The center of the split, created so that we can put child widgets in it
centerFrame := core.NewFrame(splitFrame)
centerFrame.Styler(func(s *styles.Style) {
s.Direction = styles.Column
//s.Overflow.Set(styles.OverflowHidden)
})
// represents a top "menu" bar that has buttons in it
centerMenu := core.NewFrame(centerFrame)
centerMenu.Styler(func(s *styles.Style) {
s.Min.Set(units.Pw(100), units.Ph(10))
s.Max.Set(units.Pw(100), units.Ph(10))
s.Border.Width.Set(units.Dp(4))
s.CenterAll()
})
core.NewText(centerMenu).SetText("Menu Bar")
// the frame that the child widget will use to wrap its content so that from the outside we only have a single frame
centerContentArea := core.NewFrame(centerFrame)
centerContentArea.Styler(func(s *styles.Style) {
s.Grow.Set(1, 1)
s.Border.Width.Set(units.Dp(4))
s.Overflow.Set(styles.OverflowScroll)
})
// represents content that will be too large for this frame, user will need to scroll this on both
// axes to interact with it correctly
internalCenter := core.NewFrame(centerContentArea)
internalCenter.Styler(func(s *styles.Style) {
s.Min.Set(units.Pw(125), units.Ph(125))
s.CenterAll()
})
core.NewText(internalCenter).SetText("Content in center frame")
lastFrame := core.NewFrame(splitFrame)
lastFrame.Styler(func(s *styles.Style) {
s.Grow.Set(1, 1)
s.CenterAll()
s.Border.Width.Set(units.Dp(4))
})
core.NewText(lastFrame).SetText("20% Split Frame")
b.RunMainWindow()
}Relevant output
Platform
Linux
Metadata
Metadata
Assignees
Labels
bugSomething isn't working correctlySomething isn't working correctly
Type
Projects
Status
Done