浏览代码

Fix tooltip

/main
Yuncong 6 年前
当前提交
05d26a44
共有 3 个文件被更改,包括 64 次插入1 次删除
  1. 5
      Runtime/material/tooltip.cs
  2. 57
      Runtime/material/feedback.cs
  3. 3
      Runtime/material/feedback.cs.meta

5
Runtime/material/tooltip.cs


}
}
bool ensureTooltopVisible() {
bool ensureTooltipVisible() {
if (this._entry != null) {
this._timer?.cancel();
this._timer = null;

}
void _handleLongPress() {
bool tooltipCreated = this.ensureTooltipVisible();
if (tooltipCreated)
Feedback.forLongPress(this.context);
}

57
Runtime/material/feedback.cs


using RSG;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.widgets;
using UnityEngine;
namespace Unity.UIWidgets.material {
public class Feedback {
Feedback() {
}
public static IPromise forTap(BuildContext context) {
switch (_platform(context)) {
case RuntimePlatform.Android:
return
Promise.Resolved(); // SystemSound.play(SystemSoundType.click); TODO: replace with unity equivalent
default:
return Promise.Resolved();
}
}
public static GestureTapCallback wrapForTap(GestureTapCallback callback, BuildContext context) {
if (callback == null) {
return null;
}
return () => {
forTap(context);
callback();
};
}
public static IPromise forLongPress(BuildContext context) {
switch (_platform(context)) {
case RuntimePlatform.Android:
return Promise.Resolved(); // HapticFeedback.vibrate(); TODO
default:
return Promise.Resolved();
}
}
public static GestureLongPressCallback
wrapForLongPress(GestureLongPressCallback callback, BuildContext context) {
if (callback == null) {
return null;
}
return () => {
forLongPress(context);
callback();
};
}
static RuntimePlatform _platform(BuildContext context) {
return Theme.of(context).platform;
}
}
}

3
Runtime/material/feedback.cs.meta


fileFormatVersion: 2
guid: 40b01a32a0bc4afc9de46b001ebd9b99
timeCreated: 1554815981
正在加载...
取消
保存