问题标签 [gesture-recognition]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
3202 浏览

iphone - iPhone SDK 3.2 UIGestureRecognizer 干扰 UIView 动画?

手势识别器和动画的 UIView 类方法是否存在已知问题?

我在 UIGestureRecognizer 回调的 UIImageView 上遇到一系列动画问题。如果动画序列是从像 TouchUpInside 这样的标准回调开始的,则动画效果很好。如果是通过 UILongPressGestureRecognizer 启动的,那么第一个动画跳到最后,第二个动画立即开始。

这是一个说明我的问题的示例。在项目的 .xib 中,我有一个连接到 viewToMove IBOutlet 的 UIImageView。我还有一个连接到 startButton IBOutlet 的 UIButton,并且我已将其 TouchUpInside 操作连接到 startButtonClicked IBAction。TouchUpInside 动作按我的意愿工作,但 longPressGestureRecognizer 在大约半秒后跳到第一个动画的结尾。当我 NSLog 第二个动画(animateTo200)时,我可以看到它在长按启动动画时被调用了两次,但在按钮的 TouchUpInside 动作启动动画时只有一次。

0 投票
1 回答
391 浏览

iphone-sdk-3.0 - iPhone 上的复杂手势

是否有处理复杂手势的高级库,例如检测三角形/循环/圆形?甚至有可能用 Apple 已经拥有的库来构建这样的库吗?

谢谢,
泰加

0 投票
0 回答
1796 浏览

android - Android:如何/在哪里将手势代码放入 IME?

我是 Android 新手,但我正在尝试创建一个允许手势字符识别的 IME。我已经可以做一些简单的应用程序来执行手势识别,但不确定在哪里使用 IME 挂钩手势视图/obj。到目前为止,这是我对 IME 的初步了解。我想用android.gesture.Gesture/Prediction/GestureOverlayView/OnGesturePerformedListener. 有人有建议吗?

手势输入法.java

手势键盘.java

GesureKeyboardView.java

键盘.xml

输入.xml

0 投票
1 回答
1279 浏览

android - 在 textview 上捕获的 Android 2.1 投掷手势但仍会打开一个上下文菜单

以下问题似乎是 2.1 独有的,既发生在模拟器上,也发生在 nexus 上。相同的示例在我测试过的其他平台上运行良好 ( 1.5, 1.6 and 2.0 emulators)。

本文所述,我已经添加了创建的 gestureListener。不同之处在于我在 TextView 上添加了侦听器,该侦听器也注册了 contextMenu,即如下所示:

测试时,可以识别正确的手势,但每隔一次它也会导致上下文菜单打开。由于同一个示例在非 2.1 平台上工作,我有一种感觉,问题不是我的代码......

感谢您的任何建议。

更新:似乎返回值在某处翻转。如果我让 onFling() 返回“错误”值,即在事件被跳过时为 true,在事件被消耗时为 false,它在 2.1 中可以正常工作。但是,当然,这在其他平台上不起作用。似乎是时候采取一个丑陋的解决方法了......

0 投票
1 回答
489 浏览

visual-c++ - Windows Mobile 6.5 轻弹(惯性滚动)不起作用

升级到 windows mobile 6.5 后,我的 ListView 控件无法与自定义项(具有交替颜色的行)和新手势机制一起正常工作......在移动设备上,如果用户在滚动前几个后启动轻弹或平移项目,最后一个项目不会显示在屏幕上,但如果用户明确点击它们就会显示 - 所以基本上最后一个屏幕只是白色的。WM_DRAWITEM 消息虽然会发送给所有孩子,但他们只是不会出现在屏幕上。使用条滚动效果很好。

有任何想法吗?

我从其他用户那里看到了一些类似行为的报告,但不确定这是否是列表视图控件本身的错误,或者是否有其他需要/可以实现以支持轻弹和平移操作的东西。应用程序代码当前不处理 WM_GESTURE 消息,因此轻弹操作是使用 Microsoft 自己的代码完成的,以支持旧版应用程序。

谢谢!

0 投票
1 回答
648 浏览

iphone - 在 iPhone 上实现跟踪手势

我想创建一个支持使用手指跟踪任意形状的 iPhone 应用程序(具有准确度检测)。我已经看到了对一个名为“GestureMatch”的 Apple 示例应用程序的引用,据称该应用程序完全实现了这一点,但它在某些时候已从 SDK 中删除,我无法通过谷歌在任何地方找到源代码。有谁知道当前的官方样本可以演示这样的跟踪?或者对其他资源有什么可靠的建议?我已经完成了一些 iPhone 编程,但对图形 API 或触摸手势的自定义处理并没有真正的任何东西,所以我不知道从哪里开始。

0 投票
2 回答
9005 浏览

iphone - UIScrollView 内的视图中的 UIgestureRecognizer

有没有人设法让 UIGestureRecognizer 在作为 UIScrollView 子视图的 UIView 上工作?我的回调似乎永远不会被调用。

作为一个简单的例子,我想要一个分页滚动视图,并在第三页上用 UITapGestureRecognizer 监听点击。但是我无法让它工作。

这是我的做法:

0 投票
1 回答
3689 浏览

ipad - iPad 手势识别器 - 延迟响应

在我的应用程序中,我添加了 3.2 SDK 中可用的新手势识别器。一切似乎都正常工作,屏幕上的响应时间非常快。但是由于某种原因,当我添加requireGestureRecognizerToFail一些手势时,触发手势时会出现非常明显的延迟。下面是我用来创建手势识别器的代码片段。有谁知道为什么会出现延迟以及如何解决?我requireGestureRecognizerToFail用来防止SingleTap手势在用户执行DoubleTap.

