浏览代码

fix some

/zgh-devtools
Shiyun Wen 4 年前
当前提交
263e177d
共有 8 个文件被更改,包括 9 次插入449 次删除
  1. 7
      com.unity.uiwidgets/Runtime/cupertino/segmented_control.cs
  2. 9
      com.unity.uiwidgets/Runtime/rendering/binding.cs
  3. 41
      com.unity.uiwidgets/Runtime/rendering/layer.cs
  4. 46
      com.unity.uiwidgets/Runtime/rendering/paragraph.cs
  5. 311
      com.unity.uiwidgets/Runtime/rendering/proxy_box.cs
  6. 16
      com.unity.uiwidgets/Runtime/rendering/proxy_sliver.cs
  7. 26
      com.unity.uiwidgets/Runtime/widgets/editable_text.cs
  8. 2
      com.unity.uiwidgets/Runtime/widgets/focus_traversal.cs

7
com.unity.uiwidgets/Runtime/cupertino/segmented_control.cs


data: iconTheme,
child: new DefaultTextStyle(
style: textStyle,
child: child /*Semantics(
button: true,
inMutuallyExclusiveGroup: true,
selected: widget.groupValue.Equals(currentKey),
child: child
)*/
child: child
)
)
);

9
com.unity.uiwidgets/Runtime/rendering/binding.cs


}
readonly protected bool inEditorWindow;
/* MouseTracker _createMouseTracker() {
return new MouseTracker(pointerRouter, (Offset offset) => {
return renderView.layer.find<MouseTrackerAnnotation>(
offset
);
}, inEditorWindow);
}*/
protected virtual void drawFrame() {
D.assert(renderView != null);

41
com.unity.uiwidgets/Runtime/rendering/layer.cs


}
}
/*internal override S find<S>(Offset regionOffset) {
return null;
}*/
public override void addToScene(SceneBuilder builder, Offset layerOffset = null) {
layerOffset = layerOffset ?? Offset.zero;
builder.addPicture(layerOffset, picture,

}
/*internal override S find<S>(Offset regionOffset) {
Layer current = lastChild;
while (current != null) {
S value = current.find<S>(regionOffset);
if (value != null) {
return value;
}
current = current.previousSibling;
}
return null;
}*/
public override bool findAnnotations<S>(
AnnotationResult<S> result,
Offset localPosition,

base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<Offset>("offset", offset));
}
/*public Scene buildScene(SceneBuilder builder) {
List<PictureLayer> temporaryLayers = null;
D.assert(() => {
if (RenderingDebugUtils.debugCheckElevationsEnabled) {
temporaryLayers = _debugCheckElevations();
}
return true;
});
updateSubtreeNeedsAddToScene();
addToScene(builder);
Scene scene = builder.build();
D.assert(() => {
if (temporaryLayers != null) {
foreach (PictureLayer temporaryLayer in temporaryLayers) {
temporaryLayer.remove();
}
}
return true;
});
return scene;
}*/
public Future<ui.Image> toImage(Rect bounds, float pixelRatio = 1.0f)// async
{

46
com.unity.uiwidgets/Runtime/rendering/paragraph.cs


bool _hasHoverRecognizer;
MouseTrackerAnnotation _hoverAnnotation;
/*void _resetHoverHandler() {
_hasHoverRecognizer = (_textPainter.text as TextSpan)?.hasHoverRecognizer ?? false;
_previousHoverSpan = null;
_pointerHoverInside = false;
if (_hoverAnnotation != null && attached) {
RendererBinding.instance.mouseTracker.detachAnnotation(_hoverAnnotation);
}
if (_hasHoverRecognizer) {
_hoverAnnotation = new MouseTrackerAnnotation(
onEnter: _onPointerEnter,
onHover: _onPointerHover,
onExit: _onPointerExit);
if (attached) {
RendererBinding.instance.mouseTracker.attachAnnotation(_hoverAnnotation);
}
}
else {
_hoverAnnotation = null;
}
}*/
void _handleKeyEvent(RawKeyEvent keyEvent) {
//only allow KCommand.copy

}
base.detach();
/*if (_hoverAnnotation != null) {
RendererBinding.instance.mouseTracker.dispose();//detachAnnotation(_hoverAnnotation);
}*/
}
TextSelection _selection;

