我有一个为移动用户设计的复杂的GWT应用程序,它的(根)ApplicationPresenter中有这个gwtquery-手势-插件代码:
$(RootPanel.get())
.as(Gesture.Gesture)
.on("tap", new Function()
{
@Override
public boolean f(Event e)
{
Log.info("tap:" + e.getType() + ", x:" + e.getClientX() + ", y:" + e.getClientY());
// handle tap events here
return true;
}
})
.on("swipeone", new Function()
{
@Override
public boolean f(Event e)
{
GestureObjects.Options o = arguments(0);
int delta = (int) o.delta().get(0).moved();
Log.info(o.description() + ":" + o.directionName() + ", x:" + e.getClientX() + ", y:" + e.getClientY() + ", delta:" + delta);
// handle swipe events here
return true;
}
});不幸的是,这个插件似乎完全劫持了原生文本的选择,因此用户无法复制和粘贴任何。是否有一种方法来启用这个,或者某种解决办法?
发布于 2016-03-22 12:13:57
在对文档进行更仔细的检查时,我发现了这个静态布尔hasGestures,它可以用来检查我们是否在移动分号上加载。
所以这个片段现在变成:
if(Gesture.hasGestures) // only load for mobile devices
{
$(RootPanel.get())
.as(Gesture.Gesture)
.on("tap", new Function()
{
@Override
public boolean f(Event e)
{
Log.info("tap:" + e.getType() + ", x:" + e.getClientX() + ", y:" + e.getClientY());
return true;
}
})
.on("swipeone", new Function()
{
@Override
public boolean f(Event e)
{
GestureObjects.Options o = arguments(0);
int delta = (int) o.delta().get(0).moved();
Log.info(o.description() + ":" + o.directionName() + ", x:" + e.getClientX() + ", y:" + e.getClientY() + ", delta:" + delta);
return true;
}
});
}
else
{
Log.info("Not adding gesture handlers as this is not a mobile device!");
}https://stackoverflow.com/questions/35890715
复制相似问题