地图不会触发指针 Pressed/Release 事件
Map does not fire Pointer Pressed/Release events
我有一个不响应附加的 PointerRelease 侦听器的 MapContainer 实例。我试图检测地图在被用户拖动后何时停止移动。在下面的代码中,前两个侦听器不产生任何输出。 Third/Fourth做。
MapContainer mc = new MapContainer("mykey");
mc.addPointerPressedListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
System.out.println("Don't see this");
}
});
mc.addPointerReleasedListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
System.out.println("Don't see this either");
}
});
mc.addTapListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
System.out.println("See This :-)");
}
});
mc.addMapListener(new MapListener() {
@Override
public void mapPositionUpdated(Component source, int zoom, Coord centerCoord) {
System.out.println("See this too!");
}
});
addTapListener
正确并在 MapContainer
中实现。低级指针事件不会对该容器正常工作,因为映射逻辑是本机实现的,因此这些事件会被消耗掉。
您可以通过将侦听器绑定到父表单来跟踪它们,但这是有问题的,因为 events/gestures 可能具有特定于平台的解释。
我有一个不响应附加的 PointerRelease 侦听器的 MapContainer 实例。我试图检测地图在被用户拖动后何时停止移动。在下面的代码中,前两个侦听器不产生任何输出。 Third/Fourth做。
MapContainer mc = new MapContainer("mykey");
mc.addPointerPressedListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
System.out.println("Don't see this");
}
});
mc.addPointerReleasedListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
System.out.println("Don't see this either");
}
});
mc.addTapListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
System.out.println("See This :-)");
}
});
mc.addMapListener(new MapListener() {
@Override
public void mapPositionUpdated(Component source, int zoom, Coord centerCoord) {
System.out.println("See this too!");
}
});
addTapListener
正确并在 MapContainer
中实现。低级指针事件不会对该容器正常工作,因为映射逻辑是本机实现的,因此这些事件会被消耗掉。
您可以通过将侦听器绑定到父表单来跟踪它们,但这是有问题的,因为 events/gestures 可能具有特定于平台的解释。