kg
6 年前
当前提交
70c6b681
共有 42 个文件被更改,包括 2373 次插入 和 13 次删除
-
4.gitignore
-
10Assets/UIWidgets/foundation/node.cs
-
7Assets/UIWidgets/painting/box_border.cs
-
577Assets/UIWidgets/rendering/object.cs
-
11Assets/UIWidgets/ui/geometry.cs
-
74Assets/UIWidgets/ui/painting.cs
-
101Assets/UIWidgets/foundation/change_notifier.cs
-
3Assets/UIWidgets/foundation/change_notifier.cs.meta
-
64Assets/UIWidgets/foundation/observer_list.cs
-
3Assets/UIWidgets/foundation/observer_list.cs.meta
-
33Assets/UIWidgets/painting/basic_types.cs
-
3Assets/UIWidgets/painting/basic_types.cs.meta
-
12Assets/UIWidgets/painting/matrix_utils.cs
-
3Assets/UIWidgets/painting/matrix_utils.cs.meta
-
395Assets/UIWidgets/rendering/box.cs
-
3Assets/UIWidgets/rendering/box.cs.meta
-
233Assets/UIWidgets/rendering/layer.cs
-
3Assets/UIWidgets/rendering/layer.cs.meta
-
11Assets/UIWidgets/rendering/object.mixin.gen.cs.meta
-
231Assets/UIWidgets/rendering/object.mixin.njk
-
7Assets/UIWidgets/rendering/object.mixin.njk.meta
-
103Assets/UIWidgets/rendering/proxy_box.cs
-
3Assets/UIWidgets/rendering/proxy_box.cs.meta
-
11Assets/UIWidgets/rendering/proxy_box.mixin.gen.cs.meta
-
77Assets/UIWidgets/rendering/proxy_box.mixin.njk
-
3Assets/UIWidgets/rendering/proxy_box.mixin.njk.meta
-
11Assets/UIWidgets/rendering/sliver.cs
-
3Assets/UIWidgets/rendering/sliver.cs.meta
-
135Assets/UIWidgets/rendering/viewpoint.cs
-
3Assets/UIWidgets/rendering/viewpoint.cs.meta
-
29Assets/UIWidgets/rendering/viewport_offset.cs
-
3Assets/UIWidgets/rendering/viewport_offset.cs.meta
-
15Assets/UIWidgets/ui/compositing.cs
-
3Assets/UIWidgets/ui/compositing.cs.meta
-
6Assets/UIWidgets/ui/text.cs
-
3Assets/UIWidgets/ui/text.cs.meta
-
94scripts/cmds/codegen.js
-
73scripts/gitignore
-
16scripts/package.json
-
7scripts/uiwidgets-cli.js
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
|
|||
namespace UIWidgets.foundation { |
|||
public interface Listenable { |
|||
void addListener(VoidCallback listener); |
|||
|
|||
void removeListener(VoidCallback listener); |
|||
} |
|||
|
|||
public static class ListenableUtils { |
|||
public static Listenable merge(List<Listenable> listenables) { |
|||
return new _MergingListenable(listenables); |
|||
} |
|||
} |
|||
|
|||
public interface ValueListenable<T> : Listenable { |
|||
T value { get; } |
|||
} |
|||
|
|||
public class ChangeNotifier : Listenable { |
|||
public ObserverList<VoidCallback> _listeners = new ObserverList<VoidCallback>(); |
|||
|
|||
public bool hasListeners { |
|||
get { return this._listeners.Count > 0; } |
|||
} |
|||
|
|||
public void addListener(VoidCallback listener) { |
|||
this._listeners.Add(listener); |
|||
} |
|||
|
|||
public void removeListener(VoidCallback listener) { |
|||
this._listeners.Remove(listener); |
|||
} |
|||
|
|||
public virtual void dispose() { |
|||
this._listeners = null; |
|||
} |
|||
|
|||
public void notifyListeners() { |
|||
if (this._listeners != null) { |
|||
var localListeners = new List<VoidCallback>(this._listeners); |
|||
foreach (VoidCallback listener in localListeners) { |
|||
try { |
|||
if (this._listeners.Contains(listener)) { |
|||
listener(); |
|||
} |
|||
} |
|||
catch (Exception ex) { |
|||
Debug.LogError("error while dispatching notifications: " + ex); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
public class _MergingListenable : ChangeNotifier { |
|||
public _MergingListenable(List<Listenable> _children) { |
|||
this._children = _children; |
|||
|
|||
foreach (Listenable child in _children) { |
|||
if (child != null) { |
|||
child.addListener(this.notifyListeners); |
|||
} |
|||
} |
|||
} |
|||
|
|||
public readonly List<Listenable> _children; |
|||
|
|||
public override void dispose() { |
|||
foreach (Listenable child in this._children) { |
|||
if (child != null) { |
|||
child.removeListener(this.notifyListeners); |
|||
} |
|||
} |
|||
|
|||
base.dispose(); |
|||
} |
|||
} |
|||
|
|||
public class ValueNotifier<T> : ChangeNotifier, ValueListenable<T> { |
|||
public ValueNotifier(T value) { |
|||
this._value = value; |
|||
} |
|||
|
|||
public T value { |
|||
get { return this._value; } |
|||
set { |
|||
if (object.Equals(value, this._value)) { |
|||
return; |
|||
} |
|||
|
|||
this._value = value; |
|||
this.notifyListeners(); |
|||
} |
|||
} |
|||
|
|||
public T _value; |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: b6eab85d4579444c90cea2d7d68154a7 |
|||
timeCreated: 1534050460 |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
|
|||
namespace UIWidgets.foundation { |
|||
public class ObserverList<T> : ICollection<T> { |
|||
public readonly List<T> _list = new List<T>(); |
|||
public bool _isDirty = false; |
|||
public HashSet<T> _set = null; |
|||
|
|||
IEnumerator IEnumerable.GetEnumerator() { |
|||
return this.GetEnumerator(); |
|||
} |
|||
|
|||
public IEnumerator<T> GetEnumerator() { |
|||
return this._list.GetEnumerator(); |
|||
} |
|||
|
|||
public void Add(T item) { |
|||
this._isDirty = true; |
|||
this._list.Add(item); |
|||
} |
|||
|
|||
public void Clear() { |
|||
this._isDirty = true; |
|||
this._list.Clear(); |
|||
} |
|||
|
|||
public bool Contains(T item) { |
|||
if (this._list.Count < 3) { |
|||
return this._list.Contains(item); |
|||
} |
|||
|
|||
if (this._isDirty) { |
|||
if (this._set == null) { |
|||
this._set = new HashSet<T>(this._list); |
|||
} else { |
|||
this._set.Clear(); |
|||
this._set.UnionWith(this._list); |
|||
} |
|||
|
|||
this._isDirty = false; |
|||
} |
|||
|
|||
return this._set.Contains(item); |
|||
} |
|||
|
|||
public void CopyTo(T[] array, int arrayIndex) { |
|||
this._list.CopyTo(array, arrayIndex); |
|||
} |
|||
|
|||
public bool Remove(T item) { |
|||
this._isDirty = true; |
|||
return this._list.Remove(item); |
|||
} |
|||
|
|||
public int Count { |
|||
get { return this._list.Count; } |
|||
} |
|||
|
|||
public bool IsReadOnly { |
|||
get { return false; } |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: abc157b09ab5425dbdad92fad9bdfc4d |
|||
timeCreated: 1534050868 |
|
|||
using System; |
|||
using System.ComponentModel; |
|||
|
|||
namespace UIWidgets.painting { |
|||
public enum AxisDirection { |
|||
up, |
|||
right, |
|||
down, |
|||
left, |
|||
} |
|||
|
|||
public enum Axis { |
|||
horizontal, |
|||
vertical, |
|||
} |
|||
|
|||
public static class AxisUtils { |
|||
public static Axis axisDirectionToAxis(AxisDirection axisDirection) { |
|||
switch (axisDirection) { |
|||
case AxisDirection.up: |
|||
case AxisDirection.down: |
|||
return Axis.vertical; |
|||
case AxisDirection.left: |
|||
case AxisDirection.right: |
|||
return Axis.horizontal; |
|||
} |
|||
|
|||
throw new Exception("unknown axisDirection"); |
|||
} |
|||
|
|||
|
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 979995af3be3441bb7b91f7f732dad0a |
|||
timeCreated: 1534049827 |
|
|||
using UIWidgets.ui; |
|||
using UnityEngine; |
|||
|
|||
namespace UIWidgets.painting { |
|||
public class MatrixUtils { |
|||
public static Offset transformPoint(Matrix4x4 transform, Offset point) { |
|||
var position3 = new Vector3((float) point.dx, (float) point.dy, 0); |
|||
var transformed3 = transform.MultiplyPoint(position3); |
|||
return new Offset(transformed3.x, transformed3.y); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: a5c132e5f9af4c8ba6b46fc4d9ec32a0 |
|||
timeCreated: 1534149883 |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using UIWidgets.painting; |
|||
using UIWidgets.ui; |
|||
using UnityEngine; |
|||
using Rect = UIWidgets.ui.Rect; |
|||
|
|||
namespace UIWidgets.rendering { |
|||
public class BoxConstraints : Constraints { |
|||
public BoxConstraints( |
|||
double minWidth = 0.0, |
|||
double maxWidth = double.PositiveInfinity, |
|||
double minHeight = 0.0, |
|||
double maxHeight = double.PositiveInfinity) { |
|||
this.minWidth = minWidth; |
|||
this.maxWidth = maxWidth; |
|||
this.minHeight = minHeight; |
|||
this.maxHeight = maxHeight; |
|||
} |
|||
|
|||
public readonly double minWidth; |
|||
public readonly double maxWidth; |
|||
public readonly double minHeight; |
|||
public readonly double maxHeight; |
|||
|
|||
public static BoxConstraints tight(Size size) { |
|||
return new BoxConstraints( |
|||
size.width, |
|||
size.width, |
|||
size.height, |
|||
size.height |
|||
); |
|||
} |
|||
|
|||
public BoxConstraints widthConstraints() { |
|||
return new BoxConstraints(minWidth: this.minWidth, maxWidth: this.maxWidth); |
|||
} |
|||
|
|||
public BoxConstraints heightConstraints() { |
|||
return new BoxConstraints(minHeight: this.minHeight, maxHeight: this.maxHeight); |
|||
} |
|||
|
|||
public double constrainWidth(double width = double.PositiveInfinity) { |
|||
return Mathf.Clamp((float) width, (float) this.minWidth, (float) this.maxWidth); |
|||
} |
|||
|
|||
public double constrainHeight(double height = double.PositiveInfinity) { |
|||
return Mathf.Clamp((float) height, (float) this.minHeight, (float) this.maxHeight); |
|||
} |
|||
|
|||
public Size constrain(Size size) { |
|||
return new Size(this.constrainWidth(size.width), this.constrainHeight(size.height)); |
|||
} |
|||
|
|||
public Size constrainDimensions(double width, double height) { |
|||
return new Size(this.constrainWidth(width), this.constrainHeight(height)); |
|||
} |
|||
|
|||
public Size constrainSizeAndAttemptToPreserveAspectRatio(Size size) { |
|||
if (this.isTight) { |
|||
Size result = this.smallest; |
|||
return result; |
|||
} |
|||
|
|||
double width = size.width; |
|||
double height = size.height; |
|||
double aspectRatio = width / height; |
|||
|
|||
if (width > this.maxWidth) { |
|||
width = this.maxWidth; |
|||
height = width / aspectRatio; |
|||
} |
|||
|
|||
if (height > this.maxHeight) { |
|||
height = this.maxHeight; |
|||
width = height * aspectRatio; |
|||
} |
|||
|
|||
if (width < this.minWidth) { |
|||
width = this.minWidth; |
|||
height = width / aspectRatio; |
|||
} |
|||
|
|||
if (height < this.minHeight) { |
|||
height = this.minHeight; |
|||
width = height * aspectRatio; |
|||
} |
|||
|
|||
return new Size(this.constrainWidth(width), this.constrainHeight(height)); |
|||
} |
|||
|
|||
public Size biggest { |
|||
get { return new Size(this.constrainWidth(), this.constrainHeight()); } |
|||
} |
|||
|
|||
public Size smallest { |
|||
get { return new Size(this.constrainWidth(0.0), this.constrainHeight(0.0)); } |
|||
} |
|||
|
|||
public bool hasTightWidth { |
|||
get { return this.minWidth >= this.maxWidth; } |
|||
} |
|||
|
|||
public bool hasTightHeight { |
|||
get { return this.minHeight >= this.maxHeight; } |
|||
} |
|||
|
|||
public override bool isTight { |
|||
get { return this.hasTightWidth && this.hasTightHeight; } |
|||
} |
|||
|
|||
public bool hasBoundedWidth { |
|||
get { return this.minWidth < double.PositiveInfinity; } |
|||
} |
|||
|
|||
public bool hasBoundedHeight { |
|||
get { return this.minHeight < double.PositiveInfinity; } |
|||
} |
|||
|
|||
public bool hasInfiniteWidth { |
|||
get { return this.minWidth >= double.PositiveInfinity; } |
|||
} |
|||
|
|||
public bool hasInfiniteHeight { |
|||
get { return this.minHeight >= double.PositiveInfinity; } |
|||
} |
|||
|
|||
public bool isSatisfiedBy(Size size) { |
|||
return this.minWidth <= size.width && size.width <= this.maxWidth && |
|||
this.minHeight <= size.height && size.height <= this.maxHeight; |
|||
} |
|||
|
|||
public override bool isNormalized { |
|||
get { |
|||
return this.minWidth >= 0.0 && |
|||
this.minWidth <= this.maxWidth && |
|||
this.minHeight >= 0.0 && |
|||
this.minHeight <= this.maxHeight; |
|||
} |
|||
} |
|||
|
|||
public BoxConstraints normalize() { |
|||
if (this.isNormalized) { |
|||
return this; |
|||
} |
|||
|
|||
var minWidth = this.minWidth >= 0.0 ? this.minWidth : 0.0; |
|||
var minHeight = this.minHeight >= 0.0 ? this.minHeight : 0.0; |
|||
|
|||
return new BoxConstraints( |
|||
minWidth, |
|||
minWidth > this.maxWidth ? minWidth : this.maxWidth, |
|||
minHeight, |
|||
minHeight > this.maxHeight ? minHeight : this.maxHeight |
|||
); |
|||
} |
|||
|
|||
protected bool Equals(BoxConstraints other) { |
|||
return this.minWidth.Equals(other.minWidth) |
|||
&& this.maxWidth.Equals(other.maxWidth) |
|||
&& this.minHeight.Equals(other.minHeight) |
|||
&& this.maxHeight.Equals(other.maxHeight); |
|||
} |
|||
|
|||
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((BoxConstraints) obj); |
|||
} |
|||
|
|||
public override int GetHashCode() { |
|||
unchecked { |
|||
var hashCode = this.minWidth.GetHashCode(); |
|||
hashCode = (hashCode * 397) ^ this.maxWidth.GetHashCode(); |
|||
hashCode = (hashCode * 397) ^ this.minHeight.GetHashCode(); |
|||
hashCode = (hashCode * 397) ^ this.maxHeight.GetHashCode(); |
|||
return hashCode; |
|||
} |
|||
} |
|||
|
|||
public static bool operator ==(BoxConstraints a, BoxConstraints b) { |
|||
return object.Equals(a, b); |
|||
} |
|||
|
|||
public static bool operator !=(BoxConstraints a, BoxConstraints b) { |
|||
return !(a == b); |
|||
} |
|||
} |
|||
|
|||
public class BoxParentData : ParentData { |
|||
public Offset offset = Offset.zero; |
|||
} |
|||
|
|||
public enum _IntrinsicDimension { |
|||
minWidth, |
|||
maxWidth, |
|||
minHeight, |
|||
maxHeight |
|||
} |
|||
|
|||
public class _IntrinsicDimensionsCacheEntry : IEquatable<_IntrinsicDimensionsCacheEntry> { |
|||
public _IntrinsicDimensionsCacheEntry(_IntrinsicDimension dimension, double argument) { |
|||
this.dimension = dimension; |
|||
this.argument = argument; |
|||
} |
|||
|
|||
public readonly _IntrinsicDimension dimension; |
|||
public readonly double argument; |
|||
|
|||
public bool Equals(_IntrinsicDimensionsCacheEntry other) { |
|||
if (object.ReferenceEquals(null, other)) return false; |
|||
if (object.ReferenceEquals(this, other)) return true; |
|||
return this.dimension == other.dimension && this.argument.Equals(other.argument); |
|||
} |
|||
|
|||
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((_IntrinsicDimensionsCacheEntry) obj); |
|||
} |
|||
|
|||
public override int GetHashCode() { |
|||
unchecked { |
|||
return ((int) this.dimension * 397) ^ this.argument.GetHashCode(); |
|||
} |
|||
} |
|||
|
|||
public static bool operator ==(_IntrinsicDimensionsCacheEntry a, _IntrinsicDimensionsCacheEntry b) { |
|||
return object.Equals(a, b); |
|||
} |
|||
|
|||
public static bool operator !=(_IntrinsicDimensionsCacheEntry a, _IntrinsicDimensionsCacheEntry b) { |
|||
return !(a == b); |
|||
} |
|||
} |
|||
|
|||
public abstract class RenderBox : RenderObject { |
|||
public override void setupParentData(RenderObject child) { |
|||
if (!(child.parentData is BoxParentData)) { |
|||
child.parentData = new BoxParentData(); |
|||
} |
|||
} |
|||
|
|||
public Dictionary<_IntrinsicDimensionsCacheEntry, double> _cachedIntrinsicDimensions; |
|||
|
|||
public double _computeIntrinsicDimension(_IntrinsicDimension dimension, double argument, |
|||
Func<double, double> computer) { |
|||
if (this._cachedIntrinsicDimensions == null) { |
|||
this._cachedIntrinsicDimensions = new Dictionary<_IntrinsicDimensionsCacheEntry, double>(); |
|||
} |
|||
|
|||
var key = new _IntrinsicDimensionsCacheEntry(dimension, argument); |
|||
|
|||
double result; |
|||
if (this._cachedIntrinsicDimensions.TryGetValue(key, out result)) { |
|||
return result; |
|||
} |
|||
|
|||
return this._cachedIntrinsicDimensions[key] = computer(argument); |
|||
} |
|||
|
|||
public double getMinIntrinsicWidth(double height) { |
|||
return this._computeIntrinsicDimension(_IntrinsicDimension.minWidth, height, this.computeMinIntrinsicWidth); |
|||
} |
|||
|
|||
public virtual double computeMinIntrinsicWidth(double height) { |
|||
return 0.0; |
|||
} |
|||
|
|||
public double getMaxIntrinsicWidth(double height) { |
|||
return this._computeIntrinsicDimension(_IntrinsicDimension.maxWidth, height, this.computeMaxIntrinsicWidth); |
|||
} |
|||
|
|||
public virtual double computeMaxIntrinsicWidth(double height) { |
|||
return 0.0; |
|||
} |
|||
|
|||
public double getMinIntrinsicHeight(double width) { |
|||
return this._computeIntrinsicDimension(_IntrinsicDimension.minHeight, width, |
|||
this.computeMinIntrinsicHeight); |
|||
} |
|||
|
|||
public virtual double computeMinIntrinsicHeight(double width) { |
|||
return 0.0; |
|||
} |
|||
|
|||
public double getMaxIntrinsicHeight(double width) { |
|||
return this._computeIntrinsicDimension(_IntrinsicDimension.maxHeight, width, |
|||
this.computeMaxIntrinsicHeight); |
|||
} |
|||
|
|||
public virtual double computeMaxIntrinsicHeight(double width) { |
|||
return 0.0; |
|||
} |
|||
|
|||
public bool hasSize { |
|||
get { return this._size != null; } |
|||
} |
|||
|
|||
public Size size { |
|||
get { return this._size; } |
|||
set { this._size = value; } |
|||
} |
|||
|
|||
public Size _size; |
|||
|
|||
public Dictionary<TextBaseline, double?> _cachedBaselines; |
|||
|
|||
public double? getDistanceToBaseline(TextBaseline baseline, bool onlyReal = false) { |
|||
double? result = this.getDistanceToActualBaseline(baseline); |
|||
if (result == null && !onlyReal) { |
|||
return this.size.height; |
|||
} |
|||
|
|||
return result; |
|||
} |
|||
|
|||
public double? getDistanceToActualBaseline(TextBaseline baseline) { |
|||
if (this._cachedBaselines == null) { |
|||
this._cachedBaselines = new Dictionary<TextBaseline, double?>(); |
|||
} |
|||
|
|||
double? result; |
|||
if (this._cachedBaselines.TryGetValue(baseline, out result)) { |
|||
return result; |
|||
} |
|||
|
|||
return this._cachedBaselines[baseline] = this.computeDistanceToActualBaseline(baseline); |
|||
} |
|||
|
|||
public virtual double? computeDistanceToActualBaseline(TextBaseline baseline) { |
|||
return null; |
|||
} |
|||
|
|||
public new BoxConstraints constraints { |
|||
get { return (BoxConstraints) base.constraints; } |
|||
} |
|||
|
|||
public override void markNeedsLayout() { |
|||
if (this._cachedBaselines != null && this._cachedBaselines.Count > 0 || |
|||
this._cachedIntrinsicDimensions != null && this._cachedIntrinsicDimensions.Count > 0) { |
|||
if (this._cachedBaselines != null) { |
|||
this._cachedBaselines.Clear(); |
|||
} |
|||
|
|||
if (this._cachedIntrinsicDimensions != null) { |
|||
this._cachedIntrinsicDimensions.Clear(); |
|||
} |
|||
|
|||
if (this.parent is RenderObject) { |
|||
this.markParentNeedsLayout(); |
|||
return; |
|||
} |
|||
} |
|||
|
|||
base.markNeedsLayout(); |
|||
} |
|||
|
|||
|
|||
public override void performResize() { |
|||
this.size = this.constraints.smallest; |
|||
} |
|||
|
|||
public override void performLayout() { |
|||
} |
|||
|
|||
public override void applyPaintTransform(RenderObject child, Matrix4x4 transform) { |
|||
var childParentData = (BoxParentData) child.parentData; |
|||
var offset = childParentData.offset; |
|||
transform.SetTRS(new Vector2((float) offset.dx, (float) offset.dy), Quaternion.identity, Vector3.one); |
|||
} |
|||
|
|||
public Offset globalToLocal(Offset point, RenderObject ancestor = null) { |
|||
var transform = this.getTransformTo(ancestor); |
|||
var det = transform.determinant; |
|||
if (det == 0f) { |
|||
return Offset.zero; |
|||
} |
|||
|
|||
transform = transform.inverse; |
|||
return MatrixUtils.transformPoint(transform, point); |
|||
} |
|||
|
|||
|
|||
public Offset localToGlobal(Offset point, RenderObject ancestor = null) { |
|||
return MatrixUtils.transformPoint(this.getTransformTo(ancestor), point); |
|||
} |
|||
|
|||
public override Rect paintBounds { |
|||
get { return Offset.zero & this.size; } |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 6e883eb5b6464bd4ad3a8e61da880f3a |
|||
timeCreated: 1533893883 |
|
|||
using UIWidgets.foundation; |
|||
using UIWidgets.ui; |
|||
|
|||
namespace UIWidgets.rendering { |
|||
public abstract class Layer : AbstractNode { |
|||
public new ContainerLayer parent { |
|||
get { return (ContainerLayer) base.parent; } |
|||
} |
|||
|
|||
public Layer nextSibling { |
|||
get { return this._nextSibling; } |
|||
} |
|||
|
|||
public Layer _nextSibling; |
|||
|
|||
|
|||
public Layer previousSibling { |
|||
get { return this._previousSibling; } |
|||
} |
|||
|
|||
public Layer _previousSibling; |
|||
|
|||
public virtual void remove() { |
|||
if (this.parent != null) { |
|||
this.parent._removeChild(this); |
|||
} |
|||
} |
|||
|
|||
public void replaceWith(Layer newLayer) { |
|||
newLayer._nextSibling = this.nextSibling; |
|||
if (this._nextSibling != null) { |
|||
this._nextSibling._previousSibling = newLayer; |
|||
} |
|||
|
|||
newLayer._previousSibling = this.previousSibling; |
|||
if (this._previousSibling != null) { |
|||
this._previousSibling._nextSibling = newLayer; |
|||
} |
|||
|
|||
this.parent.adoptChild(newLayer); |
|||
if (this.parent.firstChild == this) { |
|||
this.parent._firstChild = newLayer; |
|||
} |
|||
|
|||
if (this.parent.lastChild == this) { |
|||
this.parent._lastChild = newLayer; |
|||
} |
|||
|
|||
this._nextSibling = null; |
|||
this._previousSibling = null; |
|||
this.parent.dropChild(this); |
|||
} |
|||
|
|||
public abstract S find<S>(Offset regionOffset); |
|||
|
|||
public abstract void addToScene(SceneBuilder builder, Offset layerOffset); |
|||
} |
|||
|
|||
public class PictureLayer : Layer { |
|||
public Picture picture; |
|||
|
|||
public override S find<S>(Offset regionOffset) { |
|||
return default(S); |
|||
} |
|||
|
|||
public override void addToScene(SceneBuilder builder, Offset layerOffset) { |
|||
builder.addPicture(layerOffset, this.picture); |
|||
} |
|||
} |
|||
|
|||
public class ContainerLayer : Layer { |
|||
public Layer firstChild { |
|||
get { return this._firstChild; } |
|||
} |
|||
|
|||
public Layer _firstChild; |
|||
|
|||
public Layer lastChild { |
|||
get { return this._lastChild; } |
|||
} |
|||
|
|||
public Layer _lastChild; |
|||
|
|||
public override S find<S>(Offset regionOffset) { |
|||
Layer current = this.lastChild; |
|||
while (current != null) { |
|||
var value = current.find<S>(regionOffset); |
|||
if (value != null) { |
|||
return value; |
|||
} |
|||
|
|||
current = current.previousSibling; |
|||
} |
|||
|
|||
return default(S); |
|||
} |
|||
|
|||
public override void attach(object owner) { |
|||
base.attach(owner); |
|||
|
|||
var child = this.firstChild; |
|||
while (child != null) { |
|||
child.attach(owner); |
|||
child = child.nextSibling; |
|||
} |
|||
} |
|||
|
|||
public override void detach() { |
|||
base.detach(); |
|||
|
|||
var child = this.firstChild; |
|||
while (child != null) { |
|||
child.detach(); |
|||
child = child.nextSibling; |
|||
} |
|||
} |
|||
|
|||
public void append(Layer child) { |
|||
this.adoptChild(child); |
|||
child._previousSibling = this.lastChild; |
|||
if (this.lastChild != null) { |
|||
this.lastChild._nextSibling = child; |
|||
} |
|||
|
|||
this._lastChild = child; |
|||
if (this._firstChild == null) { |
|||
this._firstChild = child; |
|||
} |
|||
} |
|||
|
|||
public void _removeChild(Layer child) { |
|||
if (child._previousSibling == null) { |
|||
this._firstChild = child.nextSibling; |
|||
} else { |
|||
child._previousSibling._nextSibling = child.nextSibling; |
|||
} |
|||
|
|||
if (child._nextSibling == null) { |
|||
this._lastChild = child.previousSibling; |
|||
} else { |
|||
child._nextSibling._previousSibling = child.previousSibling; |
|||
} |
|||
|
|||
child._nextSibling = null; |
|||
child._previousSibling = null; |
|||
this.dropChild(child); |
|||
} |
|||
|
|||
public void removeAllChildren() { |
|||
Layer child = this.firstChild; |
|||
while (child != null) { |
|||
Layer next = child.nextSibling; |
|||
child._previousSibling = null; |
|||
child._nextSibling = null; |
|||
this.dropChild(child); |
|||
child = next; |
|||
} |
|||
|
|||
this._firstChild = null; |
|||
this._lastChild = null; |
|||
} |
|||
|
|||
public override void addToScene(SceneBuilder builder, Offset layerOffset) { |
|||
this.addChildrenToScene(builder, layerOffset); |
|||
} |
|||
|
|||
public void addChildrenToScene(SceneBuilder builder, Offset childOffset) { |
|||
Layer child = this.firstChild; |
|||
while (child != null) { |
|||
child.addToScene(builder, childOffset); |
|||
child = child.nextSibling; |
|||
} |
|||
} |
|||
|
|||
public virtual void applyTransform(Layer child, UnityEngine.Matrix4x4 transform) { |
|||
} |
|||
} |
|||
|
|||
public class OffsetLayer : ContainerLayer { |
|||
public OffsetLayer(Offset offset = null) { |
|||
this.offset = offset ?? Offset.zero; |
|||
} |
|||
|
|||
public Offset offset; |
|||
|
|||
public override S find<S>(Offset regionOffset) { |
|||
return base.find<S>(regionOffset - this.offset); |
|||
} |
|||
|
|||
public override void addToScene(SceneBuilder builder, Offset layerOffset) { |
|||
this.addChildrenToScene(builder, this.offset + layerOffset); |
|||
} |
|||
} |
|||
|
|||
public class ClipRectLayer : ContainerLayer { |
|||
public ClipRectLayer(Rect clipRect) { |
|||
this.clipRect = clipRect; |
|||
} |
|||
|
|||
public Rect clipRect; |
|||
|
|||
public override S find<S>(Offset regionOffset) { |
|||
if (!this.clipRect.contains(regionOffset)) { |
|||
return default(S); |
|||
} |
|||
|
|||
return base.find<S>(regionOffset); |
|||
} |
|||
|
|||
public override void addToScene(SceneBuilder builder, Offset layerOffset) { |
|||
builder.pushClipRect(this.clipRect.shift(layerOffset)); |
|||
this.addChildrenToScene(builder, layerOffset); |
|||
builder.pop(); |
|||
} |
|||
} |
|||
|
|||
public class TransformLayer : OffsetLayer { |
|||
} |
|||
|
|||
public class OpacityLayer : ContainerLayer { |
|||
public OpacityLayer(int alpha) { |
|||
this.alpha = alpha; |
|||
} |
|||
|
|||
public int alpha; |
|||
|
|||
public override void addToScene(SceneBuilder builder, Offset layerOffset) { |
|||
builder.pushOpacity(this.alpha); |
|||
this.addChildrenToScene(builder, layerOffset); |
|||
builder.pop(); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: f3491a508e094c1caeaff938e233a914 |
|||
timeCreated: 1534131134 |
|
|||
fileFormatVersion: 2 |
|||
guid: b71787cfc1b1b480c95430f2a21d3ea2 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
// AUTO-GENERATED, DO NOT EDIT BY HAND |
|||
|
|||
using System.Collections.Generic; |
|||
using UIWidgets.foundation; |
|||
using UnityEngine; |
|||
|
|||
namespace UIWidgets.rendering { |
|||
{% macro ContainerRenderObjectMixin(with) %} |
|||
public class Container{{with}}<ChildType, ParentDataType> : {{with}} |
|||
where ChildType : RenderObject |
|||
where ParentDataType : ContainerParentDataMixin<ChildType> { |
|||
public int _childCount = 0; |
|||
|
|||
public int countCount { |
|||
get { return this._childCount; } |
|||
} |
|||
|
|||
public ChildType _firstChild; |
|||
public ChildType _lastChild; |
|||
|
|||
public void _insertIntoChildList(ChildType child, ChildType after = null) { |
|||
var childParentData = (ParentDataType) child.parentData; |
|||
this._childCount++; |
|||
if (after == null) { |
|||
childParentData.nextSibling = this._firstChild; |
|||
if (this._firstChild != null) { |
|||
var firstChildParentData = (ParentDataType) this._firstChild.parentData; |
|||
firstChildParentData.previousSibling = child; |
|||
} |
|||
|
|||
this._firstChild = child; |
|||
if (this._lastChild == null) { |
|||
this._lastChild = child; |
|||
} |
|||
} else { |
|||
var afterParentData = (ParentDataType) after.parentData; |
|||
if (afterParentData.nextSibling == null) { |
|||
childParentData.previousSibling = after; |
|||
afterParentData.nextSibling = child; |
|||
this._lastChild = child; |
|||
} else { |
|||
childParentData.nextSibling = afterParentData.nextSibling; |
|||
childParentData.previousSibling = after; |
|||
var childPreviousSiblingParentData = (ParentDataType) childParentData.previousSibling.parentData; |
|||
var childNextSiblingParentData = (ParentDataType) childParentData.nextSibling.parentData; |
|||
childPreviousSiblingParentData.nextSibling = child; |
|||
childNextSiblingParentData.previousSibling = child; |
|||
} |
|||
} |
|||
} |
|||
|
|||
public void insert(ChildType child, ChildType after = null) { |
|||
this.adoptChild(child); |
|||
this._insertIntoChildList(child, after); |
|||
} |
|||
|
|||
public void add(ChildType child) { |
|||
this.insert(child, this._lastChild); |
|||
} |
|||
|
|||
public void addAll(List<ChildType> children) { |
|||
if (children != null) { |
|||
children.ForEach(this.add); |
|||
} |
|||
} |
|||
|
|||
public void _removeFromChildList(ChildType child) { |
|||
var childParentData = (ParentDataType) child.parentData; |
|||
|
|||
if (childParentData.previousSibling == null) { |
|||
this._firstChild = childParentData.nextSibling; |
|||
} else { |
|||
var childPreviousSiblingParentData = (ParentDataType) childParentData.previousSibling.parentData; |
|||
childPreviousSiblingParentData.nextSibling = childParentData.nextSibling; |
|||
} |
|||
|
|||
if (childParentData.nextSibling == null) { |
|||
this._lastChild = childParentData.previousSibling; |
|||
} else { |
|||
var childNextSiblingParentData = (ParentDataType) childParentData.nextSibling.parentData; |
|||
childNextSiblingParentData.previousSibling = childParentData.previousSibling; |
|||
} |
|||
|
|||
childParentData.previousSibling = null; |
|||
childParentData.nextSibling = null; |
|||
this._childCount--; |
|||
} |
|||
|
|||
public void remove(ChildType child) { |
|||
this._removeFromChildList(child); |
|||
this.dropChild(child); |
|||
} |
|||
|
|||
public void removeAll() { |
|||
ChildType child = this._firstChild; |
|||
while (child != null) { |
|||
var childParentData = (ParentDataType) child.parentData; |
|||
var next = childParentData.nextSibling; |
|||
childParentData.previousSibling = null; |
|||
childParentData.nextSibling = null; |
|||
this.dropChild(child); |
|||
child = next; |
|||
} |
|||
this._firstChild = null; |
|||
this._lastChild = null; |
|||
this._childCount = 0; |
|||
} |
|||
|
|||
public void move(ChildType child, ChildType after = null) { |
|||
var childParentData = (ParentDataType) child.parentData; |
|||
if (childParentData.previousSibling == after) { |
|||
return; |
|||
} |
|||
|
|||
this._removeFromChildList(child); |
|||
this._insertIntoChildList(child, after); |
|||
// this.markNeedsLayout(); |
|||
} |
|||
|
|||
public override void attach(object owner) { |
|||
base.attach(owner); |
|||
ChildType child = this._firstChild; |
|||
while (child != null) { |
|||
child.attach(owner); |
|||
var childParentData = (ParentDataType) child.parentData; |
|||
child = childParentData.nextSibling; |
|||
} |
|||
} |
|||
|
|||
public override void detach() { |
|||
base.detach(); |
|||
ChildType child = this._firstChild; |
|||
while (child != null) { |
|||
child.detach(); |
|||
var childParentData = (ParentDataType) child.parentData; |
|||
child = childParentData.nextSibling; |
|||
} |
|||
} |
|||
|
|||
public override void redepthChildren() { |
|||
ChildType child = this._firstChild; |
|||
while (child != null) { |
|||
this.redepthChild(child); |
|||
var childParentData = (ParentDataType) child.parentData; |
|||
child = childParentData.nextSibling; |
|||
} |
|||
} |
|||
|
|||
public override void vivitChildren(RenderObjectVisitor visitor) { |
|||
ChildType child = this._firstChild; |
|||
while (child != null) { |
|||
visitor(child); |
|||
var childParentData = (ParentDataType) child.parentData; |
|||
child = childParentData.nextSibling; |
|||
} |
|||
} |
|||
|
|||
public ChildType firstChild { |
|||
get { return this._firstChild; } |
|||
} |
|||
|
|||
public ChildType lastChild { |
|||
get { return this._lastChild; } |
|||
} |
|||
|
|||
public ChildType childBefore(ChildType child) { |
|||
var childParentData = (ParentDataType) child.parentData; |
|||
return childParentData.previousSibling; |
|||
} |
|||
|
|||
public ChildType childAfter(ChildType child) { |
|||
var childParentData = (ParentDataType) child.parentData; |
|||
return childParentData.nextSibling; |
|||
} |
|||
} |
|||
{% endmacro %} |
|||
|
|||
{{ ContainerRenderObjectMixin('RenderBox') }} |
|||
|
|||
{{ ContainerRenderObjectMixin('RenderSliver') }} |
|||
|
|||
|
|||
{% macro RenderObjectWithChildMixin(with) %} |
|||
public abstract class RenderObjectWithChildMixin{{with}}<ChildType> : {{with}} where ChildType : RenderObject { |
|||
public ChildType _child; |
|||
|
|||
public ChildType child { |
|||
get { return this._child; } |
|||
set { |
|||
if (this._child != null) { |
|||
this.dropChild(this._child); |
|||
} |
|||
|
|||
this._child = value; |
|||
if (this._child != null) { |
|||
this.adoptChild(this._child); |
|||
} |
|||
} |
|||
} |
|||
|
|||
public override void attach(object owner) { |
|||
base.attach(owner); |
|||
if (this._child != null) { |
|||
this._child.attach(owner); |
|||
} |
|||
} |
|||
|
|||
public override void detach() { |
|||
base.detach(); |
|||
if (this._child != null) { |
|||
this._child.detach(); |
|||
} |
|||
} |
|||
|
|||
public override void redepthChildren() { |
|||
if (this._child != null) { |
|||
this.redepthChild(this._child); |
|||
} |
|||
} |
|||
|
|||
public override void visitChildren(RenderObjectVisitor visitor) { |
|||
if (this._child != null) { |
|||
visitor(this._child); |
|||
} |
|||
} |
|||
} |
|||
{% endmacro %} |
|||
|
|||
{{ RenderObjectWithChildMixin('RenderBox') }} |
|||
|
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: f509c0b4f02024b16a996d1473d88216 |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UIWidgets.painting; |
|||
using UIWidgets.ui; |
|||
using UnityEngine; |
|||
|
|||
namespace UIWidgets.rendering { |
|||
public class RenderProxyBox : RenderProxyBoxMixinRenderObjectWithChildMixinRenderBox<RenderBox> { |
|||
public RenderProxyBox(RenderBox child = null) { |
|||
this.child = child; |
|||
} |
|||
} |
|||
|
|||
public enum DecorationPosition { |
|||
background, |
|||
foreground, |
|||
} |
|||
|
|||
public class RenderDecoratedBox : RenderProxyBox { |
|||
public RenderDecoratedBox( |
|||
Decoration decoration, |
|||
DecorationPosition position = DecorationPosition.background, |
|||
ImageConfiguration configuration = null, |
|||
RenderBox child = null |
|||
) { |
|||
} |
|||
|
|||
public BoxPainter _painter; |
|||
|
|||
public Decoration decoration { |
|||
get { return this._decoration; } |
|||
set { |
|||
if (value == this._decoration) { |
|||
return; |
|||
} |
|||
|
|||
if (this._painter != null) { |
|||
this._painter.dispose(); |
|||
this._painter = null; |
|||
} |
|||
|
|||
this._decoration = value; |
|||
this.markNeedsPaint(); |
|||
} |
|||
} |
|||
|
|||
public Decoration _decoration; |
|||
|
|||
public DecorationPosition position { |
|||
get { return this._position; } |
|||
set { |
|||
if (value == this._position) { |
|||
return; |
|||
} |
|||
|
|||
this._position = value; |
|||
this.markNeedsPaint(); |
|||
} |
|||
} |
|||
|
|||
public DecorationPosition _position; |
|||
|
|||
|
|||
public ImageConfiguration configuration { |
|||
get { return this._configuration; } |
|||
set { |
|||
if (value == this._configuration) { |
|||
return; |
|||
} |
|||
|
|||
this._configuration = value; |
|||
this.markNeedsPaint(); |
|||
} |
|||
} |
|||
|
|||
public ImageConfiguration _configuration; |
|||
|
|||
public override void detach() { |
|||
if (this._painter != null) { |
|||
this._painter.dispose(); |
|||
this._painter = null; |
|||
} |
|||
|
|||
base.detach(); |
|||
this.markNeedsPaint(); |
|||
} |
|||
|
|||
public override void paint(PaintingContext context, Offset offset) { |
|||
if (this._painter == null) { |
|||
this._painter = this._decoration.createBoxPainter(this.markNeedsPaint); |
|||
} |
|||
|
|||
var filledConfiguration = this.configuration.copyWith(size: this.size); |
|||
if (this.position == DecorationPosition.background) { |
|||
this._painter.paint(context.canvas, offset, filledConfiguration); |
|||
} |
|||
|
|||
base.paint(context, offset); |
|||
|
|||
if (this.position == DecorationPosition.foreground) { |
|||
this._painter.paint(context.canvas, offset, filledConfiguration); |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 6da4b97fadea449e974cbfdc2ca4554e |
|||
timeCreated: 1534167031 |
|
|||
fileFormatVersion: 2 |
|||
guid: 4d673221d8ca64c51bf770758d10eb9a |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UIWidgets.ui; |
|||
using UnityEngine; |
|||
|
|||
namespace UIWidgets.rendering { |
|||
|
|||
{% macro RenderProxyBoxMixin(with) %} |
|||
public abstract class RenderProxyBoxMixin{{with}}<T> : {{with}}<T> where T : RenderBox { |
|||
public override void setupParentData(RenderObject child) { |
|||
if (!(child.parentData is ParentData)) { |
|||
child.parentData = new ParentData(); |
|||
} |
|||
} |
|||
|
|||
public override double computeMinIntrinsicWidth(double height) { |
|||
if (this.child != null) { |
|||
return this.child.getMinIntrinsicWidth(height); |
|||
} |
|||
|
|||
return 0.0; |
|||
} |
|||
|
|||
public override double computeMaxIntrinsicWidth(double height) { |
|||
if (this.child != null) { |
|||
return this.child.getMaxIntrinsicWidth(height); |
|||
} |
|||
|
|||
return 0.0; |
|||
} |
|||
|
|||
public override double computeMinIntrinsicHeight(double width) { |
|||
if (this.child != null) { |
|||
return this.child.getMinIntrinsicHeight(width); |
|||
} |
|||
|
|||
return 0.0; |
|||
} |
|||
|
|||
public override double computeMaxIntrinsicHeight(double width) { |
|||
if (this.child != null) { |
|||
return this.child.getMaxIntrinsicHeight(width); |
|||
} |
|||
|
|||
return 0.0; |
|||
} |
|||
|
|||
public override double? computeDistanceToActualBaseline(TextBaseline baseline) { |
|||
if (this.child != null) { |
|||
return this.child.getDistanceToActualBaseline(baseline); |
|||
} |
|||
|
|||
return base.computeDistanceToActualBaseline(baseline); |
|||
} |
|||
|
|||
public override void performLayout() { |
|||
if (this.child != null) { |
|||
this.child.layout(this.constraints, true); |
|||
this.size = this.child.size; |
|||
} else { |
|||
this.performResize(); |
|||
} |
|||
} |
|||
|
|||
public override void applyPaintTransform(RenderObject child, Matrix4x4 transform) { |
|||
} |
|||
|
|||
public override void paint(PaintingContext context, Offset offset) { |
|||
if (this.child != null) { |
|||
context.paintChild(this.child, offset); |
|||
} |
|||
} |
|||
} |
|||
{% endmacro %} |
|||
|
|||
|
|||
{{ RenderProxyBoxMixin('RenderObjectWithChildMixinRenderBox') }} |
|||
|
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: e85e0b7a5a0b4190b7dfaa5821258d91 |
|||
timeCreated: 1534167051 |
|
|||
namespace UIWidgets.rendering { |
|||
|
|||
public class SliverPhysicalParentData : ContainerParentDataMixin<RenderSliver> { |
|||
} |
|||
|
|||
public class SliverPhysicalContainerParentData : SliverPhysicalParentData { |
|||
} |
|||
|
|||
public abstract class RenderSliver : RenderObject { |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 9bc8ebc37a3f4115806c8bf444ea6aa8 |
|||
timeCreated: 1533888575 |
|
|||
using UIWidgets.painting; |
|||
using UnityEngine; |
|||
using Rect = UIWidgets.ui.Rect; |
|||
|
|||
namespace UIWidgets.rendering { |
|||
public interface RenderAbstractViewport { |
|||
RevealedOffset getOffsetToReveal(RenderObject target, double alignment, Rect rect = null); |
|||
} |
|||
|
|||
public static class RenderAbstractViewportUtils { |
|||
public static RenderAbstractViewport of(RenderObject obj) { |
|||
while (obj != null) { |
|||
if (obj is RenderAbstractViewport) |
|||
return (RenderAbstractViewport) obj; |
|||
obj = (RenderObject) obj.parent; |
|||
} |
|||
|
|||
return null; |
|||
} |
|||
|
|||
public const double defaultCacheExtent = 250.0; |
|||
} |
|||
|
|||
public class RevealedOffset { |
|||
public RevealedOffset(double offset, Rect rect) { |
|||
this.offset = offset; |
|||
this.rect = rect; |
|||
} |
|||
|
|||
public readonly double offset; |
|||
public readonly Rect rect; |
|||
} |
|||
|
|||
public abstract class RenderViewportBase<ParentDataClass> : ContainerRenderBox<RenderSliver, ParentDataClass>, |
|||
RenderAbstractViewport |
|||
where ParentDataClass : ContainerParentDataMixin<RenderSliver> { |
|||
protected RenderViewportBase( |
|||
AxisDirection crossAxisDirection, |
|||
ViewportOffset offset, |
|||
double cacheExtent = RenderAbstractViewportUtils.defaultCacheExtent, |
|||
AxisDirection axisDirection = AxisDirection.down |
|||
) { |
|||
Debug.Assert(AxisUtils.axisDirectionToAxis(axisDirection) != |
|||
AxisUtils.axisDirectionToAxis(crossAxisDirection)); |
|||
this._axisDirection = axisDirection; |
|||
this._crossAxisDirection = crossAxisDirection; |
|||
this._offset = offset; |
|||
this._cacheExtent = cacheExtent; |
|||
} |
|||
|
|||
public AxisDirection axisDirection { |
|||
get { return this._axisDirection; } |
|||
set { |
|||
if (value == this._axisDirection) { |
|||
return; |
|||
} |
|||
|
|||
this._axisDirection = value; |
|||
this.markNeedsLayout(); |
|||
} |
|||
} |
|||
|
|||
public AxisDirection _axisDirection; |
|||
|
|||
public AxisDirection crossAxisDirection { |
|||
get { return this._crossAxisDirection; } |
|||
set { |
|||
if (value == this._crossAxisDirection) { |
|||
return; |
|||
} |
|||
this._crossAxisDirection = value; |
|||
this.markNeedsLayout(); |
|||
} |
|||
} |
|||
|
|||
public AxisDirection _crossAxisDirection; |
|||
|
|||
public Axis axis { |
|||
get { return AxisUtils.axisDirectionToAxis(this.axisDirection); } |
|||
} |
|||
|
|||
|
|||
public ViewportOffset offset { |
|||
get { return this._offset; } |
|||
set { |
|||
if (object.Equals(value, this._offset)) { |
|||
return; |
|||
} |
|||
|
|||
if (this.attached) { |
|||
this._offset.removeListener(this.markNeedsLayout); |
|||
} |
|||
|
|||
this._offset = value; |
|||
if (this.attached) { |
|||
this._offset.addListener(this.markNeedsLayout); |
|||
} |
|||
|
|||
this.markNeedsLayout(); |
|||
} |
|||
} |
|||
|
|||
public ViewportOffset _offset; |
|||
|
|||
public double cacheExtent { |
|||
get { return this._cacheExtent; } |
|||
set { |
|||
if (value == this._cacheExtent) { |
|||
return; |
|||
} |
|||
|
|||
this._cacheExtent = value; |
|||
this.markNeedsLayout(); |
|||
} |
|||
} |
|||
|
|||
public double _cacheExtent; |
|||
|
|||
public override void attach(object owner) { |
|||
base.attach(owner); |
|||
this._offset.addListener(this.markNeedsLayout); |
|||
} |
|||
|
|||
public override void detach() { |
|||
this._offset.removeListener(this.markNeedsLayout); |
|||
base.detach(); |
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
public class RenderViewport : RenderViewportBase<SliverPhysicalContainerParentData> { |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 50063f63063d49b480c04ad07dee202d |
|||
timeCreated: 1533882907 |
|
|||
using UIWidgets.foundation; |
|||
|
|||
namespace UIWidgets.rendering { |
|||
public enum ScrollDirection { |
|||
idle, |
|||
forward, |
|||
reverse, |
|||
} |
|||
|
|||
public abstract class ViewportOffset : ChangeNotifier { |
|||
protected ViewportOffset() { |
|||
} |
|||
|
|||
public static ViewportOffset @fixed(double value) { |
|||
return null; |
|||
} |
|||
|
|||
public static ViewportOffset zero() { |
|||
return null; |
|||
} |
|||
|
|||
public abstract double pixels { get; } |
|||
public abstract bool applyViewportDimension(double viewportDimension); |
|||
public abstract bool applyContentDimensions(double minScrollExtent, double maxScrollExtent); |
|||
|
|||
public abstract void correctBy(double correction); |
|||
public abstract void jumpTo(double pixels); |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 2e503b46edcd498e89fb19c2060fbe2d |
|||
timeCreated: 1534050410 |
|
|||
namespace UIWidgets.ui { |
|||
public class SceneBuilder { |
|||
public void pushClipRect(Rect rect) { |
|||
} |
|||
|
|||
public void pushOpacity(int alpha) { |
|||
} |
|||
|
|||
public void pop() { |
|||
} |
|||
|
|||
public void addPicture(Offset offset, Picture picture) { |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 1d8e458df9c1464293490d761d28514a |
|||
timeCreated: 1534133020 |
|
|||
namespace UIWidgets.ui { |
|||
public enum TextBaseline { |
|||
alphabetic, |
|||
ideographic, |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 677c26ed1782492c9b9e6e95b44093dc |
|||
timeCreated: 1534152450 |
|
|||
var path = require('path'); |
|||
var chalk = require('chalk'); |
|||
var glob = require("glob"); |
|||
var fs = require('fs'); |
|||
var nunjucks = require('nunjucks'); |
|||
var chokidar = require('chokidar'); |
|||
|
|||
exports.command = 'codegen [dir]'; |
|||
exports.desc = "codegen"; |
|||
exports.builder = function (yargs) { |
|||
return yargs.positional('dir', { |
|||
describe: 'the working directory', |
|||
type: 'string', |
|||
default: '.' |
|||
}).option('watch', { |
|||
alias: 'w', |
|||
describe: 'Watch for file changes', |
|||
boolean: true |
|||
}); |
|||
}; |
|||
|
|||
exports.handler = function (argv) { |
|||
var cwd = path.resolve(__dirname, '../..', argv.dir); |
|||
var data = {}; |
|||
var env = nunjucks.configure(cwd, { |
|||
trimBlocks: true, |
|||
lstripBlocks: true, |
|||
noCache: true |
|||
}); |
|||
|
|||
glob('**/*.njk', { |
|||
strict: true, |
|||
cwd: cwd, |
|||
ignore: '**/_*.*' |
|||
}, function (err, files) { |
|||
if (err) { |
|||
return console.error(chalk.red(err)); |
|||
} |
|||
|
|||
renderAll(env, cwd, files, data); |
|||
}); |
|||
|
|||
if (argv.watch) { |
|||
var watcher = chokidar.watch('**/*.njk', { |
|||
persistent: true, |
|||
cwd: cwd, |
|||
awaitWriteFinish: { |
|||
stabilityThreshold: 300, |
|||
pollInterval: 50 |
|||
} |
|||
}); |
|||
|
|||
var layouts = []; |
|||
var templates = []; |
|||
|
|||
watcher.on('ready', function () { |
|||
console.log(chalk.gray('Watching templates...')); |
|||
}); |
|||
|
|||
watcher.on('add', function (file) { |
|||
if (path.basename(file).indexOf('_') === 0) { |
|||
layouts.push(file); |
|||
} else { |
|||
templates.push(file); |
|||
} |
|||
}); |
|||
|
|||
watcher.on('change', function (file) { |
|||
if (layouts.indexOf(file) >= 0) { |
|||
renderAll(env, cwd, templates, data); |
|||
} else { |
|||
render(env, cwd, file, data); |
|||
} |
|||
}); |
|||
} |
|||
}; |
|||
|
|||
function render(env, cwd, file, data) { |
|||
env.render(file, data, function (err, res) { |
|||
if (err) { |
|||
return console.error(chalk.red(err)); |
|||
} |
|||
|
|||
var outputFile = file.replace(/\.\w+$/, '') + '.gen.cs'; |
|||
console.log(chalk.blue('Rendering: ' + file)); |
|||
fs.writeFileSync(path.resolve(cwd, outputFile), res); |
|||
}); |
|||
} |
|||
|
|||
function renderAll(env, cwd, files, data) { |
|||
for (var i = 0; i < files.length; i++) { |
|||
render(env, cwd, files[i], data); |
|||
} |
|||
} |
|
|||
# Logs |
|||
logs |
|||
*.log |
|||
npm-debug.log* |
|||
yarn-debug.log* |
|||
yarn-error.log* |
|||
|
|||
# Runtime data |
|||
pids |
|||
*.pid |
|||
*.seed |
|||
*.pid.lock |
|||
|
|||
# Directory for instrumented libs generated by jscoverage/JSCover |
|||
lib-cov |
|||
|
|||
# Coverage directory used by tools like istanbul |
|||
coverage |
|||
|
|||
# nyc test coverage |
|||
.nyc_output |
|||
|
|||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) |
|||
.grunt |
|||
|
|||
# Bower dependency directory (https://bower.io/) |
|||
bower_components |
|||
|
|||
# node-waf configuration |
|||
.lock-wscript |
|||
|
|||
# Compiled binary addons (https://nodejs.org/api/addons.html) |
|||
build/Release |
|||
|
|||
# Dependency directories |
|||
node_modules/ |
|||
jspm_packages/ |
|||
|
|||
# TypeScript v1 declaration files |
|||
typings/ |
|||
|
|||
# Optional npm cache directory |
|||
.npm |
|||
|
|||
# Optional eslint cache |
|||
.eslintcache |
|||
|
|||
# Optional REPL history |
|||
.node_repl_history |
|||
|
|||
# Output of 'npm pack' |
|||
*.tgz |
|||
|
|||
# Yarn Integrity file |
|||
.yarn-integrity |
|||
|
|||
# dotenv environment variables file |
|||
.env |
|||
|
|||
# parcel-bundler cache (https://parceljs.org/) |
|||
.cache |
|||
|
|||
# next.js build output |
|||
.next |
|||
|
|||
# nuxt.js build output |
|||
.nuxt |
|||
|
|||
# vuepress build output |
|||
.vuepress/dist |
|||
|
|||
# Serverless directories |
|||
.serverless |
|
|||
{ |
|||
"name": "uiwidgets-cli", |
|||
"version": "1.0.0", |
|||
"description": "cli for uiwidgets", |
|||
"main": "uiwidgets-cli.js", |
|||
"scripts": {}, |
|||
"author": "", |
|||
"license": "ISC", |
|||
"dependencies": { |
|||
"chalk": "^2.4.1", |
|||
"chokidar": "^2.0.4", |
|||
"glob": "^7.1.2", |
|||
"nunjucks": "^3.1.3", |
|||
"yargs": "^12.0.1" |
|||
} |
|||
} |
|
|||
#! /usr/bin/env node
|
|||
|
|||
require('yargs') |
|||
.commandDir('cmds') |
|||
.demandCommand() |
|||
.help() |
|||
.argv; |
撰写
预览
正在加载...
取消
保存
Reference in new issue