容器的剪裁子项在滚动时不可见
我在 Canvas 中有一个 VBox。 “红条”是基于“Canvas”的自定义组件。所有红条的高度相等。我的 VBox 内有 20 个红色条。屏幕截图中可见的滚动条是 Canvas 的滚动条。使用 verticalScrollPolicy = off
禁用 VBox 的滚动条。
如果不滚动,则只能看到 16 个红色条(以及第 17 个条的一部分)。但是,当我向下滚动画布时,我希望看到剩余的红色条 - 但应用程序启动时不可见的条不会被“绘制”。我做错了什么?我希望当画布向下滚动时用户能够看到第 17 - 20 个栏。
初始视图
滚动之前
向下滚动之后
滚动后
另请注意,滚动后,最后一个红色条也没有完全绘制。
预先感谢您的宝贵时间!
I have a VBox inside a Canvas. The 'red bars' are custom components based on 'Canvas'. All red bars are of equal height. I have 20 red bars inside the VBox. The scrollbars visible in the screenshot are the Canvas's scrollbars. The scrollbars of the VBox are disabled using verticalScrollPolicy = off
.
Without scrolling, only 16 red bars (and a part of the 17th bar) are visible. However, when I scroll down the Canvas I expect to see the remaining red bars - but the bars that are not visible when the application starts don't get 'drawn'. What am I doing wrong? I want the user to be able to see the 17th - 20th bars when the Canvas is scrolled down.
INITIAL VIEW
Before scrolling
AFTER SCROLLING DOWN
After scrolling
Also note, that after scrolling, the last red bar isn't completely drawn either.
Thanks in advance for your time!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
啊。我的不好。 VBox 的高度被明确设置为 Canvas 的高度。所以这种行为是预料之中的。由于 VBox 的滚动条被禁用,因此无法看到其内容(实际上已绘制,但不可见)。
Ah. My bad. The VBox's height was explicitly set to the height of the Canvas. So this behaviour was expected. And since the VBox's scrollbars were disabled, its content (which was actually drawn, but not visible) could not be seen.