_pointerHoverInside = true;
}
/*void _onPointerExit(PointerEvent evt) {
_pointerHoverInside = false;
(_previousHoverSpan as TextSpan)?.hoverRecognizer?.OnPointerLeave?.Invoke();
_previousHoverSpan = null;
}*/
/*void _onPointerHover(PointerEvent evt) {
_layoutTextWithConstraints(constraints);
Offset offset = globalToLocal(evt.position);
TextPosition position = _textPainter.getPositionForOffset(offset);
InlineSpan span = _textPainter.text.getSpanForPosition(position);
if (_previousHoverSpan != span) {
(_previousHoverSpan as TextSpan)?.hoverRecognizer?.OnPointerLeave?.Invoke();
(span as TextSpan)?.hoverRecognizer?.OnPointerEnter?.Invoke((PointerHoverEvent) evt);
_previousHoverSpan = span;
}
}*/
public override void handleEvent(PointerEvent evt, HitTestEntry entry) {
D.assert(debugHandleEvent(evt, entry));

311
com.unity.uiwidgets/Runtime/rendering/proxy_box.cs


public delegate void PointerScrollEventListener(PointerScrollEvent evt);
/*public class RenderPointerListener : RenderProxyBoxWithHitTestBehavior {
public RenderPointerListener(
PointerDownEventListener onPointerDown = null,
PointerMoveEventListener onPointerMove = null,
PointerEnterEventListener onPointerEnter = null,
PointerHoverEventListener onPointerHover = null,
PointerExitEventListener onPointerExit = null,
PointerUpEventListener onPointerUp = null,
PointerCancelEventListener onPointerCancel = null,
PointerSignalEventListener onPointerSignal = null,
PointerScrollEventListener onPointerScroll = null,
PointerDragFromEditorEnterEventListener onPointerDragFromEditorEnter = null,
PointerDragFromEditorHoverEventListener onPointerDragFromEditorHover = null,
PointerDragFromEditorExitEventListener onPointerDragFromEditorExit = null,
PointerDragFromEditorReleaseEventListener onPointerDragFromEditorRelease = null,
HitTestBehavior behavior = HitTestBehavior.deferToChild,
RenderBox child = null
) : base(behavior: behavior, child: child) {
this.onPointerDown = onPointerDown;
this.onPointerMove = onPointerMove;
this.onPointerUp = onPointerUp;
this.onPointerCancel = onPointerCancel;
this.onPointerSignal = onPointerSignal;
this.onPointerScroll = onPointerScroll;
_onPointerEnter = onPointerEnter;
_onPointerHover = onPointerHover;
_onPointerExit = onPointerExit;
_onPointerDragFromEditorEnter = onPointerDragFromEditorEnter;
_onPointerDragFromEditorHover = onPointerDragFromEditorHover;
_onPointerDragFromEditorExit = onPointerDragFromEditorExit;
_onPointerDragFromEditorRelease = onPointerDragFromEditorRelease;
if (_onPointerEnter != null ||
_onPointerHover != null ||
_onPointerExit != null ||
_onPointerDragFromEditorEnter != null ||
_onPointerDragFromEditorHover != null ||
_onPointerDragFromEditorExit != null ||
_onPointerDragFromEditorRelease != null
) {
_hoverAnnotation = new MouseTrackerAnnotation(
onEnter: _onPointerEnter,
onHover: _onPointerHover,
onExit: _onPointerExit,
onDragFromEditorEnter: _onPointerDragFromEditorEnter,
onDragFromEditorHover: _onPointerDragFromEditorHover,
onDragFromEditorExit: _onPointerDragFromEditorExit,
onDragFromEditorRelease: _onPointerDragFromEditorRelease
);
}
}
PointerDragFromEditorEnterEventListener _onPointerDragFromEditorEnter;
public PointerDragFromEditorEnterEventListener onPointerDragFromEditorEnter {
get { return _onPointerDragFromEditorEnter; }
set {
if (_onPointerDragFromEditorEnter != value) {
_onPointerDragFromEditorEnter = value;
_updateAnnotations();
}
}
}
PointerDragFromEditorExitEventListener _onPointerDragFromEditorExit;
public PointerDragFromEditorExitEventListener onPointerDragFromEditorExit {
get { return _onPointerDragFromEditorExit; }
set {
if (_onPointerDragFromEditorExit != value) {
_onPointerDragFromEditorExit = value;
_updateAnnotations();
}
}
}
PointerDragFromEditorHoverEventListener _onPointerDragFromEditorHover;
public PointerDragFromEditorHoverEventListener onPointerDragFromEditorHover {
get { return _onPointerDragFromEditorHover; }
set {
if (_onPointerDragFromEditorHover != value) {
_onPointerDragFromEditorHover = value;
_updateAnnotations();
}
}
}
PointerDragFromEditorReleaseEventListener _onPointerDragFromEditorRelease;
public PointerDragFromEditorReleaseEventListener onPointerDragFromEditorRelease {
get { return _onPointerDragFromEditorRelease; }
set {
if (_onPointerDragFromEditorRelease != value) {
_onPointerDragFromEditorRelease = value;
_updateAnnotations();
}
}
}
public PointerEnterEventListener onPointerEnter {
get { return _onPointerEnter; }
set {
if (_onPointerEnter != value) {
_onPointerEnter = value;
_updateAnnotations();
}
}
}
PointerEnterEventListener _onPointerEnter;
public PointerHoverEventListener onPointerHover {
get { return _onPointerHover; }
set {
if (_onPointerHover != value) {
_onPointerHover = value;
_updateAnnotations();
}
}
}
PointerHoverEventListener _onPointerHover;
public PointerExitEventListener onPointerExit {
get { return _onPointerExit; }
set {
if (_onPointerExit != value) {
_onPointerExit = value;
_updateAnnotations();
}
}
}
PointerExitEventListener _onPointerExit;
public PointerDownEventListener onPointerDown;
public PointerMoveEventListener onPointerMove;
public PointerUpEventListener onPointerUp;
public PointerCancelEventListener onPointerCancel;
public PointerSignalEventListener onPointerSignal;
public PointerScrollEventListener onPointerScroll;
MouseTrackerAnnotation _hoverAnnotation;
public MouseTrackerAnnotation hoverAnnotation {
get { return _hoverAnnotation; }
}
void _updateAnnotations() {
D.assert(_onPointerEnter != _hoverAnnotation.onEnter ||
_onPointerHover != _hoverAnnotation.onHover ||
_onPointerExit != _hoverAnnotation.onExit
#if UNITY_EDITOR
|| _onPointerDragFromEditorEnter != _hoverAnnotation.onDragFromEditorEnter
|| _onPointerDragFromEditorHover != _hoverAnnotation.onDragFromEditorHover
|| _onPointerDragFromEditorExit != _hoverAnnotation.onDragFromEditorExit
|| _onPointerDragFromEditorRelease != _hoverAnnotation.onDragFromEditorRelease
#endif
, () => "Shouldn't call _updateAnnotations if nothing has changed.");
if (_hoverAnnotation != null && attached) {
RendererBinding.instance.mouseTracker.detachAnnotation(_hoverAnnotation);
}
if (_onPointerEnter != null ||
_onPointerHover != null ||
_onPointerExit != null
#if UNITY_EDITOR
|| _onPointerDragFromEditorEnter != null
|| _onPointerDragFromEditorHover != null
|| _onPointerDragFromEditorExit != null
|| _onPointerDragFromEditorRelease != null
#endif
) {
_hoverAnnotation = new MouseTrackerAnnotation(
onEnter: _onPointerEnter,
onHover: _onPointerHover,
onExit: _onPointerExit
#if UNITY_EDITOR
, onDragFromEditorEnter: _onPointerDragFromEditorEnter
, onDragFromEditorHover: _onPointerDragFromEditorHover
, onDragFromEditorExit: _onPointerDragFromEditorExit
, onDragFromEditorRelease: _onPointerDragFromEditorRelease
#endif
);
if (attached) {
RendererBinding.instance.mouseTracker.attachAnnotation(_hoverAnnotation);
}
}
else {
_hoverAnnotation = null;
}
markNeedsPaint();
}
public override void attach(object owner) {
base.attach(owner);
if (_hoverAnnotation != null) {
RendererBinding.instance.mouseTracker.attachAnnotation(_hoverAnnotation);
}
}
public override void detach() {
base.detach();
if (_hoverAnnotation != null) {
RendererBinding.instance.mouseTracker.detachAnnotation(_hoverAnnotation);
}
}
public override void paint(PaintingContext context, Offset offset) {
if (_hoverAnnotation != null) {
AnnotatedRegionLayer<MouseTrackerAnnotation> layer = new AnnotatedRegionLayer<MouseTrackerAnnotation>(
_hoverAnnotation, size: size, offset: offset);
context.pushLayer(layer, base.paint, offset);
}
else {
base.paint(context, offset);
}
}
protected override void performResize() {
size = constraints.biggest;
}
public override void handleEvent(PointerEvent evt, HitTestEntry entry) {
D.assert(debugHandleEvent(evt, entry));
if (onPointerDown != null && evt is PointerDownEvent) {
onPointerDown((PointerDownEvent) evt);
return;
}
if (onPointerMove != null && evt is PointerMoveEvent) {
onPointerMove((PointerMoveEvent) evt);
return;
}
if (onPointerUp != null && evt is PointerUpEvent) {
onPointerUp((PointerUpEvent) evt);
return;
}
if (onPointerCancel != null && evt is PointerCancelEvent) {
onPointerCancel((PointerCancelEvent) evt);
return;
}
if (onPointerSignal != null && evt is PointerSignalEvent) {
onPointerSignal((PointerSignalEvent) evt);
return;
}
if (onPointerScroll != null && evt is PointerScrollEvent) {
onPointerScroll((PointerScrollEvent) evt);
}
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
var listeners = new List<string>();
if (onPointerDown != null) {
listeners.Add("down");
}
if (onPointerMove != null) {
listeners.Add("move");
}
if (onPointerEnter != null) {
listeners.Add("enter");
}
if (onPointerHover != null) {
listeners.Add("hover");
}
if (onPointerExit != null) {
listeners.Add("exit");
}
if (onPointerUp != null) {
listeners.Add("up");
}
if (onPointerCancel != null) {
listeners.Add("cancel");
}
if (onPointerSignal != null) {
listeners.Add("signal");
}
if (listeners.isEmpty()) {
listeners.Add("<none>");
}
properties.add(new EnumerableProperty<string>("listeners", listeners));
}
}*/
class RenderPointerListener : RenderProxyBoxWithHitTestBehavior {
public RenderPointerListener(
PointerDownEventListener onPointerDown = null,

16
com.unity.uiwidgets/Runtime/rendering/proxy_sliver.cs


};
}
}
/*public class RenderSliverAnimatedOpacity : RenderProxySliver ,RenderAnimatedOpacityMixin<RenderSliver>{
public RenderSliverAnimatedOpacity(
Animation<double> opacity = null,
bool alwaysIncludeSemantics = false,
RenderSliver sliver = null
):base(sliver) {
D.assert(opacity != null);
D.assert(alwaysIncludeSemantics != null);
this.opacity = opacity;
this.alwaysIncludeSemantics = alwaysIncludeSemantics;
child = sliver;
}
}*/
}

