在fx中,mouseEvents不会被分派到禁用的节点,最后是一个演示行为的快速示例.
对于像我这样的Swinger,这有点令人惊讶:在我的土地上,事件被传递,目标(ui-delegate)的任务是决定是否应该处理事件.实际上是由最近的一个 - 完全有效的IMO 用例 - 在禁用的组件上显示工具提示而指出的
从技术上讲,在一个Node的impl方法中,调度似乎被切断了:
/**
* Finds a top-most child node that intersects the given ray.
*
* The result argument is used for storing the picking result.
*/
@Deprecated
public final void impl_pickNode(PickRay pickRay, PickResultChooser result) {
// In some conditions we can omit picking this node or subgraph
if (!isVisible() || isDisable() || isMouseTransparent()) {
return;
}
Run Code Online (Sandbox Code Playgroud)
这似乎是在命中检测过程中调用的.如果是这样的话,那么在没有太大机会进行调整的情况下,它会非常深入.
问题:
代码示例:
package fx.control;
import javafx.application.Application;
import javafx.scene.Parent;
import …Run Code Online (Sandbox Code Playgroud)