浏览代码

Merge branch 'master' of gitlab.cds.internal.unity3d.com:upm-packages/ui-widgets/com.unity.uiwidgets into material

/main
xingwei.zhu 6 年前
当前提交
7bc7de3c
共有 5 个文件被更改,包括 28 次插入25 次删除
  1. 20
      Runtime/painting/image_resolution.cs
  2. 10
      Runtime/rendering/custom_paint.cs
  3. 12
      Runtime/ui/painting/canvas_impl.cs
  4. 9
      Runtime/widgets/editable_text.cs
  5. 2
      Runtime/widgets/scrollbar.cs

20
Runtime/painting/image_resolution.cs


}
}
public class AssetImageConfiguration: IEquatable<AssetImageConfiguration> {
public class AssetImageConfiguration : IEquatable<AssetImageConfiguration> {
public readonly ImageConfiguration configuration;
public readonly string assetName;

}
public bool Equals(AssetImageConfiguration other) {
if (ReferenceEquals(null, other)) {
return false;

public override int GetHashCode() {
unchecked {
return ((this.configuration != null ? this.configuration.GetHashCode() : 0) * 397) ^ (this.assetName != null ? this.assetName.GetHashCode() : 0);
return ((this.configuration != null ? this.configuration.GetHashCode() : 0) * 397) ^
(this.assetName != null ? this.assetName.GetHashCode() : 0);
}
}

return !Equals(left, right);
}
}
public static AssetBundleCache instance => _instance;
readonly Dictionary<int, Dictionary<AssetImageConfiguration, AssetBundleImageKey>> _bundleCaches =
public static AssetBundleCache instance {
get { return _instance; }
}
readonly Dictionary<int, Dictionary<AssetImageConfiguration, AssetBundleImageKey>> _bundleCaches =
public Dictionary<AssetImageConfiguration, AssetBundleImageKey> get(AssetBundle bundle) {
Dictionary<AssetImageConfiguration, AssetBundleImageKey> result;
int id = bundle == null ? 0 : bundle.GetInstanceID();

result = new Dictionary<AssetImageConfiguration, AssetBundleImageKey>();
this._bundleCaches[id] = result;
return result;

10
Runtime/rendering/custom_paint.cs


bool shouldRepaint(CustomPainter oldDelegate);
bool hitTest(Offset position);
bool? hitTest(Offset position);
}
public abstract class AbstractCustomPainter : CustomPainter {

public abstract bool shouldRepaint(CustomPainter oldDelegate);
public virtual bool hitTest(Offset position) {
return true;
public virtual bool? hitTest(Offset position) {
return null;
}
public override string ToString() {

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

protected override bool hitTestSelf(Offset position) {
return this._painter != null && this._painter.hitTest(position);
return this._painter != null && (this._painter.hitTest(position) ?? true);
}
protected override void performResize() {

12
Runtime/ui/painting/canvas_impl.cs


var state = this._getState();
var mesh = ImageMeshGenerator.imageNineMesh(state.matrix, src, center, dst);
var mesh = ImageMeshGenerator.imageNineMesh(state.matrix, src, center, image.width, image.height, dst);
if (!this._applyClip(mesh.bounds)) {
return;

return new MeshMesh(matrix, vertices, _imageTriangles, uv);
}
public static MeshMesh imageNineMesh(Matrix3 matrix, Rect src, Rect center, Rect dst) {
public static MeshMesh imageNineMesh(Matrix3 matrix, Rect src, Rect center, int srcWidth, int srcHeight, Rect dst) {
float x1 = x0 + (float) ((center.left - src.left) * dst.width);
float x2 = x3 - (float) ((src.right - center.right) * dst.width);
float x1 = x0 + (float) ((center.left - src.left) * srcWidth);
float x2 = x3 - (float) ((src.right - center.right) * srcWidth);
float y1 = y0 + (float) ((center.top - src.top) * dst.height);
float y2 = y3 - (float) ((src.bottom - center.bottom) * dst.height);
float y1 = y0 + (float) ((center.top - src.top) * srcHeight);
float y2 = y3 - (float) ((src.bottom - center.bottom) * srcHeight);
float tx0 = (float) src.left;
float tx1 = (float) center.left;

9
Runtime/widgets/editable_text.cs


public readonly TextDirection? textDirection;
public readonly double textScaleFactor;
public readonly double? textScaleFactor;
public readonly Color cursorColor;

public EditableText(TextEditingController controller, FocusNode focusNode, TextStyle style,
Color cursorColor, bool obscureText = false, bool autocorrect = false,
TextAlign textAlign = TextAlign.left, TextDirection? textDirection = null,
double textScaleFactor = 1.0, int maxLines = 1,
double? textScaleFactor = null, int maxLines = 1,
bool autofocus = false, Color selectionColor = null, TextSelectionControls selectionControls = null,
ValueChanged<string> onChanged = null, VoidCallback onEditingComplete = null,
ValueChanged<string> onSubmitted = null, SelectionChangedCallback onSelectionChanged = null,

defaultValue: Diagnostics.kNullDefaultValue));
properties.add(new EnumProperty<TextDirection?>("textDirection", this.textDirection,
defaultValue: Diagnostics.kNullDefaultValue));
properties.add(new DiagnosticsProperty<double>("textScaleFactor", this.textScaleFactor,
properties.add(new DiagnosticsProperty<double?>("textScaleFactor", this.textScaleFactor,
defaultValue: Diagnostics.kNullDefaultValue));
properties.add(new DiagnosticsProperty<int>("maxLines", this.maxLines, defaultValue: 1));
properties.add(new DiagnosticsProperty<bool>("autofocus", this.autofocus, defaultValue: false));

hasFocus: this._hasFocus,
maxLines: this.widget.maxLines,
selectionColor: this.widget.selectionColor,
textScaleFactor: Window.instance
.devicePixelRatio, // todo widget.textScaleFactor ?? MediaQuery.textScaleFactorOf(context),
textScaleFactor: this.widget.textScaleFactor ?? MediaQuery.textScaleFactorOf(context),
textAlign: this.widget.textAlign,
textDirection: this._textDirection,
obscureText: this.widget.obscureText,

2
Runtime/widgets/scrollbar.cs


}
}
public bool hitTest(Offset position) {
public bool? hitTest(Offset position) {
return false;
}

正在加载...
取消
保存