0 投票
3 回答
886 浏览

math - How to determine all line segments from a list of points generated from a mouse gesture?

Currently I am interning at a software company and one of my tasks has been to implement the recognition of mouse gestures. One of the senior developers helped me get started and provided code/projects that uses the $1 Unistroke Recognizer http://depts.washington.edu/aimgroup/proj/dollar/. I get, in a broad way, what the $1 Unistroke Recognizer is doing and how it works but am a bit overwhelmed with trying to understand all of the internals/finer details of it.

My problem is that I am trying to recognize the gesture of moving the mouse downards, then upwards. The $1 Unistroke Recognizer determines that the gesture I created was a downwards gesture, which is infact what it ought to do. What I really would like it to do is say "I recognize a downards gesture AND THEN an upwards gesture."

I do not know if the lack of understanding of the $1 Unistroke Recognizer completely is causing me to scratch my head, but does anyone have any ideas as to how to recognize two different gestures from moving the mouse downwards then upwards?

Here is my idea that I thought might help me but would love for someone who is an expert or even knows just a bit more than me to let me know what you think. Any help or resources that you know of would be greatly appreciated.

How My Application Currently Works:

The way that my current application works is that I capture points from where the mouse cursor is while the user holds down the left mouse button. A list of points then gets feed to a the gesture recognizer and it then spits out what it thinks to be the best shape/gesture that cooresponds to the captured points.

My Idea:

What I wanted to do is before I feed the points to the gesture recognizer is to somehow go through all the points and break them down into separate lines or curves. This way I could feed each line/curve in one at a time and from the basic movements of down, up, left, right, diagonals, and curves I could determine the final shape/gesture.

One way I thought would be good in determining if there are separate lines in my list of points is sampling groups of points and looking at their slope. If the slope of a sampled group of points differed X% from some other group of sampled points then it would be safe to assume that there is indeed a separate line present.

What I Think Are Possible Problems In My Thinking:

  • Where do I determine the end of a line and the start of a separate line? If I was to use the idea of checking the slope of a group of points and then determined that there was a separate line present that doesn't mean I nessecarily found the slope of a separate line. For example if you were to draw a straight edged "L" with a right angle and sample the slope of the points around the corner of the "L" you would see that the slope would give resonable indication that there is a separate line present but those points don't correspond to the start of a separate line.

  • How to deal with the ever changing slope of a curved line? The gesture recognizer that I use handles curves already in the way I want it too. But I don't want my method that I use to determine separate lines keep on looking for these so called separate lines in a curve because its slope is changing all the time when I sample groups of points. Would I just stop sampling points once the slope changed more than X% so many times in a row?

  • I'm not using the correct "type" of math for determining separate lines. Math isn't my strongest subject but I did do some research. I tried to look into Dot Products and see if that would point me in some direction, but I don't know if it will. Has anyone used Dot Prodcuts for doing something like this or some other method?

Final Thoughts, Remarks, And Thanks:

Part of my problem I feel like is that I don't know how to compeletly ask my question. I wouldn't be surprised if this problem has already been asked (in one way or another) and a solution exist that can be Googled. But my search results on Google didn't provide any solutions as I just don't know exactly how to ask my question yet. If you feel like it is confusing please let me know where and why and I will help clarify it. In doing so maybe my searches on Google will become more precise and I will be able to find a solution.

I just want to say thanks again for reading my post. I know its long but didn't really know where else to ask it. Imma talk with some other people around the office but all of my best solutions I have used throughout school have come from the StackOverflow community so I owe much thanks to you.

Edits To This Post:

(7/6 4:00 PM) Another idea I thought about was comparing all the points before a Min/Max point. For example, if I moved the mouse downards then upwards, my starting point would be the current Max point while the point where I start moving the mouse back upwards would be my min point. I could then go ahead and look to see if there are any points after the min point and if so say that there could be a new potential line. I dunno how well this will work on other shapes like stars but thats another thing Im going to look into. Has anyone done something similar to this before?

0 投票
3 回答
2189 浏览

windows-7 - 哪些设备可用于在台式机上测试 WM_GESTURE 和 WM_TOUCH 代码?

我正在编写一些代码来处理 Windows 7 中的 WM_GESTURE 和 WM_TOUCH 事件,但我不知道如何测试它。我在 17 英寸 Mac Book Pro 上在 Boot Camp 中进行开发。

到目前为止,我已经确定 Windows 7 中的 Boot Camp 触控板驱动程序不会生成这些事件,并且我在Amazon.com上找到的这个声称是“多点触控”的通用触控板可以像宣传的那样工作,但不是通过创建 WM_GESTURE 或WM_TOUCH 事件。我通过使用 Spy++ 报告事件来验证这一点;没有报告 WM_GESTURE 或 WM_TOUCH 值。

什么样的硬件应该产生这些类型的事件?在这一点上,我假设它仅适用于平板电脑或移动 (Windows CE) 硬件,但如果有任何其他建议,我将不胜感激。

我想还有另一种方法可以解决这个问题——我想获得类似于 Cocoa 的 [NSResponder swipeWithGesture:] 和相关方法的功能,它们报告触控板上的滑动、旋转和其他手势。WM_GESTURE 在 Windows 7 上似乎是等效的。