浏览代码

fix Scroll-Drag conflicts + fix dragStartDistanceMotionThreshold problem for dropdown drag error + provide 2 public/protected interfaces to Xun Ye

/main
xingwei.zhu 6 年前
当前提交
e9db36b3
共有 5 个文件被更改,包括 32 次插入19 次删除
  1. 24
      Runtime/gestures/monodrag.cs
  2. 9
      Runtime/gestures/recognizer.cs
  3. 6
      Runtime/rendering/paragraph.cs
  4. 2
      Runtime/widgets/media_query.cs
  5. 10
      Runtime/widgets/scroll_physics.cs

24
Runtime/gestures/monodrag.cs


});
}
this.invokeCallback<object>("onEnd", () => {
this.onEnd(new DragEndDetails(
velocity: Velocity.zero,
primaryVelocity: 0.0f
));
return null;
}, debugReport: () => { return "Pointer scroll end"; }
);
this._state = _DragState.ready;
this.stopTrackingScrollerPointer(evt.pointer);
return;
}

public override void rejectGesture(int pointer) {
this.stopTrackingPointer(pointer);
}
protected override void didStopTrackingLastScrollerPointer(int pointer) {
this._state = _DragState.ready;
this.invokeCallback<object>("onEnd", () => {
this.onEnd(new DragEndDetails(
velocity: Velocity.zero,
primaryVelocity: 0.0f
));
return null;
}, debugReport: () => { return "Pointer scroll end"; }
);
}
protected override void didStopTrackingLastPointer(int pointer) {

9
Runtime/gestures/recognizer.cs


protected abstract void didStopTrackingLastPointer(int pointer);
protected virtual void didStopTrackingLastScrollerPointer(int pointer) {
}
protected virtual void resolve(GestureDisposition disposition) {
var localEntries = new List<GestureArenaEntry>(this._entries.Values);
this._entries.Clear();

protected void startTrackingScrollerPointer(int pointer) {
GestureBinding.instance.pointerRouter.addRoute(pointer, this.handleEvent);
}
protected void stopTrackingScrollerPointer(int pointer) {
if (this._trackedPointers.isEmpty()) {
this.didStopTrackingLastScrollerPointer(pointer);
}
}
protected void startTrackingPointer(int pointer) {

6
Runtime/rendering/paragraph.cs


using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using UnityEngine;
using Rect = Unity.UIWidgets.ui.Rect;
namespace Unity.UIWidgets.rendering {
public enum TextOverflow {

this._textPainter.textDirection = this.textDirection;
this.markNeedsLayout();
}
}
protected Offset getOffsetForCaret(TextPosition position, Rect caretPrototype) {
D.assert(this._textPainter != null);
return this._textPainter.getOffsetForCaret(position, caretPrototype);
}
public bool softWrap {

2
Runtime/widgets/media_query.cs


return of(context, nullOk: true)?.textScaleFactor ?? 1.0f;
}
static bool boldTextOverride(BuildContext context) {
public static bool boldTextOverride(BuildContext context) {
return of(context, nullOk: true)?.boldText ?? false;
}

10
Runtime/widgets/scroll_physics.cs


}
}
public virtual float dragStartDistanceMotionThreshold {
public virtual float? dragStartDistanceMotionThreshold {
if (this.parent == null) {
return 0.0f;
}
return this.parent.dragStartDistanceMotionThreshold;
return this.parent?.dragStartDistanceMotionThreshold;
}
}

Mathf.Min(0.000816f * Mathf.Pow(existingVelocity.abs(), 1.967f), 40000.0f);
}
public override float dragStartDistanceMotionThreshold {
public override float? dragStartDistanceMotionThreshold {
get { return 3.5f; }
}
}

正在加载...
取消
保存