浏览代码

fix

/siyaoH-1.17-PlatformMessage
Xingwei Zhu 4 年前
当前提交
ecd0f953
共有 2 个文件被更改,包括 27 次插入44 次删除
  1. 4
      Samples/UIWidgetsSamples_2019_4/.idea/.idea.UIWidgetsSamples_2019_4/.idea/indexLayout.xml
  2. 67
      com.unity.uiwidgets/Runtime/rendering/debug_overflow_indicator.cs

4
Samples/UIWidgetsSamples_2019_4/.idea/.idea.UIWidgetsSamples_2019_4/.idea/indexLayout.xml


<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ContentModelUserStore">
<attachedFolders />
<attachedFolders>
<Path>../../com.unity.uiwidgets</Path>
</attachedFolders>
<explicitIncludes>
<Path>Library/PackageCache/com.unity.collab-proxy@1.2.16</Path>
<Path>Library/PackageCache/com.unity.ext.nunit@1.0.0</Path>

67
com.unity.uiwidgets/Runtime/rendering/debug_overflow_indicator.cs


using System;
using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.engine2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;

const float _indicatorFraction = 0.1f;
const float _indicatorFontSizePixels = 7.5f;
const float _indicatorLabelPaddingPixels = 1.0f;
static readonly TextStyle _indicatorTextStyle = new TextStyle(
color: new Color(0xFF900000),
fontSize: _indicatorFontSizePixels,
fontWeight: FontWeight.w800
);
static readonly Paint _indicatorPaint = new Paint{ shader = Gradient.linear(
new Offset(0.0f, 0.0f),
new Offset(10.0f, 10.0f),
new List<Color> {_black, _yellow, _yellow, _black},
new List<float> {0.25f, 0.25f, 0.75f, 0.75f},
TileMode.repeated
)};
static readonly Paint _labelBackgroundPaint = new Paint{color = new Color(0xFFFFFFFF)};
static readonly List<TextPainter> _indicatorLabel = new List<TextPainter> {
new TextPainter(textDirection: TextDirection.ltr),
new TextPainter(textDirection: TextDirection.ltr),
new TextPainter(textDirection: TextDirection.ltr),
new TextPainter(textDirection: TextDirection.ltr)
};
static readonly Dictionary<RenderObject, bool> _overflowReportNeeded = new Dictionary<RenderObject, Boolean>();

Rect childRect,
List<DiagnosticsNode> overflowHints = null
) {
#if UNITY_EDITOR
//FIXME:
//we skip the following check in UIWidgetsEditorPanel since it will cause crash
//the reason is not clear yet, we should digest into it later
if (UIWidgetsPanelWrapper.current.window.getWindowType() != UIWidgetsWindowType.GameObjectPanel) {
return;
}
#endif
RelativeRect overflow = RelativeRect.fromRect(containerRect, childRect);
if (overflow.left <= 0.0f &&

return;
}
TextStyle _indicatorTextStyle = new TextStyle(
color: new Color(0xFF900000),
fontSize: _indicatorFontSizePixels,
fontWeight: FontWeight.w800
);
Paint _indicatorPaint = new Paint{ shader = Gradient.linear(
new Offset(0.0f, 0.0f),
new Offset(10.0f, 10.0f),
new List<Color> {_black, _yellow, _yellow, _black},
new List<float> {0.25f, 0.25f, 0.75f, 0.75f},
TileMode.repeated
)};
Paint _labelBackgroundPaint = new Paint{color = new Color(0xFFFFFFFF)};
TextSpan textSpan = _indicatorLabel[(int) region.side].text as TextSpan;
if (textSpan?.text != region.label) {
_indicatorLabel[(int) region.side].text = new TextSpan(
var textPainter = new TextPainter(textDirection: TextDirection.ltr) {
text = new TextSpan(
style: _indicatorTextStyle
);
_indicatorLabel[(int) region.side].layout();
}
style: _indicatorTextStyle)
};
textPainter.layout();
Offset centerOffset = new Offset(-_indicatorLabel[(int) region.side].width / 2.0f, 0.0f);
Rect textBackgroundRect = centerOffset & _indicatorLabel[(int) region.side].size;
Offset centerOffset = new Offset(-textPainter.width / 2.0f, 0.0f);
Rect textBackgroundRect = centerOffset & textPainter.size;
_indicatorLabel[(int) region.side].paint(context.canvas, centerOffset);
textPainter.paint(context.canvas, centerOffset);
context.canvas.restore();
}

正在加载...
取消
保存