忽略鼠标单击的舞台边框javafx

炸药

我正在为javafx中的音乐可视化程序创建启动管理器。可视化工具是用OpenGL编写的,管理器将信息输入到可视化工具中。在管理器中,我以仅包含画布的阶段的形式为可视化工具提供了某种预览。在画布上,我想用鼠标画一些线,然后将坐标传递给OpenGL。我的问题是,如果我访问mouseEvent.getX()坐标,则包含装饰,这意味着坐标不准确,或因装饰而移动。以下是一些图片:

第一个屏幕截图显示了管理器。注意,该行从左上角一直到右下角

The second screenshot shows the visualizer. Here, the white line doesnt go all the way to the bottom.

Dynamitos

I've fixed the issue and leave this answer just for future reference.

When trying to scale a canvas relatively, you have to be careful which measure to use.

When creating a window, the coordinate system of the Stage is relative to the top left of the window, including the decoration. When adding a Node with a fixed size, like a Canvas to it, the size of the Stage gets bigger.

So when scaling some thing relative to the Canvas's size, you have to use the width and height of the Canvas.

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

发送被GetAsyncKeyState()忽略的虚拟鼠标单击?

来自分类Dev

删除鼠标单击并为简单的Javascript添加边框

来自分类Dev

如何在鼠标单击时修复边框颜色

来自分类Dev

窗体会忽略一些鼠标单击

来自分类Dev

是否发送被GetAsyncKeyState()忽略的虚拟鼠标单击?

来自分类Dev

如何在JavaFX中检测到鼠标单击?

来自分类Dev

JavaFX-在鼠标单击事件上更新UI

来自分类Dev

鼠标单击触发

来自分类Dev

鼠标单击折叠箭头

来自分类Dev

Delphi鼠标单击坐标

来自分类Dev

DataGridTemplateColumn:处理鼠标单击

来自分类Dev

使Sprite响应鼠标单击

来自分类Dev

鼠标单击JavaScript错误

来自分类Dev

QTest鼠标单击QPushButton

来自分类Dev

骨干鼠标单击无效

来自分类Dev

Delphi鼠标单击坐标

来自分类Dev

JavaFX:针对父级及其子级的鼠标单击事件

来自分类Dev

删除图标单击菜单上的边框

来自分类Dev

如何检测鼠标单击PySide Gui?

来自分类Dev

鼠标单击展开表格行

来自分类Dev

切换禁用鼠标单击

来自分类Dev

LibGDX TextButton不响应鼠标单击

来自分类Dev

Python脚本来控制鼠标单击

来自分类Dev

InputSimulator不模拟鼠标单击

来自分类Dev

鼠标单击并按住事件?

来自分类Dev

套接字io鼠标单击事件

来自分类Dev

检测游戏对象上的鼠标单击

来自分类Dev

在Qt的QWebView中模拟鼠标单击?

来自分类Dev

模拟R中的鼠标单击