26
com.unity.uiwidgets/Runtime/widgets/editable_text.cs


using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
//using Unity.UIWidgets.material;
using Unity.UIWidgets.material;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.scheduler2;

if (textChanged && widget.onChanged != null)
widget.onChanged(value.text);
_lastFormattedUnmodifiedTextEditingValue = _receivedRemoteTextEditingValue;
/*
var textChanged = _value?.text != value?.text || isIMEInput;
if (textChanged && widget.inputFormatters != null && widget.inputFormatters.isNotEmpty()) {
foreach (var formatter in widget.inputFormatters) {
value = formatter.formatEditUpdate(_value, value);
}
_value = value;
_updateRemoteEditingValueIfNeeded();
//_updateImePosIfNeed();
}
else {
_value = value;
}
if (textChanged && widget.onChanged != null) {
widget.onChanged(value.text);
}*/
}
void _onCursorColorTick() {

public readonly TextSelectionDelegate textSelectionDelegate;
public readonly bool? paintCursorAboveText;
public readonly float? devicePixelRatio;
//public readonly GlobalKeyEventHandlerDelegate globalKeyEventHandler;
public readonly Locale locale;
public _Editable(
Key key = null,

bool enableInteractiveSelection = true,
TextSelectionDelegate textSelectionDelegate = null,
float? devicePixelRatio = null
//GlobalKeyEventHandlerDelegate globalKeyEventHandler = null
) : base(key) {
) : base(key) {
this.textSpan = textSpan;
this.value = value;
this.startHandleLayerLink = startHandleLayerLink;

this.selectionWidthStyle = selectionWidthStyle;
this.enableInteractiveSelection = enableInteractiveSelection;
this.devicePixelRatio = devicePixelRatio;
//this.globalKeyEventHandler = globalKeyEventHandler;
}
public override RenderObject createRenderObject(BuildContext context) {

2
com.unity.uiwidgets/Runtime/widgets/focus_traversal.cs


public static void insertionSort<T>(List<T> list,
Comparator<T> compare = null, int start = 0, int end =0) {
//compare ??= defaultCompare<T>();
//compare = compare == null ? defaultCompare<T>();
end = end == 0 ?list.Count : end;
for (int pos = start + 1; pos < end; pos++) {

正在加载...
取消
保存