Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/369.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何使用gquery手势插件在页面上启用文本突出显示?_Java_Gwt_Gesture_Gwtquery_Gquery - Fatal编程技术网

Java 如何使用gquery手势插件在页面上启用文本突出显示?

Java 如何使用gquery手势插件在页面上启用文本突出显示?,java,gwt,gesture,gwtquery,gquery,Java,Gwt,Gesture,Gwtquery,Gquery,我有一个为移动设备设计的复杂GWT应用程序,其(根)ApplicationPresenter中有以下代码: $(RootPanel.get()) .as(Gesture.Gesture) .on("tap", new Function() { @Override public boolean f(Event e) {

我有一个为移动设备设计的复杂GWT应用程序,其(根)ApplicationPresenter中有以下代码:

$(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;
                }

            });

不幸的是,这个插件似乎完全劫持了文本的本机选择,因此用户无法复制和粘贴任何内容。是否有办法启用此功能,或者某种解决方法?

仔细查看文档后,我发现这个静态布尔值
hasspires
,可用于检查我们是否在移动设备上加载

因此,代码段现在变成:

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!");
    }