浏览代码

add inspector functions: refresh, toggle debug paint

/main
fzhangtj 6 年前
当前提交
de1e6859
共有 15 个文件被更改,包括 415 次插入115 次删除
  1. 6
      Runtime/debugger/inpsector_panel.cs
  2. 131
      Runtime/debugger/inspector_window.cs
  3. 12
      Runtime/editor/editor_window.cs
  4. 68
      Runtime/foundation/debug.cs
  5. 2
      Runtime/material/material.cs
  6. 99
      Runtime/painting/colors.cs
  7. 56
      Runtime/rendering/box.cs
  8. 2
      Runtime/rendering/image.cs
  9. 22
      Runtime/rendering/object.cs
  10. 2
      Runtime/rendering/paragraph.cs
  11. 3
      Runtime/rendering/proxy_box.cs
  12. 109
      Runtime/rendering/shifted_box.cs
  13. 7
      Runtime/rendering/view.cs
  14. 7
      Runtime/rendering/viewport.cs
  15. 4
      Runtime/widgets/basic.cs

6
Runtime/debugger/inpsector_panel.cs


this.m_TreeView.node = node;
}
public void MarkNeedReload() {
this.m_TreeView.node = null;
this.m_NeedSelectionUpdate = true;
}
public void Update() {
if (!this.m_VisibleToUser) {
return;

item = this.m_TreeView.getTreeItemByValueRef(diagnosticsNode.valueRef);
}
this.m_TreeView.CollapseAll();
if (item != null) {
this.m_TreeView.SetSelection(new List<int> {item.id}, TreeViewSelectionOptions.RevealAndFrame);
}

131
Runtime/debugger/inspector_window.cs


#if UNITY_EDITOR
using System;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.widgets;
using UnityEditor;
using UnityEngine;

const float debugPaintToggleGroupWidth = 120;
const float debugPaintToggleGroupHeight = 100;
[SerializeField]
bool m_DebugPaint;
[SerializeField]
bool m_DebugPaintSize;
[SerializeField]
bool m_DebugPaintBaseline;
[SerializeField]
bool m_DebugPaintPointer;
[SerializeField]
bool m_DebugPaintLayer;
bool m_ShowDebugPaintToggles;
Rect _debugPaintTogglesRect;
List<Action> m_UpdateActions = new List<Action>();
[MenuItem("Window/Analysis/UIWidgets Inspector")]
public static void Init() {
WidgetsInpsectorWindow window =

void OnGUI() {
EditorGUILayout.BeginHorizontal(EditorStyles.toolbar, GUILayout.ExpandWidth(true));
GUILayout.BeginHorizontal(EditorStyles.toolbar, GUILayout.ExpandWidth(true));
bool needDebugPaintUpdate = false;
if (GUILayout.Button("Refersh", EditorStyles.toolbarButton)) {
foreach (var panel in this.m_Panels) {
panel.MarkNeedReload();
}
}
EditorGUI.BeginChangeCheck();
var newShowInspect = GUILayout.Toggle(this.m_ShowInspect, new GUIContent("Inspect Element"),
EditorStyles.toolbarButton);

var style = (GUIStyle) "GV Gizmo DropDown";
Rect r = GUILayoutUtility.GetRect(new GUIContent("Debug Paint"), style);
Rect rightRect = new Rect(r.xMax - style.border.right, r.y, style.border.right, r.height);
if (EditorGUI.DropdownButton(rightRect, GUIContent.none, FocusType.Passive, GUIStyle.none))
{
this.ScheduleUpdateAction(() => {
this.m_ShowDebugPaintToggles = !this.m_ShowDebugPaintToggles;
this.Repaint();
});
}
if (Event.current.type == EventType.Repaint) {
this._debugPaintTogglesRect = new Rect(r.xMax - debugPaintToggleGroupWidth, r.yMax + 2,
debugPaintToggleGroupWidth, debugPaintToggleGroupHeight);
}
EditorGUI.BeginChangeCheck();
this.m_DebugPaint = GUI.Toggle(r, this.m_DebugPaint, new GUIContent("Debug Paint"), style);
if (EditorGUI.EndChangeCheck()) {
if (this.m_DebugPaint) {
if (!this.m_DebugPaintSize && !this.m_DebugPaintLayer
&& !this.m_DebugPaintPointer && !this.m_DebugPaintBaseline) {
this.m_DebugPaintSize = true;
}
}
needDebugPaintUpdate = true;
}
}
EditorGUILayout.EndHorizontal();

});
EditorGUILayout.EndHorizontal();
this.m_Panels[this.m_PanelIndex].OnGUI();
bool shouldHandleGUI = true;
if (Event.current.type == EventType.MouseDown || Event.current.type == EventType.MouseUp) {
if (this.m_ShowDebugPaintToggles && this._debugPaintTogglesRect.Contains(Event.current.mousePosition)) {
shouldHandleGUI = false;
}
}
if (shouldHandleGUI) {
this.m_Panels[this.m_PanelIndex].OnGUI();
}
if (this.m_ShowDebugPaintToggles) {
this.DebugPaintToggles(ref needDebugPaintUpdate);
}
if (needDebugPaintUpdate) {
D.setDebugPaint(
debugPaintSizeEnabled: this.m_DebugPaint && this.m_DebugPaintSize,
debugPaintBaselinesEnabled: this.m_DebugPaint && this.m_DebugPaintBaseline,
debugPaintPointersEnabled: this.m_DebugPaint && this.m_DebugPaintPointer,
debugPaintLayerBordersEnabled: this.m_DebugPaint && this.m_DebugPaintLayer,
debugRepaintRainbowEnabled: this.m_DebugPaint && this.m_DebugPaintLayer
);
}
void DebugPaintToggles(ref bool needUpdate) {
//GUI.skin.box
GUILayout.BeginArea(this._debugPaintTogglesRect, GUI.skin.box);
GUILayout.BeginVertical();
EditorGUI.BeginChangeCheck();
GUILayout.Space(4);
this.m_DebugPaintSize = GUILayout.Toggle(this.m_DebugPaintSize, new GUIContent("Paint Size"));
this.m_DebugPaintBaseline = GUILayout.Toggle(this.m_DebugPaintBaseline, new GUIContent("Paint Baseline"));
this.m_DebugPaintPointer = GUILayout.Toggle(this.m_DebugPaintPointer, new GUIContent("Paint Pointer"));
this.m_DebugPaintLayer = GUILayout.Toggle(this.m_DebugPaintLayer, new GUIContent("Paint Layer"));
if (EditorGUI.EndChangeCheck()) {
needUpdate = true;
}
GUILayout.EndVertical();
GUILayout.EndArea();
if (Event.current.type == EventType.MouseDown &&
!this._debugPaintTogglesRect.Contains(Event.current.mousePosition)) {
this.ScheduleUpdateAction(() => {
this.m_ShowDebugPaintToggles = false;
this.Repaint();
});
}
}
if (currentWindow != null && !currentWindow.alive) {
currentWindow = null;
}
var selectTitle = currentWindow != null ? currentWindow.titleContent : new GUIContent("<Please Select>");
if (GUILayout.Button(selectTitle, EditorStyles.toolbarDropDown)) {
var windows = new List<WindowAdapter>(WindowAdapter.windowAdapters.Where(w => {

this.m_Panels.Clear();
this.m_ShowInspect = false;
this.m_ShowDebugPaintToggles = false;
}
void ScheduleUpdateAction(Action action) {
this.m_UpdateActions.Add(action);
}
void Update() {

if (this.m_Panels.Count > 0) {
this.m_PanelStates = this.m_Panels.Select(p => p.PanelState).ToList();
}
while (this.m_UpdateActions.Count > 0) {
this.m_UpdateActions[0]();
this.m_UpdateActions.RemoveAt(0);
}
}

12
Runtime/editor/editor_window.cs


if (this._binding == null) {
this._binding = new WidgetsBinding();
}
WidgetsBinding.instance = this._binding;
return new WindowDisposable(this);

public override TextInput textInput {
get { return this._textInput; }
}
internal void _forceRepaint() {
using (this.getScope()) {
RenderObjectVisitor visitor = null;
visitor = (child) => {
child.markNeedsPaint();
child.visitChildren(visitor);
};
this._binding.renderView?.visitChildren(visitor);
}
}
}
}

68
Runtime/foundation/debug.cs


using System;
using System.Diagnostics;
using System.Linq;
using Unity.UIWidgets.editor;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using Debug = UnityEngine.Debug;

public static bool debugRepaintRainbowEnabled = false;
public static bool debugRepaintTextRainbowEnabled = false;
public static bool debugPaintLayerBordersEnabled = false;
public static bool debugPrintMarkNeedsLayoutStacks = false;

public static bool debugCheckIntrinsicSizes = false;
// public static Color debugCurrentRepaintColor = Color.fromfromAHSV(0.4, 60.0, 1.0, 1.0);;
public static HSVColor debugCurrentRepaintColor =
HSVColor.fromAHSV(0.4f, 60.0f, 1.0f, 1.0f);
// final Path path = new Path()
// ..fillType = PathFillType.evenOdd
// ..addRect(outerRect)
// ..addRect(innerRect);
// final Paint paint = new Paint()
// ..color = color;
// canvas.drawPath(path, paint);
Path path = new Path();
path.addRect(outerRect);
path.addRect(innerRect);
path.winding(PathWinding.clockwise);
var paint = new Paint {
color = color
};
canvas.drawPath(path, paint);
}
public static void debugPaintPadding(Canvas canvas, Rect outerRect, Rect innerRect, float outlineWidth = 2.0f) {

_debugDrawDoubleRect(canvas, innerRect.inflate(outlineWidth).intersect(outerRect), innerRect,
new Color(0xFF0090FF));
_debugDrawDoubleRect(canvas, innerRect.inflate(outlineWidth).intersect(outerRect), innerRect,
new Color(0xFF0090FF));
// canvas.drawRect(outerRect, BorderWidth.zero, BorderRadius.zero, paint);
canvas.drawRect(outerRect, paint);
public static void setDebugPaint(bool? debugPaintSizeEnabled = null,
bool? debugPaintBaselinesEnabled = null,
bool? debugPaintPointersEnabled= null,
bool? debugPaintLayerBordersEnabled = null,
bool? debugRepaintRainbowEnabled = null ) {
bool needRepaint = false;
if (debugPaintSizeEnabled != null && debugPaintSizeEnabled != D.debugPaintSizeEnabled) {
D.debugPaintSizeEnabled = debugPaintSizeEnabled.Value;
needRepaint = true;
}
if (debugPaintBaselinesEnabled != null && debugPaintBaselinesEnabled != D.debugPaintBaselinesEnabled) {
D.debugPaintBaselinesEnabled = debugPaintBaselinesEnabled.Value;
needRepaint = true;
}
if (debugPaintPointersEnabled != null && debugPaintPointersEnabled != D.debugPaintPointersEnabled) {
D.debugPaintPointersEnabled = debugPaintPointersEnabled.Value;
needRepaint = true;
}
if (debugPaintLayerBordersEnabled != null && debugPaintLayerBordersEnabled != D.debugPaintLayerBordersEnabled) {
D.debugPaintLayerBordersEnabled = debugPaintLayerBordersEnabled.Value;
needRepaint = true;
}
if (debugRepaintRainbowEnabled != null && debugRepaintRainbowEnabled != D.debugRepaintRainbowEnabled) {
D.debugRepaintRainbowEnabled = debugRepaintRainbowEnabled.Value;
needRepaint = true;
}
if (needRepaint) {
foreach (var adapter in WindowAdapter.windowAdapters) {
adapter._forceRepaint();
}
}
}
}
[Serializable]

return string.Join("\n", strippedLines);
}
}
}
}

2
Runtime/material/material.cs


public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new EnumProperty<MaterialType>("type", this.type));
properties.add(new FloatProperty("elevation", this.elevation, defaultValue: 0.0));
properties.add(new FloatProperty("elevation", this.elevation, defaultValue: 0.0f));
properties.add(new DiagnosticsProperty<Color>("color", this.color, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("shadowColor", this.shadowColor,
defaultValue: new Color(0xFF000000)));

99
Runtime/painting/colors.cs


using System.Collections.Generic;
using Unity.UIWidgets.foundation;
public class HSVColor {
HSVColor(float alpha, float hue, float saturation, float value) {
D.assert(this.alpha >= 0);
D.assert(this.alpha <= 1);
D.assert(hue >= 0);
D.assert(hue <= 360);
D.assert(saturation >= 0);
D.assert(saturation <= 1);
D.assert(value >= 0);
D.assert(value <= 1);
this.alpha = alpha;
this.hue = hue;
this.saturation = saturation;
this.value = value;
}
public static HSVColor fromAHSV(float alpha, float hue, float saturation, float value) {
return new HSVColor(alpha, hue, saturation, value);
}
public HSVColor withAlpha(float alpha) {
return fromAHSV(alpha, this.hue, this.saturation, this.value);
}
public HSVColor withHue(float hue) {
return fromAHSV(this.alpha, hue, this.saturation, this.value);
}
public HSVColor withSaturation(float saturation) {
return fromAHSV(this.alpha, this.hue, saturation, this.value);
}
public HSVColor withValue(float value) {
return fromAHSV(this.alpha, this.hue, this.saturation, value);
}
public Color toColor() {
float chroma = this.saturation * this.value;
float secondary = chroma * (1.0f - (((this.hue / 60.0f) % 2.0f) - 1.0f).abs());
float match = this.value - chroma;
return ColorUtils._colorFromHue(this.alpha, this.hue, chroma, secondary, match);
}
public readonly float alpha;
public readonly float hue;
public readonly float saturation;
public readonly float value;
}
public class ColorSwatch<T> : Color {
public ColorSwatch(
long primary,

public override string ToString() {
return this.GetType() + "(primary value: " + base.ToString() + ")";
}
}
public static class ColorUtils {
internal static Color _colorFromHue(
float alpha,
float hue,
float chroma,
float secondary,
float match
) {
float red;
float green;
float blue;
if (hue < 60.0) {
red = chroma;
green = secondary;
blue = 0.0f;
}
else if (hue < 120.0) {
red = secondary;
green = chroma;
blue = 0.0f;
}
else if (hue < 180.0) {
red = 0.0f;
green = chroma;
blue = secondary;
}
else if (hue < 240.0) {
red = 0.0f;
green = secondary;
blue = chroma;
}
else if (hue < 300.0) {
red = secondary;
green = 0.0f;
blue = chroma;
}
else {
red = chroma;
green = 0.0f;
blue = secondary;
}
return Color.fromARGB((alpha * 0xFF).round(),
((red + match) * 0xFF).round(),
((green + match) * 0xFF).round(), ((blue + match) * 0xFF).round());
}
}
}

56
Runtime/rendering/box.cs


D.assert(() => {
var paint = new Paint {
color = new Color(0xFF00FFFF),
strokeWidth = 1,
style = PaintingStyle.stroke,
// context.canvas.drawRect((offset & this.size).deflate(0.5),
// BorderWidth.all(1), BorderRadius.zero, paint);
context.canvas.drawRect((offset & this.size).deflate(0.5f), paint);
return true;
});
}

// final Paint paint = Paint()
// ..style = PaintingStyle.stroke
// ..strokeWidth = 0.25;
// Path path;
// // ideographic baseline
// final float baselineI = getDistanceToBaseline(TextBaseline.ideographic, onlyReal: true);
// if (baselineI != null) {
// paint.color = const Color (0xFFFFD000);
// path = Path();
// path.moveTo(offset.dx, offset.dy + baselineI);
// path.lineTo(offset.dx + size.width, offset.dy + baselineI);
// context.canvas.drawPath(path, paint);
// }
//
// // alphabetic baseline
// final float baselineA = getDistanceToBaseline(TextBaseline.alphabetic, onlyReal: true);
// if (baselineA != null) {
// paint.color = const Color (0xFF00FF00);
// path = Path();
// path.moveTo(offset.dx, offset.dy + baselineA);
// path.lineTo(offset.dx + size.width, offset.dy + baselineA);
// context.canvas.drawPath(path, paint);
// }
Paint paint = new Paint {
style = PaintingStyle.stroke,
strokeWidth = 0.25f
};
Path path;
// ideographic baseline
float? baselineI = this.getDistanceToBaseline(TextBaseline.ideographic, onlyReal: true);
if (baselineI != null) {
paint.color = new Color(0xFFFFD000);
path = new Path();
path.moveTo(offset.dx, offset.dy + baselineI.Value);
path.lineTo(offset.dx + this.size.width, offset.dy + baselineI.Value);
context.canvas.drawPath(path, paint);
}
// alphabetic baseline
float? baselineA = this.getDistanceToBaseline(TextBaseline.alphabetic, onlyReal: true);
if (baselineA != null) {
paint.color = new Color (0xFF00FF00);
path = new Path();
path.moveTo(offset.dx, offset.dy + baselineA.Value);
path.lineTo(offset.dx + this.size.width, offset.dy + baselineA.Value);
context.canvas.drawPath(path, paint);
}
return true;
});

var paint = new Paint {
color = new Color(0x00BBBB | ((0x04000000 * this.depth) & 0xFF000000)),
};
// context.canvas.drawRect(offset & this.size, BorderWidth.zero, BorderRadius.zero, paint);
context.canvas.drawRect(offset & this.size, paint);
}
return true;

2
Runtime/rendering/image.cs


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

22
Runtime/rendering/object.cs


D.assert(() => {
if (D.debugRepaintRainbowEnabled) {
// var Paint paint = Paint()
// ..style = PaintingStyle.stroke
// ..strokeWidth = 6.0
// ..color = debugCurrentRepaintColor.toColor();
// this.canvas.drawRect(this.estimatedBounds.deflate(3.0), paint);
var paint = new Paint {
style = PaintingStyle.stroke,
strokeWidth = 6.0f,
color = D.debugCurrentRepaintColor.toColor()
};
this.canvas.drawRect(this.estimatedBounds.deflate(3.0f), paint);
// final Paint paint = Paint()
// ..style = PaintingStyle.stroke
// ..strokeWidth = 1.0
// ..color = const Color(0xFFFF9800);
// this.canvas.drawRect(estimatedBounds, paint);
Paint paint = new Paint {
style = PaintingStyle.stroke,
strokeWidth = 1.0f,
color = new ui.Color(0xFFFF9800),
};
this.canvas.drawRect(this.estimatedBounds, paint);
}
return true;

2
Runtime/rendering/paragraph.cs


properties.add(new FlagProperty("softWrap", value: this.softWrap, ifTrue: "wrapping at box width",
ifFalse: "no wrapping except at line break characters", showName: true));
properties.add(new EnumProperty<TextOverflow>("overflow", this.overflow));
properties.add(new FloatProperty("textScaleFactor", this.textScaleFactor, defaultValue: 1.0));
properties.add(new FloatProperty("textScaleFactor", this.textScaleFactor, defaultValue: 1.0f));
properties.add(new IntProperty("maxLines", this.maxLines, ifNull: "unlimited"));
}
}

3
Runtime/rendering/proxy_box.cs


var paint = new Paint {
color = new Color(0x90909090)
};
// context.canvas.drawRect(offset & this.size, BorderWidth.zero, BorderRadius.zero, paint);
context.canvas.drawRect(offset & this.size, paint);
return true;
});
}

109
Runtime/rendering/shifted_box.cs


}
protected override void debugPaintSize(PaintingContext context, Offset offset) {
base.debugPaintSize(context, offset);
base.debugPaintSize(context, offset);
// Path path;
// paint = Paint()
// ..style = PaintingStyle.stroke
// ..strokeWidth = 1.0
// ..color = const Color(0xFFFFFF00);
// path = Path();
// final BoxParentData childParentData = child.parentData;
// if (childParentData.offset.dy > 0.0) {
// // vertical alignment arrows
// final float headSize = math.min(childParentData.offset.dy * 0.2, 10.0);
// path
// ..moveTo(offset.dx + size.width / 2.0, offset.dy)
// ..relativeLineTo(0.0, childParentData.offset.dy - headSize)
// ..relativeLineTo(headSize, 0.0)
// ..relativeLineTo(-headSize, headSize)
// ..relativeLineTo(-headSize, -headSize)
// ..relativeLineTo(headSize, 0.0)
// ..moveTo(offset.dx + size.width / 2.0, offset.dy + size.height)
// ..relativeLineTo(0.0, -childParentData.offset.dy + headSize)
// ..relativeLineTo(headSize, 0.0)
// ..relativeLineTo(-headSize, -headSize)
// ..relativeLineTo(-headSize, headSize)
// ..relativeLineTo(headSize, 0.0);
// context.canvas.drawPath(path, paint);
// }
// if (childParentData.offset.dx > 0.0) {
// // horizontal alignment arrows
// final float headSize = math.min(childParentData.offset.dx * 0.2, 10.0);
// path
// ..moveTo(offset.dx, offset.dy + size.height / 2.0)
// ..relativeLineTo(childParentData.offset.dx - headSize, 0.0)
// ..relativeLineTo(0.0, headSize)
// ..relativeLineTo(headSize, -headSize)
// ..relativeLineTo(-headSize, -headSize)
// ..relativeLineTo(0.0, headSize)
// ..moveTo(offset.dx + size.width, offset.dy + size.height / 2.0)
// ..relativeLineTo(-childParentData.offset.dx + headSize, 0.0)
// ..relativeLineTo(0.0, headSize)
// ..relativeLineTo(-headSize, -headSize)
// ..relativeLineTo(headSize, -headSize)
// ..relativeLineTo(0.0, headSize);
// context.canvas.drawPath(path, paint);
// }
}
else {
// paint = Paint()
// ..color = const Color(0x90909090);
// context.canvas.drawRect(offset & size, paint);
Path path;
paint = new Paint {
style = PaintingStyle.stroke,
strokeWidth = 1.0f,
color = new ui.Color(0xFFFFFF00)
};
BoxParentData childParentData = (BoxParentData) this.child.parentData;
if (childParentData.offset.dy > 0) {
float headSize = Mathf.Min(childParentData.offset.dy * 0.2f, 10.0f);
float x = offset.dx + this.size.width / 2.0f;
float y = offset.dy;
path = new Path();
path.moveTo(x, y);
path.lineTo(x += 0.0f, y += childParentData.offset.dy - headSize);
path.lineTo(x += headSize, y += 0.0f);
path.lineTo(x += -headSize, y += headSize);
path.lineTo(x += -headSize, y += -headSize);
path.lineTo(x += headSize, y += 0.0f);
x = offset.dx + this.size.width / 2.0f;
y = offset.dy + this.size.height;
path.moveTo(x, y);
path.lineTo(x += 0.0f, y += -childParentData.offset.dy + headSize);
path.lineTo(x += headSize, y += 0.0f);
path.lineTo(x += -headSize, y += -headSize);
path.lineTo(x += -headSize, y += headSize);
path.lineTo(x += headSize, y += 0.0f);
context.canvas.drawPath(path, paint);
}
if (childParentData.offset.dx > 0.0) {
float headSize = Mathf.Min(childParentData.offset.dx * 0.2f, 10.0f);
float x = offset.dx;
float y = offset.dy + this.size.height / 2.0f;
path = new Path();
path.moveTo(x, y);
path.lineTo(x += childParentData.offset.dx - headSize, y += 0.0f);
path.lineTo(x += 0.0f, y += headSize);
path.lineTo(x += headSize, y += -headSize);
path.lineTo(x += -headSize, y += -headSize);
path.lineTo(x += 0.0f, y += headSize);
path.moveTo(x = offset.dx + this.size.width, y = offset.dy + this.size.height / 2.0f);
path.lineTo(x += -childParentData.offset.dx + headSize, y += 0.0f);
path.lineTo(x += 0.0f, y += headSize);
path.lineTo(x += -headSize, y += -headSize);
path.lineTo(x += headSize, y += -headSize);
path.lineTo(x += 0.0f, y += headSize);
path.close();
context.canvas.drawPath(path, paint);
}
} else {
paint = new Paint {
color = new ui.Color(0x90909090),
};
context.canvas.drawRect(offset & this.size, paint);
}
return true;

7
Runtime/rendering/view.cs


}
D.assert(() => {
// if (D.debugRepaintRainbowEnabled || D.debugRepaintTextRainbowEnabled) {
// debugCurrentRepaintColor =
// debugCurrentRepaintColor.withHue((debugCurrentRepaintColor.hue + 2.0) % 360.0);
// }
if (D.debugRepaintRainbowEnabled || D.debugRepaintTextRainbowEnabled) {
D.debugCurrentRepaintColor = D.debugCurrentRepaintColor.withHue((D.debugCurrentRepaintColor.hue + 2.0f) % 360.0f);
}
return true;
});

7
Runtime/rendering/viewport.cs


base.debugPaintSize(context, offset);
Paint paint = new Paint {
color = new Color(0xFF00FF00)
color = new Color(0xFF00FF00),
strokeWidth = 1.0f,
style = PaintingStyle.stroke,
};
Canvas canvas = context.canvas;

}
D.assert(size != null);
// canvas.drawRect(((offset + this.paintOffsetOf(child)) & size).deflate(0.5),
// BorderWidth.all(1), BorderRadius.zero, paint);
canvas.drawRect(((offset + this.paintOffsetOf(child)) & size).deflate(0.5f), paint);
child = this.childAfter(child);
}

4
Runtime/widgets/basic.cs


properties.add(new FlagProperty("softWrap", value: this.softWrap, ifTrue: "wrapping at box width",
ifFalse: "no wrapping except at line break characters", showName: true));
properties.add(new EnumProperty<TextOverflow>("overflow", this.overflow, defaultValue: TextOverflow.clip));
properties.add(new FloatProperty("textScaleFactor", this.textScaleFactor, defaultValue: 1.0));
properties.add(new FloatProperty("textScaleFactor", this.textScaleFactor, defaultValue: 1.0f));
properties.add(new IntProperty("maxLines", this.maxLines, ifNull: "unlimited"));
properties.add(new StringProperty("text", this.text.toPlainText()));
}

properties.add(new DiagnosticsProperty<ui.Image>("image", this.image));
properties.add(new FloatProperty("width", this.width, defaultValue: Diagnostics.kNullDefaultValue));
properties.add(new FloatProperty("height", this.height, defaultValue: Diagnostics.kNullDefaultValue));
properties.add(new FloatProperty("scale", this.scale, defaultValue: 1.0));
properties.add(new FloatProperty("scale", this.scale, defaultValue: 1.0f));
properties.add(new DiagnosticsProperty<Color>("color", this.color,
defaultValue: Diagnostics.kNullDefaultValue));
properties.add(new EnumProperty<BlendMode>("colorBlendMode", this.colorBlendMode,

正在加载...
取消
保存