在flex中,当存在垂直滚动时如何获得正确的Y轴?
在flex中,我通过以下方式获取y坐标:
nextHBox = HBox(ingBox.getChildByName("ing" + nextId));
nextYAxis = ingBox.localToGlobal(new Point(nextHBox.x,nextHBox.y)).y;
newCanvas.x = nextYAxis;
nextYAxis 为我提供 y 轴,我用它来定位新组件。它工作得非常好。但是,当存在垂直滚动时,我滚动它一点,然后上面提到的代码将组件放置在错误的位置。我相信,这与卷轴有关。
In flex, I am getting the y-coordinate in the following way:
nextHBox = HBox(ingBox.getChildByName("ing" + nextId));
nextYAxis = ingBox.localToGlobal(new Point(nextHBox.x,nextHBox.y)).y;
newCanvas.x = nextYAxis;
nextYAxis gives me the y-axis and I use it to position new component. It works absolutely fine. But, when there is vertical scroll, and I scroll it a little bit, and then the above mentioned code places the component at wrong place. I believe, it has something to do with the scroll.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过将其 VerticalScrollPosition 属性的值添加到 y 位置来考虑父容器的滚动位置。
You can factor in the scroll position of the parent container by adding the value of its verticalScrollPosition property to your y position.