问题标签 [gesture]

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 回答
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 回答
1064 浏览

objective-c - 如何向 UITableViewController 添加手势?

我想在继承自 UITableViewController 的视图上实现从右到左和从左到右的手势。我有在另一个视图(UIViewController)中实现的手势代码,它可以工作。

它似乎touchesBegan甚至没有被调用。

有谁知道这样做?

谢谢

0 投票
1 回答
489 浏览

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

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

有任何想法吗?

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

谢谢!

0 投票
2 回答
895 浏览

iphone - 通过滑动更改 UITableView 的内容?

我目前使用 UITableView 和其他任何一样,我正在研究在屏幕上执行滑动手势的能力,然后将可见表的内容转移到显示新内容

例如:在屏幕上从右向左滑动会改变(通过动画)屏幕上每个单元格的内容以显示新数据。

我能做的是检测单元格上的滑动,或者可能是 UITableViewController 上的滑动,但我不知道如何做两件事:

1)更改所有单元格中的数据(您是否可以在自定义表格单元格中设置一组隐藏视图,每次滑动时在每个单元格中进出动画?)

2)你怎么能对所有细胞这样做?

非常感谢马克

0 投票
1 回答
3689 浏览

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

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

0 投票
4 回答
4966 浏览

android - android.view.GestureDetector.OnGestureListener onFling() 与 onScroll()

android.view.GestureDetector.OnGestureListener的onFling()和onScroll()事件有什么区别? 链接文本

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 投票
1 回答
2096 浏览

objective-c - 在 CALayer 上触摸手势

我正在 CALayer 上进行一些绘图,并希望能够让用户单击绘图的不同部分并触发响应。我尝试研究手势识别器,似乎它们需要绑定到 UIView。知道如何使用 CALayers 获得我想要的行为吗?

0 投票
4 回答
6454 浏览

android - 将 GestureOverlayView 添加到我的 SurfaceView 类,如何添加到视图层次结构?

我在后来的回答中被告知我必须将我在代码中创建的 GestureOverlayView 添加到我的视图层次结构中,我不是 100% 如何做到这一点。以下是完整性的原始问题。

我希望我的游戏能够识别手势。我有一个很好的 SurfaceView 类,我使用 onDraw 来绘制我的精灵,并且我有一个线程正在运行它来调用 onDraw 等。

这一切都很好。

我正在尝试将 GestureOverlayView 添加到此,但它不起作用。终于破解到它不会崩溃的地方,但这就是我所拥有的

onGesturePerformed 永远不会被调用。他们的示例在 xml 中有 GestureOverlay,我没有使用它,我的活动很简单:

所以我在这里丢失了一些信息,它没有调用 onGesturePerformed 并且漂亮的漂亮黄色“你正在画一个手势”永远不会出现。

0 投票
1 回答
796 浏览

macos - Mac 上的 Gesture Firefox:向后滑动跳跳虎编辑->查找而不是“返回”

每当我像在 Chrome 或 Safari 中那样使用向左滑动手势进行向后浏览时,Firefox 不会向后浏览,而是打开搜索/查找对话框。

应该没问题的about:config节目:

但是,向右滑动“前进”是有效的。我怎样才能解决这个问题?

谢谢你的回答,

克里斯