我正在尝试编写一个游戏,用户可以通过用手指绘制某些图案来发出命令......例如,如果他画了一个圆圈,一个'S'字母,一个表示法,等等.
我已经熟悉了触摸事件,我能够读取坐标...我的问题是找到有关识别模式的算法和信息,有一定程度的错误....例如,如果我是应该检测一个圆圈我应该检测它,即使用户没有完成一个完美的.
这个问题有什么资源吗?谢谢!
我查看了以下文档:http: //developer.apple.com/library/ios/#documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/GestureRecognizer_basics/GestureRecognizer_basics.html#//apple_ref/doc/uid/TP40009541-CH2-SW2
我正在尝试实现文档中显示的复选标记示例,但我不能,因为编译器显示了一堆关于[super touchesMoved:touches withEvent:event]调用的警告,这是文档推荐的.
在哪里学习如何正确子类化以实现自定义手势的完整示例?
我想为按钮实现手势识别器(滑动动作).问题是,按钮是以编程方式创建的,并且根据一些条件存在或不存在.所以,我不知道是否有按钮,或者有多少按钮.
我知道我需要这样的东西:
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
if (touch.view == aButtonView) {
//get the button's tag
}
}
Run Code Online (Sandbox Code Playgroud)
当然,当按下任何按钮视图时,if语句应该返回Yes ...
任何人都知道这个词aButtonView应该是什么?或者,如果它甚至可能?提前致谢.
iphone xcode objective-c gesture-recognition uigesturerecognizer
根据Silverlight工具包,Gesture监听器将被视为已弃用
对于所有Windows Phone 7.1 SDK开发,应该考虑弃用Gesture Listener.
没有其他建议可用.在没有手势监听器的情况下,在WP7中检测捏/缩放手势的最佳方法是什么?
我正在开发一个Android项目.它的目标是检测设备的预定义移动手势.如果设备在轴(X,Y或Z)上旋转45度然后旋转回到第一个位置(第一个和第二个位置不准确,我的意思是它旋转了50度而不是45度,不是重要!!!)然后手势发生了,应用程序应该检测到它.
我尝试使用设备的加速度计和磁性传感器来持续监控设备的方向并检测手势,但结果是不可接受的(这里解释).请问任何起点或想法?
java android accelerometer gesture-recognition android-sensors
我正在尝试实现一个允许滑动和单击按钮的自定义列表视图,类似于回旋镖电子邮件客户端已实现的实现(或适用于iOS的Mailbox).
如果我只想单击列表项本身,我可以创建一个新的OnItemClickListener,并确保没有可聚焦或可点击的后代,这些后代不会消耗触摸事件,并允许自定义列表视图检测滑动.但是,如果我在列表项中单击任何内容,它将使用触摸事件,而不是调用OnItemClickListener,并禁用自定义列表本身的滑动功能.
我已经尝试创建onTouchListener的自定义实现,或者使用onInterceptTouchEvent来创建自定义视图组.对于所有这些实现,onTouchListener必须在Action.DOWN上返回true(因此消耗触摸事件)否则它将停止监听触摸事件的其余部分.
为什么OnItemClickListener可以在不消耗触摸事件的情况下检测触摸,以及如何为我自己的自定义实现复制它?任何帮助或指针赞赏!

这是OnItemClickListener,它可以工作并且不使用触摸事件:
private AdapterView.OnItemClickListener onClick = new AdapterView.OnItemClickListener()
{
@Override
public void onItemClick(AdapterView<?> adapterView, View v, int position,
long arg3) {
mAction = mAdapter.getItem(position);
updateListToShowCurrentAction();
return;
}
};
Run Code Online (Sandbox Code Playgroud)
这是我希望能够为列表项中的视图实现的功能,同时仍将触摸事件传递到自定义列表视图:
cancelButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final int position = mListView.getPositionForView((View) v.getParent());
mReordCtrl.removeAction(mAdapter, position);
}
});
Run Code Online (Sandbox Code Playgroud)
这是list_item中的布局代码段:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:tag="list_item" >
<LinearLayout
android:id="@+id/back"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_gravity="center_vertical"
android:orientation="horizontal"
android:tag="back" >
<ImageView
android:id="@+id/cancel_button"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:src="@drawable/ic_action_cancel"
android:tag="cancel_button" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud) 我想知道是否有人可以指导我使用他们可能知道的任何有用的 API,这些 API 将跟踪 Android 设备上前置摄像头的运动。例如,它最好能够检测到一只手,然后从那里跟踪运动。
我环顾四周,发现了一些有趣的事情,但如果有人能推荐他们可能知道的任何事情,那将不胜感激。到目前为止,'nuidroid' 看起来最吸引人。
谢谢你。
我想突出显示实时手势识别的手。我观察到使用 cv2.imsplit 函数,对于不同的颜色通道,手的图像会以不同的方式突出显示。但是这个拆分函数在时间上是非常昂贵的。我无法使用 Numpy 索引执行相同的功能(如官方页面所示)
我已经为容器实现了缩放手势。另外,我添加了 onHorizontalDragUpdate 和 onVerticalDragUpdate。但是当我尝试添加两者时,我收到一个异常,说无法使用 Scale 手势实现两者。即使对于平移手势,它也会抛出相同的异常。下面是我的代码:
import 'package:flutter/material.dart';
import 'package:vector_math/vector_math_64.dart' hide Colors;
import 'dart: math' as math;
class HomeScreen extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return HomeState();
}
}
class HomeState extends State<HomeScreen> {
double _scale = 1.0;
double _previousScale;
var yOffset = 400.0;
var xOffset = 50.0;
var rotation = 0.0;
var lastRotation = 0.0;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.amber,
body: Stack(
children: <Widget>[
stackContainer(),
],
),
);
}
Widget stackContainer() {
return Stack( …Run Code Online (Sandbox Code Playgroud) 我目前正在使用这个模块:https : //github.com/mxmzb/react-native-gesture-detector。我希望能够从创建的点画一条线。然而,它似乎只输出圆圈。
它有一个“创建手势”视图:
<View style={{ position: "relative", width: "100%", height: "100%" }}>
<GesturePath
path={gesture.map(coordinate => {
if (recorderOffset) {
return {
x: coordinate.x + recorderOffset.x,
y: coordinate.y + recorderOffset.y,
};
}
return coordinate;
})}
color="green"
slopRadius={30}
center={false}
/>
</View>
Run Code Online (Sandbox Code Playgroud)
GesturePath 定义如下:
const GesturePath = ({ path, color, slopRadius, center = true }: GesturePathProps) => {
const baseStyle: ViewStyle = {
position: "absolute",
top: center ? "50%" : 0,
left: center ? "50%" : 0,
opacity: 1,
}; …Run Code Online (Sandbox Code Playgroud) android ×3
iphone ×3
objective-c ×2
camera ×1
expo ×1
flutter ×1
java ×1
javascript ×1
motion ×1
numpy ×1
opencv ×1
opengl ×1
pan ×1
python ×1
react-native ×1
rotation ×1
scale ×1
silverlight ×1
touch-event ×1
tracking ×1
xcode ×1