kg
6 年前
当前提交
90ac4089
共有 9 个文件被更改,包括 246 次插入 和 98 次删除
-
31Assets/UIWidgets/Tests/RenderBoxes.cs
-
9Assets/UIWidgets/editor/editor_window.cs
-
68Assets/UIWidgets/painting/borders.cs
-
124Assets/UIWidgets/painting/box_border.cs
-
89Assets/UIWidgets/painting/box_decoration.cs
-
7Assets/UIWidgets/painting/box_shadow.cs
-
1Assets/UIWidgets/rendering/object.cs
-
10Assets/UIWidgets/rendering/proxy_box.cs
-
5Assets/UIWidgets/ui/painting/canvas_impl.cs
|
|||
namespace UIWidgets.painting { |
|||
public abstract class ShapeBorder { |
|||
public abstract EdgeInsets dimensions { get; } |
|||
using System; |
|||
using UIWidgets.ui; |
|||
|
|||
namespace UIWidgets.painting { |
|||
public class BorderSide : IEquatable<BorderSide> { |
|||
public BorderSide( |
|||
Color color = null, |
|||
double width = 1.0 |
|||
) { |
|||
this.color = color ?? new Color(0xFF000000); |
|||
this.width = width; |
|||
} |
|||
|
|||
public static BorderSide merge(BorderSide a, BorderSide b) { |
|||
return new BorderSide( |
|||
color: a.color, |
|||
width: a.width + b.width |
|||
); |
|||
} |
|||
|
|||
public readonly Color color; |
|||
public readonly double width; |
|||
|
|||
public static readonly BorderSide none = new BorderSide(width: 0.0); |
|||
|
|||
public BorderSide copyWith( |
|||
Color color = null, |
|||
double? width = null |
|||
) { |
|||
return new BorderSide( |
|||
color: color ?? this.color, |
|||
width: width ?? this.width |
|||
); |
|||
} |
|||
|
|||
public static bool canMerge(BorderSide a, BorderSide b) { |
|||
return a.color == b.color; |
|||
} |
|||
|
|||
public bool Equals(BorderSide other) { |
|||
if (object.ReferenceEquals(null, other)) return false; |
|||
if (object.ReferenceEquals(this, other)) return true; |
|||
return object.Equals(this.color, other.color) && this.width.Equals(other.width); |
|||
} |
|||
|
|||
public override bool Equals(object obj) { |
|||
if (object.ReferenceEquals(null, obj)) return false; |
|||
if (object.ReferenceEquals(this, obj)) return true; |
|||
if (obj.GetType() != this.GetType()) return false; |
|||
return this.Equals((BorderSide) obj); |
|||
} |
|||
|
|||
public override int GetHashCode() { |
|||
unchecked { |
|||
return ((this.color != null ? this.color.GetHashCode() : 0) * 397) ^ this.width.GetHashCode(); |
|||
} |
|||
} |
|||
|
|||
public static bool operator ==(BorderSide lhs, BorderSide rhs) { |
|||
return object.Equals(lhs, rhs); |
|||
} |
|||
|
|||
public static bool operator !=(BorderSide lhs, BorderSide rhs) { |
|||
return !(lhs == rhs); |
|||
} |
|||
} |
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue