siyao
4 年前
当前提交
bffd7872
共有 34 个文件被更改,包括 1301 次插入 和 287 次删除
-
2com.unity.uiwidgets/Runtime/foundation/assertions.cs
-
2com.unity.uiwidgets/Runtime/painting/border_radius.cs
-
9com.unity.uiwidgets/Runtime/painting/box_border.cs
-
40com.unity.uiwidgets/Runtime/painting/box_decoration.cs
-
2com.unity.uiwidgets/Runtime/painting/decoration.cs
-
16com.unity.uiwidgets/Runtime/painting/edge_insets.cs
-
25com.unity.uiwidgets/Runtime/painting/gradient.cs
-
20com.unity.uiwidgets/Runtime/painting/inline_span.cs
-
4com.unity.uiwidgets/Runtime/painting/shape_decoration.cs
-
74com.unity.uiwidgets/Runtime/painting/text_painter.cs
-
145com.unity.uiwidgets/Runtime/painting/text_span.cs
-
42com.unity.uiwidgets/Runtime/painting/text_style.cs
-
2com.unity.uiwidgets/Runtime/rendering/box.cs
-
19com.unity.uiwidgets/Runtime/rendering/layer.cs
-
2com.unity.uiwidgets/Runtime/rendering/list_wheel_viewport.cs
-
4com.unity.uiwidgets/Runtime/rendering/object.cs
-
16com.unity.uiwidgets/Runtime/rendering/proxy_box.cs
-
2com.unity.uiwidgets/Runtime/rendering/rotated_box.cs
-
2com.unity.uiwidgets/Runtime/rendering/sliver.cs
-
2com.unity.uiwidgets/Runtime/rendering/view.cs
-
2com.unity.uiwidgets/Runtime/rendering/viewport.cs
-
886com.unity.uiwidgets/Runtime/ui2/Matrix4.cs
-
6com.unity.uiwidgets/Runtime/widgets/basic.cs
-
2com.unity.uiwidgets/Runtime/widgets/editable_text.cs
-
91com.unity.uiwidgets/Runtime/widgets/framework.cs
-
2com.unity.uiwidgets/Runtime/widgets/implicit_animations.cs
-
2com.unity.uiwidgets/Runtime/widgets/selectable_text.cs
-
2com.unity.uiwidgets/Runtime/widgets/text.cs
-
4com.unity.uiwidgets/Runtime/widgets/transitions.cs
-
2com.unity.uiwidgets/Runtime/widgets/widget_inspector.cs
-
44com.unity.uiwidgets/Runtime/painting/placeholder_span.cs
-
3com.unity.uiwidgets/Runtime/painting/placeholder_span.cs.meta
-
109com.unity.uiwidgets/Runtime/widgets/widget_span.cs
-
3com.unity.uiwidgets/Runtime/widgets/widget_span.cs.meta
886
com.unity.uiwidgets/Runtime/ui2/Matrix4.cs
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.gestures; |
|||
using Unity.UIWidgets.ui; |
|||
|
|||
namespace Unity.UIWidgets.painting { |
|||
abstract class PlaceholderSpan : InlineSpan { |
|||
public PlaceholderSpan( |
|||
TextBaseline baseline, |
|||
TextStyle style, |
|||
PlaceholderAlignment alignment = PlaceholderAlignment.bottom, |
|||
HoverRecognizer hoverRecognizer = null |
|||
) : base(style: style, hoverRecognizer: hoverRecognizer) { |
|||
this.baseline = baseline; |
|||
this.alignment = alignment; |
|||
} |
|||
|
|||
public PlaceholderAlignment alignment; |
|||
|
|||
public TextBaseline baseline; |
|||
|
|||
public override void computeToPlainText( |
|||
StringBuilder buffer, |
|||
bool includeSemanticsLabels = true, |
|||
bool includePlaceholders = true |
|||
) { |
|||
if (includePlaceholders) { |
|||
buffer.Append('\uFFFC'); |
|||
} |
|||
} |
|||
|
|||
public override void computeSemanticsInformation(List<InlineSpanSemanticsInformation> collector) { |
|||
collector.Add(InlineSpanSemanticsInformation.placeholder); |
|||
} |
|||
|
|||
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) { |
|||
base.debugFillProperties(properties); |
|||
|
|||
properties.add(new EnumProperty<PlaceholderAlignment>("alignment", alignment, defaultValue: null)); |
|||
properties.add(new EnumProperty<TextBaseline>("baseline", baseline, defaultValue: null)); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: c1dc25aeb48f4abbb683062b2a1d4582 |
|||
timeCreated: 1606291325 |
|
|||
using System.Collections.Generic; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.ui; |
|||
using TextStyle = Unity.UIWidgets.painting.TextStyle; |
|||
|
|||
namespace Unity.UIWidgets.widgets { |
|||
class WidgetSpan : PlaceholderSpan { |
|||
public WidgetSpan( |
|||
Widget child, |
|||
TextBaseline baseline, |
|||
TextStyle style, |
|||
PlaceholderAlignment alignment = PlaceholderAlignment.bottom |
|||
) : base( |
|||
alignment: alignment, |
|||
baseline: baseline, |
|||
style: style |
|||
) { |
|||
D.assert(child != null); |
|||
D.assert(!( |
|||
(alignment == PlaceholderAlignment.aboveBaseline) || |
|||
(alignment == PlaceholderAlignment.belowBaseline) || |
|||
(alignment == PlaceholderAlignment.baseline) |
|||
)); |
|||
this.child = child; |
|||
} |
|||
|
|||
Widget child; |
|||
|
|||
public override void build( |
|||
ParagraphBuilder builder, |
|||
float textScaleFactor = 1.0f, |
|||
List<PlaceholderDimensions> dimensions = null) { |
|||
D.assert(DebugAssertIsValid()); |
|||
D.assert(dimensions != null); |
|||
bool hasStyle = style != null; |
|||
if (hasStyle) { |
|||
builder.pushStyle(style.getTextStyle(textScaleFactor: textScaleFactor)); |
|||
} |
|||
|
|||
D.assert(builder.placeholderCount < dimensions.Count); |
|||
PlaceholderDimensions currentDimensions = dimensions[builder.placeholderCount]; |
|||
builder.addPlaceholder( |
|||
currentDimensions.size.width, |
|||
currentDimensions.size.height, |
|||
alignment, |
|||
scale: textScaleFactor, |
|||
baseline: currentDimensions.baseline, |
|||
baselineOffset: currentDimensions.baselineOffset |
|||
); |
|||
if (hasStyle) { |
|||
builder.pop(); |
|||
} |
|||
} |
|||
|
|||
|
|||
public override bool visitChildren(InlineSpanVisitor visitor) { |
|||
return visitor(this); |
|||
} |
|||
|
|||
|
|||
protected override InlineSpan getSpanForPositionVisitor(TextPosition position, Accumulator offset) { |
|||
if (position.offset == offset.value) { |
|||
return this; |
|||
} |
|||
|
|||
offset.increment(1); |
|||
return null; |
|||
} |
|||
|
|||
protected override int? codeUnitAtVisitor(int index, Accumulator offset) { |
|||
return null; |
|||
} |
|||
|
|||
public override RenderComparison compareTo(InlineSpan other) { |
|||
if (this == other) |
|||
return RenderComparison.identical; |
|||
if ((style == null) != (other.style == null)) |
|||
return RenderComparison.layout; |
|||
WidgetSpan typedOther = other as WidgetSpan; |
|||
if (child.Equals(typedOther.child) || alignment != typedOther.alignment) { |
|||
return RenderComparison.layout; |
|||
} |
|||
|
|||
RenderComparison result = RenderComparison.identical; |
|||
if (style != null) { |
|||
RenderComparison candidate = style.compareTo(other.style); |
|||
if ((int) candidate > (int) result) |
|||
result = candidate; |
|||
if (result == RenderComparison.layout) |
|||
return result; |
|||
} |
|||
|
|||
return result; |
|||
} |
|||
|
|||
public override int GetHashCode() { |
|||
int hashCode = base.GetHashCode(); |
|||
hashCode = (hashCode * 397) ^ (child.GetHashCode()); |
|||
hashCode = (hashCode * 397) ^ (alignment.GetHashCode()); |
|||
hashCode = (hashCode * 397) ^ (baseline.GetHashCode()); |
|||
return hashCode; |
|||
} |
|||
|
|||
public bool DebugAssertIsValid() { |
|||
return true; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 5d48514e70d8418195ae5d7352f15a0e |
|||
timeCreated: 1606303521 |
撰写
预览
正在加载...
取消
保存
Reference in new issue