Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scrolling sometimes breaks table formatting #230

Closed
nimble0 opened this issue Aug 24, 2021 · 11 comments
Closed

Scrolling sometimes breaks table formatting #230

nimble0 opened this issue Aug 24, 2021 · 11 comments
Labels
bug Something isn't working

Comments

@nimble0
Copy link

nimble0 commented Aug 24, 2021

This is what it looks like:
rmlui-scroll-bug

Reproducing:

  • Open demo sample
  • Go to sandbox tab
  • Paste this in rml box:
<table>
	<tr>
		<td />
		<td />
		<td />
	</tr>
	<tr>
		<td />
		<td />
		<td />
	</tr>
	<tr>
		<td />
		<td />
		<td />
	</tr>
	<tr>
		<td />
		<td />
		<td />
	</tr>
</table>
  • Paste this in rcss box:
table
{
	width: 100%;
	gap: 10px;
}

tr
{
	height: 200px;
}

td
{
	background-color: #00f;
}
  • Scroll until formatting breaks.

I have a suspicion this is due to multiple ProcessMouseMove calls per Update call. I haven't seen it happen after I limited it to one ProcessMouseMove call per Update call. This is very much just a guess though, I haven't looked at what's actually happening in the code!

@mikke89
Copy link
Owner

mikke89 commented Aug 24, 2021

I've tried a whole lot now and I still haven't been able to recreate this issue on my side.

Maybe, could I suggest that we try to record all the input and commands to RmlUi? This way I can replay the commands on my end. Then I should be able to see whatever you're seeing.

We should probably log all the calls to ProcessMouse...() (with mouse positions and buttons), as well as Update and Render. Are you willing to try this, I can create a patch if you'd like?

@nimble0
Copy link
Author

nimble0 commented Aug 25, 2021

Sure, I'd be happy to record it if there was a patch to do so. Would be useful for debugging other issues as well.

One detail that I missed: the scrolling has to be using the scrollbar, not the mouse wheel.

@barotto
Copy link
Contributor

barotto commented Aug 25, 2021

I can confirm the issue.

Also this can happen:
2021-08-25_17-00

These scolling glitches happen only when the mouse pointer is inside the sandbox_target area and are more apparent when you srcoll with a fast movement.

@barotto
Copy link
Contributor

barotto commented Aug 25, 2021

One detail that I missed: the scrolling has to be using the scrollbar, not the mouse wheel.

When the pointer is inside the sandbox_target area I can reproduce with the mouse wheel as well, albeit not as easily.
If you look closely you can see lines moving with some jerkiness even when scrolling slowly.

@mikke89
Copy link
Owner

mikke89 commented Aug 26, 2021

Thanks for testing from both of you! I still cannot do this on my end, maybe it has something to do with my 165Hz screen? I've tried it at lower refresh rates though.

I made the logger I mentioned earlier, see the above commit (replay branch). Could you try to reproduce the bug on there and send me the log output?

If you want, you can try to replay the commands from me trying to recreate the bug here: https://gist.github.com/mikke89/a927ed403e77e74f5e6354ffd1326c6c
I'm a bit curious if you can see the bug there. If you add this file to Samples/input.txt it should start replaying automatically, although I only implemented this on the Windows shell and it's all a bit hacky.

Please try not to resize the window or do anything crazy :) Thanks again!

@barotto
Copy link
Contributor

barotto commented Aug 26, 2021

Didn't try your code yet because I can't build the samples using MinGW (CMake complains about missing OpenGL), but I've done some testing with my application and:

  • I can reproduce it, so it's not limited to the RmlUi Samples
  • it happens with both a software and a OpenGL renderer
  • it happens only if I scroll keeping the mouse pointer above the table

@mikke89
Copy link
Owner

mikke89 commented Aug 26, 2021

I made a small change so it now compiles on Linux, you can use it for logging but not replay.

So, I was finally able to reproduce it! Whatever I did on the Windows backend it never worked, but using WSL made it happen.

Looking at the log output, I see that a difference between the two backends is that the Linux shell can send multiple ProcessMouse.... per update loop, while the Windows shell only does this once as far as I have seen. Replaying the Linux shell log output on Windows, the bug appeared also on the windows shell.

So now I have something to start with, thanks for helping me so far :) It's certainly some issue within RmlUi, and possibly/probably related to the multiple Process... calls as you suspected @nimble0.

mikke89 added a commit that referenced this issue Aug 26, 2021
@mikke89
Copy link
Owner

mikke89 commented Aug 26, 2021

This was a tricky one ;)

I think I have something that should work here. Could you test the latest commit (e639861) and see if you can reproduce the same or similar issues?

@mikke89 mikke89 added the bug Something isn't working label Aug 26, 2021
@barotto
Copy link
Contributor

barotto commented Aug 27, 2021

With this fix I can't reproduce the issue.

@nimble0
Copy link
Author

nimble0 commented Aug 27, 2021

Wow, fast. Same here, can't produce the bug with this fix.

mikke89 added a commit that referenced this issue Aug 27, 2021
…ffset after scrolling, see #230.

Modify Element::DirtyOffset so that all descendents are dirtied. It is possible that a child is dirty while a grandchild is not, eg. if the grandchild is hovered over thereby calling Element::GetAbsoluteOffset to resolve the offset *and* the grandchild's offset_parent is its grandparent. Then previously the grandchild would never be dirtied even when its grandparent was dirtied, which again would result in the wrong offset during Element::GetAbsoluteOffset.
@mikke89
Copy link
Owner

mikke89 commented Aug 27, 2021

Great, I'll consider it fixed then! Thanks for reporting and both of you for testing :)

I'll leave a patch here for the command logger and replay mode, in case it might prove useful in the future:
https://gist.github.com/mikke89/5a302e35a958674d00f3940d08947a23

@mikke89 mikke89 closed this as completed Aug 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants