您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
31 行
1.0 KiB
31 行
1.0 KiB
namespace Unity.UIWidgets.gestures {
|
|
public delegate void GestureLongPressCallback();
|
|
|
|
public class LongPressGestureRecognizer : PrimaryPointerGestureRecognizer {
|
|
public LongPressGestureRecognizer(object debugOwner = null) :
|
|
base(deadline: Constants.kLongPressTimeout, debugOwner: debugOwner) {
|
|
}
|
|
|
|
public GestureLongPressCallback onLongPress;
|
|
|
|
protected override void didExceedDeadline() {
|
|
this.resolve(GestureDisposition.accepted);
|
|
if (this.onLongPress != null) {
|
|
this.invokeCallback<object>("onLongPress", () => {
|
|
this.onLongPress();
|
|
return null;
|
|
});
|
|
}
|
|
}
|
|
|
|
protected override void handlePrimaryPointer(PointerEvent evt) {
|
|
if (evt is PointerUpEvent) {
|
|
this.resolve(GestureDisposition.rejected);
|
|
}
|
|
}
|
|
|
|
public override string debugDescription {
|
|
get { return "long press"; }
|
|
}
|
|
}
|
|
}
|