浏览代码

update rendering to layer.cs (except editable.cs)

/siyaoH-1.17-PlatformMessage
guanghuispark 4 年前
当前提交
c5c37fb4
共有 5 个文件被更改,包括 29 次插入37 次删除
  1. 35
      com.unity.uiwidgets/Runtime/rendering/custom_paint.cs
  2. 9
      com.unity.uiwidgets/Runtime/rendering/error.cs
  3. 8
      com.unity.uiwidgets/Runtime/rendering/flex.cs
  4. 2
      com.unity.uiwidgets/Runtime/rendering/image.cs
  5. 12
      com.unity.uiwidgets/Runtime/rendering/layer.cs

35
com.unity.uiwidgets/Runtime/rendering/custom_paint.cs


using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.rendering;

base.detach();
}
protected override bool hitTestChildren(BoxHitTestResult result, Offset position) {
protected override bool hitTestChildren(BoxHitTestResult result, Offset position = null) {
if (_foregroundPainter != null && ((_foregroundPainter.hitTest(position)) ?? false)) {
return true;
}

D.assert(() => {
int debugNewCanvasSaveCount = canvas.getSaveCount();
if (debugNewCanvasSaveCount > debugPreviousCanvasSaveCount) {
throw new UIWidgetsError(
$"{debugNewCanvasSaveCount - debugPreviousCanvasSaveCount} more " +
$"time{((debugNewCanvasSaveCount - debugPreviousCanvasSaveCount == 1) ? "" : "s")} " +
"than it called canvas.restore().\n" +
"This leaves the canvas in an inconsistent state and will probably result in a broken display.\n" +
"You must pair each call to save()/saveLayer() with a later matching call to restore()."
);
throw new UIWidgetsError(new List<DiagnosticsNode>{
new ErrorSummary(
$"The {painter} custom painter called canvas.save() or canvas.saveLayer() at least " +
$"{debugNewCanvasSaveCount - debugPreviousCanvasSaveCount} more " +
"times than it called canvas.restore()."
),
new ErrorDescription("This leaves the canvas in an inconsistent state and will probably result in a broken display."),
new ErrorHint("You must pair each call to save()/saveLayer() with a later matching call to restore().")
});
throw new UIWidgetsError(
$"The {painter} custom painter called canvas.restore() " +
$"{debugPreviousCanvasSaveCount - debugNewCanvasSaveCount} more " +
$"time{(debugPreviousCanvasSaveCount - debugNewCanvasSaveCount == 1 ? "" : "s")} " +
"than it called canvas.save() or canvas.saveLayer().\n" +
"This leaves the canvas in an inconsistent state and will result in a broken display.\n" +
"You should only call restore() if you first called save() or saveLayer()."
);
throw new UIWidgetsError(new List<DiagnosticsNode>{
new ErrorSummary($"The {painter} custom painter called canvas.restore() " +
$"{debugPreviousCanvasSaveCount - debugNewCanvasSaveCount} more " +
"times than it called canvas.save() or canvas.saveLayer()."
),
new ErrorDescription("This leaves the canvas in an inconsistent state and will result in a broken display."),
new ErrorHint("You should only call restore() if you first called save() or saveLayer().")
});
}
return debugNewCanvasSaveCount == debugPreviousCanvasSaveCount;

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


}
public class RenderErrorBox : RenderBox {
const string _kLine = "\n\n────────────────────\n\n";
protected override bool sizedByParent
{

ParagraphBuilder builder = new ParagraphBuilder(paragraphStyle);
builder.pushStyle(textStyle);
builder.addText(
$"{message}{_kLine}{message}{_kLine}{message}{_kLine}{message}{_kLine}{message}{_kLine}{message}{_kLine}{message}{_kLine}{message}{_kLine}{message}{_kLine}{message}{_kLine}{message}{_kLine}{message}{_kLine}"
);
builder.addText(message);
_paragraph = builder.build();
}

protected internal override float computeMaxIntrinsicHeight(float width) {
return rendering_._kMaxHeight;
}
/*protected override bool sizedByParent {
get => true;
}*/
protected override bool hitTestSelf(Offset position) => true;

8
com.unity.uiwidgets/Runtime/rendering/flex.cs


public TextBaseline _textBaseline;
public float _overflow;
bool _hasOverflow {
get {
return _overflow > foundation_.precisionErrorTolerance;
}
}
public override void setupParentData(RenderObject child) {
if (!(child.parentData is FlexParentData)) {

}
public override void paint(PaintingContext context, Offset offset) {
if (_overflow <= 0.0f) {
if (!_hasOverflow) {
defaultPaint(context, offset);
return;
}

2
com.unity.uiwidgets/Runtime/rendering/image.cs


properties.add(new FloatProperty("width", width, defaultValue: foundation_.kNullDefaultValue));
properties.add(new FloatProperty("height", height, defaultValue: foundation_.kNullDefaultValue));
properties.add(new FloatProperty("scale", scale, defaultValue: 1.0f));
properties.add(new DiagnosticsProperty<Color>("color", color,
properties.add(new ColorProperty("color", color,
defaultValue: foundation_.kNullDefaultValue));
properties.add(new EnumProperty<BlendMode>("colorBlendMode", colorBlendMode,
defaultValue: foundation_.kNullDefaultValue));

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


}
}
internal bool _subtreeNeedsAddToScene;
protected EngineLayer engineLayer {
get { return _engineLayer; }
set {

findAnnotations<S>(result, localPosition, onlyFirst: true);
return result.entries.Count() == 0 ? default : result.entries.First().annotation;
}
/*
@Deprecated(
'Use findAllAnnotations(...).annotations instead. '
'This feature was deprecated after v1.10.14.'
)
Iterable<S> findAll<S>(Offset localPosition) {
final AnnotationResult<S> result = findAllAnnotations(localPosition);
return result.entries.map((AnnotationEntry<S> entry) => entry.annotation);
}*/
AnnotationResult<S> findAllAnnotations<S>(Offset localPosition) {
AnnotationResult<S> result = new AnnotationResult<S>();
findAnnotations<S>(result, localPosition, onlyFirst: false);

正在加载...
取消
保存