fyne icon indicating copy to clipboard operation
fyne copied to clipboard

Separators Rendering Issues

Open zarkones opened this issue 2 years ago • 14 comments

Checklist

  • [X] I have searched the issue tracker for open issues that relate to the same problem, before opening a new one.
  • [X] This issue only relates to a single bug. I will open new issues for any other problems.

Describe the bug

Separators become invisible on occasion. Interacting with an element might bring them back. Resizing the window might make them show up or become invisible again. I am experiencing this issue on Linux, however on Discord channel I heard form a Windows user that they experience exactly the same issue.

I do not get any warning in the console, therefore I am unable to supply debug information.

How to reproduce

There are not specific steps, apart from resizing the window.

Screenshots

image VS. image

Tree element: image VS. image

Example code

container.NewVBox( widget.NewLabel("test"), widget.NewSeparator(), )

Fyne version

2.4.2

Go compiler version

1.20

Operating system and version

Linux

Additional Information

No response

zarkones avatar Dec 22 '23 14:12 zarkones

Isn't this the same as #3573 ?

andydotxyz avatar Dec 22 '23 15:12 andydotxyz

Isn't this the same as #3573 ?

I personally haven't experienced inconsistent stroke width. They're either the right size or not shown at all. Does this make the issue distinct enough?

zarkones avatar Dec 22 '23 15:12 zarkones

If you are on a low DPI device (i.e. not retina/4k) then it's probably the same. i.e. you're seeing the difference between 1 and 0 whereas the other post is HighDPI and seeing 2 vs 1 - that is my guess anyhow.

andydotxyz avatar Dec 22 '23 16:12 andydotxyz

If you are on a low DPI device (i.e. not retina/4k) then it's probably the same

I broke my 4k monitor couple of weeks ago, can't test. At the moment, I'm using 1920x1080 laptop's builtin monitor. Will update you once I get a new 4k.

zarkones avatar Dec 22 '23 16:12 zarkones

Can you share a simpler code example for reproducing the issue? As per the issue template, the issue template needs to be runnable and not just a code snippet.

Jacalz avatar Dec 30 '23 18:12 Jacalz

I've had the same issue for some time. Just looked at the code and it seems pretty clear to me what the problem is:

In tree.go Layout():

	// Hide any separators that haven't been reused
	for ; separatorCount < len(r.separators); separatorCount++ {
		r.separators[separatorCount].Hide()
	}

Yet, when we reuse that separator again when we expand the tree, we don't call Show() on it:

			if addSeparator {
				var separator fyne.CanvasObject
				if separatorCount < len(r.separators) {
	>>>				separator = r.separators[separatorCount]
			        } else {
					separator = NewSeparator()
					r.separators = append(r.separators, separator)
				}

Tried adding the fix locally and I no longer get missing separators after expanding and contracting the tree.

					separator = r.separators[separatorCount]
					separator.Show()

williambrode avatar Apr 10 '24 23:04 williambrode