浏览代码

Merge pull request #83 from Unity-Technologies/siyaoH/1.17/fix

fix
/siyaoH-1.17-PlatformMessage
GitHub 4 年前
当前提交
86d70bfe
共有 44 个文件被更改,包括 142 次插入129 次删除
  1. 4
      com.unity.uiwidgets/Runtime/animation/animation_controller.cs
  2. 2
      com.unity.uiwidgets/Runtime/animation/curves.cs
  3. 4
      com.unity.uiwidgets/Runtime/cupertino/route.cs
  4. 8
      com.unity.uiwidgets/Runtime/cupertino/slider.cs
  5. 4
      com.unity.uiwidgets/Runtime/cupertino/switch.cs
  6. 4
      com.unity.uiwidgets/Runtime/material/animated_icons/animated_icons.cs
  7. 2
      com.unity.uiwidgets/Runtime/material/app_bar_theme.cs
  8. 4
      com.unity.uiwidgets/Runtime/material/arc.cs
  9. 3
      com.unity.uiwidgets/Runtime/material/bottom_app_bar_theme.cs
  10. 5
      com.unity.uiwidgets/Runtime/material/button_bar_theme.cs
  11. 4
      com.unity.uiwidgets/Runtime/material/button_sheet_theme.cs
  12. 2
      com.unity.uiwidgets/Runtime/material/card_theme.cs
  13. 4
      com.unity.uiwidgets/Runtime/material/chip_theme.cs
  14. 3
      com.unity.uiwidgets/Runtime/material/dialog_theme.cs
  15. 9
      com.unity.uiwidgets/Runtime/material/divider_theme.cs
  16. 11
      com.unity.uiwidgets/Runtime/material/floatting_action_button_theme.cs
  17. 2
      com.unity.uiwidgets/Runtime/material/input_border.cs
  18. 4
      com.unity.uiwidgets/Runtime/material/input_decorator.cs
  19. 2
      com.unity.uiwidgets/Runtime/material/mergeable_material.cs
  20. 10
      com.unity.uiwidgets/Runtime/material/navigation_rail.cs
  21. 5
      com.unity.uiwidgets/Runtime/material/navigation_rail_theme.cs
  22. 4
      com.unity.uiwidgets/Runtime/material/popup_menu_theme.cs
  23. 2
      com.unity.uiwidgets/Runtime/material/range_slider.cs
  24. 2
      com.unity.uiwidgets/Runtime/material/scaffold.cs
  25. 4
      com.unity.uiwidgets/Runtime/material/slider_theme.cs
  26. 3
      com.unity.uiwidgets/Runtime/material/snack_bar_theme.cs
  27. 4
      com.unity.uiwidgets/Runtime/material/theme_data.cs
  28. 22
      com.unity.uiwidgets/Runtime/painting/alignment.cs
  29. 2
      com.unity.uiwidgets/Runtime/painting/borders.cs
  30. 4
      com.unity.uiwidgets/Runtime/painting/box_shadow.cs
  31. 8
      com.unity.uiwidgets/Runtime/painting/colors.cs
  32. 28
      com.unity.uiwidgets/Runtime/painting/edge_insets.cs
  33. 6
      com.unity.uiwidgets/Runtime/painting/fractional_offset.cs
  34. 8
      com.unity.uiwidgets/Runtime/painting/gradient.cs
  35. 4
      com.unity.uiwidgets/Runtime/painting/rounded_rectangle_border.cs
  36. 8
      com.unity.uiwidgets/Runtime/painting/stadium_border.cs
  37. 2
      com.unity.uiwidgets/Runtime/painting/text_style.cs
  38. 8
      com.unity.uiwidgets/Runtime/rendering/box.cs
  39. 4
      com.unity.uiwidgets/Runtime/rendering/editable.cs
  40. 8
      com.unity.uiwidgets/Runtime/rendering/stack.cs
  41. 28
      com.unity.uiwidgets/Runtime/ui2/geometry.cs
  42. 10
      com.unity.uiwidgets/Runtime/ui2/painting.cs
  43. 2
      com.unity.uiwidgets/Runtime/ui2/text.cs
  44. 4
      com.unity.uiwidgets/Runtime/widgets/editable_text.cs

4
com.unity.uiwidgets/Runtime/animation/animation_controller.cs


if (_reverse && _isPlayingReverse) {
directionSetter(_AnimationDirection.reverse);
return Mathf.Lerp(_max, _min, t);
return MathUtils.lerpNullableFloat(_max, _min, t);
return Mathf.Lerp(_min, _max, t);
return MathUtils.lerpNullableFloat(_min, _max, t);
}
}

2
com.unity.uiwidgets/Runtime/animation/curves.cs


}
}
float t2 = (t - startValue.dx) / (endValue.dx - startValue.dx);
return Mathf.Lerp(startValue.dy, endValue.dy, t2);
return MathUtils.lerpNullableFloat(startValue.dy, endValue.dy, t2);
}
}

4
com.unity.uiwidgets/Runtime/cupertino/route.cs


}
if (animateForward) {
int droppedPageForwardAnimationTime = Mathf.Min(
Mathf.Lerp(CupertinoRouteUtils._kMaxDroppedSwipePageForwardAnimationTime, 0f,
MathUtils.lerpNullableFloat(CupertinoRouteUtils._kMaxDroppedSwipePageForwardAnimationTime, 0f,
controller.value).floor(),
CupertinoRouteUtils._kMaxPageBackAnimationTime
);

if (controller.isAnimating) {
int droppedPageBackAnimationTime =
Mathf.Lerp(0f, CupertinoRouteUtils._kMaxDroppedSwipePageForwardAnimationTime,
MathUtils.lerpNullableFloat(0f, CupertinoRouteUtils._kMaxDroppedSwipePageForwardAnimationTime,
controller.value).floor();
controller.animateBack(0.0f, duration: TimeSpan.FromMilliseconds(droppedPageBackAnimationTime),
curve: animationCurve);

8
com.unity.uiwidgets/Runtime/cupertino/slider.cs


class _CupertinoSliderState : TickerProviderStateMixin<CupertinoSlider> {
void _handleChanged(float value) {
D.assert(widget.onChanged != null);
float lerpValue = Mathf.Lerp(widget.min, widget.max, value);
float lerpValue = MathUtils.lerpNullableFloat(widget.min, widget.max, value);
if (lerpValue != widget.value) {
widget.onChanged(lerpValue);
}

D.assert(widget.onChangeStart != null);
widget.onChangeStart(Mathf.Lerp(widget.min, widget.max, value));
widget.onChangeStart(MathUtils.lerpNullableFloat(widget.min, widget.max, value));
widget.onChangeEnd(Mathf.Lerp(widget.min, widget.max, value));
widget.onChangeEnd(MathUtils.lerpNullableFloat(widget.min, widget.max, value));
}
public override Widget build(BuildContext context) {

visualPosition = _value;
break;
}
return Mathf.Lerp(_trackLeft + CupertinoThumbPainter.radius, _trackRight - CupertinoThumbPainter.radius, visualPosition);
return MathUtils.lerpNullableFloat(_trackLeft + CupertinoThumbPainter.radius, _trackRight - CupertinoThumbPainter.radius, visualPosition);
}
}

4
com.unity.uiwidgets/Runtime/cupertino/switch.cs


canvas.drawRRect(trackRRect, paint);
float currentThumbExtension = CupertinoThumbPainter.extension * currentReactionValue;
float thumbLeft = Mathf.Lerp(
float thumbLeft = MathUtils.lerpNullableFloat(
float thumbRight = Mathf.Lerp(
float thumbRight = MathUtils.lerpNullableFloat(
trackRect.left + CupertinoSwitchUtils._kTrackInnerStart + CupertinoThumbPainter.radius +
currentThumbExtension,
trackRect.left + CupertinoSwitchUtils._kTrackInnerEnd + CupertinoThumbPainter.radius,

4
com.unity.uiwidgets/Runtime/material/animated_icons/animated_icons.cs


return values[0];
}
float targetIdx = Mathf.Lerp(0, values.Count - 1, progress);
float targetIdx = MathUtils.lerpNullableFloat(0, values.Count - 1, progress);
int lowIdx = targetIdx.floor();
int highIdx = targetIdx.ceil();
float t = targetIdx - lowIdx;

public readonly List<float> opacities;
public void paint(Canvas canvas, Color color, _UiPathFactory uiPathFactory, float progress) {
float opacity = AnimatedIconUtils._interpolate<float>(opacities, progress, Mathf.Lerp);
float opacity = AnimatedIconUtils._interpolate<float>(opacities, progress, MathUtils.lerpNullableFloat);
Paint paint = new Paint();
paint.style = PaintingStyle.fill;
paint.color = color.withOpacity(color.opacity * opacity);

2
com.unity.uiwidgets/Runtime/material/app_bar_theme.cs


return new AppBarTheme(
brightness: t < 0.5f ? a?.brightness : b?.brightness,
color: Color.lerp(a?.color, b?.color, t),
elevation: Mathf.Lerp(a?.elevation ?? 0.0f, b?.elevation ?? 0.0f, t),
elevation: MathUtils.lerpNullableFloat(a?.elevation, b?.elevation, t),
iconTheme: IconThemeData.lerp(a?.iconTheme, b?.iconTheme, t),
actionsIconTheme: IconThemeData.lerp(a?.actionsIconTheme, b?.actionsIconTheme, t),
textTheme: TextTheme.lerp(a?.textTheme, b?.textTheme, t)

4
com.unity.uiwidgets/Runtime/material/arc.cs


}
Offset center = _centerArc.lerp(t);
float width = Mathf.Lerp(begin.width, end.width, t);
float height = Mathf.Lerp(begin.height, end.height, t);
float width = MathUtils.lerpNullableFloat(begin.width, end.width, t);
float height = MathUtils.lerpNullableFloat(begin.height, end.height, t);
return Rect.fromLTWH(
(center.dx - width / 2.0f),
(center.dy - height / 2.0f),

3
com.unity.uiwidgets/Runtime/material/bottom_app_bar_theme.cs


using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;

public static BottomAppBarTheme lerp(BottomAppBarTheme a, BottomAppBarTheme b, float t) {
return new BottomAppBarTheme(
color: Color.lerp(a?.color, b?.color, t),
elevation: Mathf.Lerp(a?.elevation ?? 0.0f, b?.elevation ?? 0.0f, t),
elevation: MathUtils.lerpNullableFloat(a?.elevation, b?.elevation, t),
shape: t < 0.5f ? a?.shape : b?.shape
);
}

5
com.unity.uiwidgets/Runtime/material/button_bar_theme.cs


using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using Object = UnityEngine.Object;

alignment: t < 0.5 ? a.alignment : b.alignment,
mainAxisSize: t < 0.5 ? a.mainAxisSize : b.mainAxisSize,
buttonTextTheme: t < 0.5 ? a.buttonTextTheme : b.buttonTextTheme,
buttonMinWidth: Mathf.Lerp(a?.buttonMinWidth ?? 0, b?.buttonMinWidth ?? 0, t),
buttonHeight: Mathf.Lerp(a?.buttonHeight ?? 0, b?.buttonHeight ?? 0, t),
buttonMinWidth: MathUtils.lerpNullableFloat(a?.buttonMinWidth, b?.buttonMinWidth, t),
buttonHeight: MathUtils.lerpNullableFloat(a?.buttonHeight, b?.buttonHeight, t),
buttonPadding: EdgeInsetsGeometry.lerp(a?.buttonPadding, b?.buttonPadding, t),
buttonAlignedDropdown: t < 0.5 ? a.buttonAlignedDropdown : b.buttonAlignedDropdown,
layoutBehavior: t < 0.5 ? a.layoutBehavior : b.layoutBehavior,

4
com.unity.uiwidgets/Runtime/material/button_sheet_theme.cs


return null;
return new BottomSheetThemeData(
backgroundColor: Color.lerp(a?.backgroundColor, b?.backgroundColor, t),
elevation: Mathf.Lerp(a?.elevation ?? 0, b?.elevation ?? 0, t),
elevation: MathUtils.lerpNullableFloat(a?.elevation, b?.elevation, t),
modalElevation: Mathf.Lerp(a?.modalElevation ?? 0, b?.modalElevation ?? 0, t),
modalElevation: MathUtils.lerpNullableFloat(a?.modalElevation, b?.modalElevation, t),
shape: ShapeBorder.lerp(a?.shape, b?.shape, t),
clipBehavior: t < 0.5 ? a?.clipBehavior : b?.clipBehavior
);

2
com.unity.uiwidgets/Runtime/material/card_theme.cs


clipBehavior: t < 0.5f ? a?.clipBehavior : b?.clipBehavior,
color: Color.lerp(a?.color, b?.color, t),
shadowColor: Color.lerp(a?.shadowColor, b?.shadowColor, t),
elevation: Mathf.Lerp(a?.elevation ?? 0.0f, b?.elevation ?? 0.0f, t),
elevation: MathUtils.lerpNullableFloat(a?.elevation, b?.elevation, t),
margin: EdgeInsetsGeometry.lerp(a?.margin, b?.margin, t),
shape: ShapeBorder.lerp(a?.shape, b?.shape, t)
);

4
com.unity.uiwidgets/Runtime/material/chip_theme.cs


labelStyle: TextStyle.lerp(a?.labelStyle, b?.labelStyle, t),
secondaryLabelStyle: TextStyle.lerp(a?.secondaryLabelStyle, b?.secondaryLabelStyle, t),
brightness: t < 0.5f ? a?.brightness ?? Brightness.light : b?.brightness ?? Brightness.light,
elevation: Mathf.Lerp(a?.elevation ?? 0.0f, b?.elevation ?? 0.0f, t),
pressElevation: Mathf.Lerp(a?.pressElevation ?? 0.0f, b?.pressElevation ?? 0.0f, t)
elevation: MathUtils.lerpNullableFloat(a?.elevation, b?.elevation, t),
pressElevation: MathUtils.lerpNullableFloat(a?.pressElevation, b?.pressElevation, t)
);
}

3
com.unity.uiwidgets/Runtime/material/dialog_theme.cs


using System;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;

public static DialogTheme lerp(DialogTheme a, DialogTheme b, float t) {
return new DialogTheme(
backgroundColor: Color.lerp(a?.backgroundColor, b?.backgroundColor, t),
elevation: Mathf.Lerp(a?.elevation ?? 0.0f, b?.elevation ?? 0.0f, t),
elevation: MathUtils.lerpNullableFloat(a?.elevation, b?.elevation, t),
shape: ShapeBorder.lerp(a?.shape, b?.shape, t),
titleTextStyle: TextStyle.lerp(a?.titleTextStyle, b?.titleTextStyle, t),
contentTextStyle: TextStyle.lerp(a?.contentTextStyle, b?.contentTextStyle, t)

9
com.unity.uiwidgets/Runtime/material/divider_theme.cs


using System;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;

public static DividerThemeData lerp(DividerThemeData a, DividerThemeData b, float t) {
return new DividerThemeData(
color: Color.lerp(a?.color, b?.color, t),
space: Mathf.Lerp(a?.space ?? 0, b?.space ?? 0, t),
thickness: Mathf.Lerp(a?.thickness ?? 0, b?.thickness ?? 0, t),
indent: Mathf.Lerp(a?.indent ?? 0, b?.indent ?? 0, t),
endIndent: Mathf.Lerp(a?.endIndent ?? 0, b?.endIndent ?? 0, t)
space: MathUtils.lerpNullableFloat(a?.space, b?.space, t),
thickness: MathUtils.lerpNullableFloat(a?.thickness, b?.thickness, t),
indent: MathUtils.lerpNullableFloat(a?.indent, b?.indent, t),
endIndent: MathUtils.lerpNullableFloat(a?.endIndent, b?.endIndent, t)
);
}

11
com.unity.uiwidgets/Runtime/material/floatting_action_button_theme.cs


using System;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;

focusColor: Color.lerp(a?.focusColor, b?.focusColor, t),
hoverColor: Color.lerp(a?.hoverColor, b?.hoverColor, t),
splashColor: Color.lerp(a?.splashColor, b?.splashColor, t),
elevation: Mathf.Lerp(a?.elevation ?? 0, b?.elevation ?? 0, t),
focusElevation: Mathf.Lerp(a?.focusElevation ?? 0, b?.focusElevation ?? 0, t),
hoverElevation: Mathf.Lerp(a?.hoverElevation ?? 0, b?.hoverElevation ?? 0, t),
disabledElevation: Mathf.Lerp(a?.disabledElevation ?? 0, b?.disabledElevation ?? 0, t),
highlightElevation: Mathf.Lerp(a?.highlightElevation ?? 0, b?.highlightElevation ?? 0, t),
elevation: MathUtils.lerpNullableFloat(a?.elevation, b?.elevation, t),
focusElevation: MathUtils.lerpNullableFloat(a?.focusElevation, b?.focusElevation, t),
hoverElevation: MathUtils.lerpNullableFloat(a?.hoverElevation, b?.hoverElevation, t),
disabledElevation: MathUtils.lerpNullableFloat(a?.disabledElevation, b?.disabledElevation, t),
highlightElevation: MathUtils.lerpNullableFloat(a?.highlightElevation, b?.highlightElevation, t),
shape: ShapeBorder.lerp(a?.shape, b?.shape, t)
);
}

2
com.unity.uiwidgets/Runtime/material/input_border.cs


canvas.drawRRect(center, paint);
}
else {
float extent = Mathf.Lerp(0.0f, gapExtent + gapPadding * 2.0f, gapPercentage);
float extent = MathUtils.lerpNullableFloat(0.0f, gapExtent + gapPadding * 2.0f, gapPercentage);
Path path = _gapBorderPath(canvas, center, Mathf.Max(0.0f,gapStart - gapPadding), extent);
canvas.drawPath(path, paint);
}

4
com.unity.uiwidgets/Runtime/material/input_decorator.cs


float t = decoration.floatingLabelProgress;
bool isOutlineBorder = decoration.border != null && decoration.border.isOutline;
float floatingY = isOutlineBorder ? -labelHeight * 0.25f : contentPadding.top;
float scale = Mathf.Lerp(1.0f, 0.75f, t);
float scale = MathUtils.lerpNullableFloat(1.0f, 0.75f, t);
float dy = Mathf.Lerp(0.0f, floatingY - labelOffset.dy, t);
float dy = MathUtils.lerpNullableFloat(0.0f, floatingY - labelOffset.dy, t);
_labelTransform = Matrix4.identity();
_labelTransform.translate(dx, labelOffset.dy + dy);
_labelTransform.scale(scale, scale, 1);

2
com.unity.uiwidgets/Runtime/material/mergeable_material.cs


float _getGapSize(int index) {
MaterialGap gap = (MaterialGap) _children[index];
return Mathf.Lerp(_animationTuples[gap.key].gapStart,
return MathUtils.lerpNullableFloat(_animationTuples[gap.key].gapStart,
gap.size,
_animationTuples[gap.key].gapAnimation.value);
}

10
com.unity.uiwidgets/Runtime/material/navigation_rail.cs


materialChildren.AddRange(new List<Widget>() {
new ConstrainedBox(
constraints: new BoxConstraints(
minWidth: Mathf.Lerp(minWidth, minExtendedWidth, _extendedAnimation.value)
minWidth: MathUtils.lerpNullableFloat(minWidth, minExtendedWidth, _extendedAnimation.value)
),
child: widget.leading
),

if (widget.trailing != null) {
alignChildren.Add(new ConstrainedBox(
constraints: new BoxConstraints(
minWidth: Mathf.Lerp(minWidth, minExtendedWidth, _extendedAnimation.value)
minWidth: MathUtils.lerpNullableFloat(minWidth, minExtendedWidth, _extendedAnimation.value)
),
child: widget.trailing
));

else {
content = new ConstrainedBox(
constraints: new BoxConstraints(
minWidth: Mathf.Lerp(minWidth ?? 0, minExtendedWidth ?? 0,
extendedTransitionAnimation.value)
minWidth: MathUtils.lerpNullableFloat(minWidth, minExtendedWidth,
extendedTransitionAnimation.value) ?? 0
),
child: new ClipRect(
child: new Row(

float appearingAnimationValue = 1 - _positionAnimation.value;
float verticalPadding = Mathf.Lerp(material_._verticalDestinationPaddingNoLabel,
float verticalPadding = MathUtils.lerpNullableFloat(material_._verticalDestinationPaddingNoLabel,
material_._verticalDestinationPaddingWithLabel, appearingAnimationValue);
content = new Container(
constraints: new BoxConstraints(

5
com.unity.uiwidgets/Runtime/material/navigation_rail_theme.cs


using System;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;

return null;
return new NavigationRailThemeData(
backgroundColor: Color.lerp(a?.backgroundColor, b?.backgroundColor, t),
elevation: Mathf.Lerp(a?.elevation ?? 0, b?.elevation ?? 0, t),
elevation: MathUtils.lerpNullableFloat(a?.elevation, b?.elevation, t),
groupAlignment: Mathf.Lerp(a?.groupAlignment ?? 0, b?.groupAlignment ?? 0, t),
groupAlignment: MathUtils.lerpNullableFloat(a?.groupAlignment, b?.groupAlignment, t),
labelType: t < 0.5 ? a?.labelType : b?.labelType
);
}

4
com.unity.uiwidgets/Runtime/material/popup_menu_theme.cs


using System;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using TextStyle = Unity.UIWidgets.painting.TextStyle;
namespace Unity.UIWidgets.material {
public class PopupMenuThemeData : Diagnosticable, IEquatable<PopupMenuThemeData> {

return new PopupMenuThemeData(
color: Color.lerp(a?.color, b?.color, t),
shape: ShapeBorder.lerp(a?.shape, b?.shape, t),
elevation: Mathf.Lerp(a?.elevation ?? 0, b?.elevation ?? 0, t),
elevation: MathUtils.lerpNullableFloat(a?.elevation, b?.elevation, t),
textStyle: TextStyle.lerp(a?.textStyle, b?.textStyle, t)
);
}

2
com.unity.uiwidgets/Runtime/material/range_slider.cs


}
float _lerp(float value) {
return Mathf.Lerp(widget.min, widget.max, value);
return MathUtils.lerpNullableFloat(widget.min, widget.max, value);
}
RangeValues _lerpRangeValues(RangeValues values) {

2
com.unity.uiwidgets/Runtime/material/scaffold.cs


float curveProgress = (t - startingPoint) / (1 - startingPoint);
float transformed = curve.transform(curveProgress);
return Mathf.Lerp(startingPoint, 1, transformed);
return MathUtils.lerpNullableFloat(startingPoint, 1, transformed);
}
public override string ToString() {

4
com.unity.uiwidgets/Runtime/material/slider_theme.cs


D.assert(a != null);
D.assert(b != null);
return new SliderThemeData(
trackHeight: Mathf.Lerp(a.trackHeight.Value, b.trackHeight.Value, t),
trackHeight: MathUtils.lerpNullableFloat(a.trackHeight, b.trackHeight, t),
activeTrackColor: Color.lerp(a.activeTrackColor, b.activeTrackColor, t),
inactiveTrackColor: Color.lerp(a.inactiveTrackColor, b.inactiveTrackColor, t),
disabledActiveTrackColor: Color.lerp(a.disabledActiveTrackColor, b.disabledActiveTrackColor, t),

rangeValueIndicatorShape: t < 0.5 ? a.rangeValueIndicatorShape : b.rangeValueIndicatorShape,
showValueIndicator: t < 0.5 ? a.showValueIndicator : b.showValueIndicator,
valueIndicatorTextStyle: TextStyle.lerp(a.valueIndicatorTextStyle, b.valueIndicatorTextStyle, t),
minThumbSeparation: Mathf.Lerp(a.minThumbSeparation.Value, b.minThumbSeparation.Value, t),
minThumbSeparation: MathUtils.lerpNullableFloat(a.minThumbSeparation, b.minThumbSeparation, t),
thumbSelector: t < 0.5 ? a.thumbSelector : b.thumbSelector
);
}

3
com.unity.uiwidgets/Runtime/material/snack_bar_theme.cs


using Unity.UIWidgets.foundation;
using Unity.UIWidgets.material;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;
using Object = UnityEngine.Object;

actionTextColor: Color.lerp(a?.actionTextColor, b?.actionTextColor, t),
disabledActionTextColor: Color.lerp(a?.disabledActionTextColor, b?.disabledActionTextColor, t),
contentTextStyle: TextStyle.lerp(a?.contentTextStyle, b?.contentTextStyle, t),
elevation: Mathf.Lerp(a?.elevation ?? 0, b?.elevation ?? 0, t),
elevation: MathUtils.lerpNullableFloat(a?.elevation, b?.elevation, t),
shape: ShapeBorder.lerp(a?.shape, b?.shape, t),
behavior: t < 0.5 ? a.behavior : b.behavior
);

4
com.unity.uiwidgets/Runtime/material/theme_data.cs


internal static VisualDensity lerp(VisualDensity a, VisualDensity b, float t) {
return new VisualDensity(
horizontal: Mathf.Lerp(a.horizontal, b.horizontal, t),
vertical: Mathf.Lerp(a.horizontal, b.horizontal, t)
horizontal: MathUtils.lerpNullableFloat(a.horizontal, b.horizontal, t),
vertical: MathUtils.lerpNullableFloat(a.horizontal, b.horizontal, t)
);
}

22
com.unity.uiwidgets/Runtime/painting/alignment.cs


if (a is AlignmentDirectional && b is AlignmentDirectional)
return AlignmentDirectional.lerp(a, b, t);
return new _MixedAlignment(
Mathf.Lerp(a._x, b._x, t),
Mathf.Lerp(a._start, b._start, t),
Mathf.Lerp(a._y, b._y, t)
MathUtils.lerpNullableFloat(a._x, b._x, t),
MathUtils.lerpNullableFloat(a._start, b._start, t),
MathUtils.lerpNullableFloat(a._y, b._y, t)
);
}

}
if (a == null) {
return new Alignment(Mathf.Lerp(0.0f, b.x, t), Mathf.Lerp(0.0f, b.y, t));
return new Alignment(MathUtils.lerpNullableFloat(0.0f, b.x, t), MathUtils.lerpNullableFloat(0.0f, b.y, t));
return new Alignment(Mathf.Lerp(a.x, 0.0f, t), Mathf.Lerp(a.y, 0.0f, t));
return new Alignment(MathUtils.lerpNullableFloat(a.x, 0.0f, t), MathUtils.lerpNullableFloat(a.y, 0.0f, t));
return new Alignment(Mathf.Lerp(a.x, b.x, t), Mathf.Lerp(a.y, b.y, t));
return new Alignment(MathUtils.lerpNullableFloat(a.x, b.x, t), MathUtils.lerpNullableFloat(a.y, b.y, t));
}
public bool Equals(Alignment other) {

if (a == null && b == null)
return null;
if (a == null)
return new AlignmentDirectional(Mathf.Lerp(0.0f, b.start, t),
Mathf.Lerp(0.0f, b.y, t));
return new AlignmentDirectional(MathUtils.lerpNullableFloat(0.0f, b.start, t),
MathUtils.lerpNullableFloat(0.0f, b.y, t));
return new AlignmentDirectional(Mathf.Lerp(a.start, 0.0f, t),
Mathf.Lerp(a.y, 0.0f, t));
return new AlignmentDirectional(Mathf.Lerp(a.start, b.start, t), Mathf.Lerp(a.y, b.y, t));
return new AlignmentDirectional(MathUtils.lerpNullableFloat(a.start, 0.0f, t),
MathUtils.lerpNullableFloat(a.y, 0.0f, t));
return new AlignmentDirectional(MathUtils.lerpNullableFloat(a.start, b.start, t), MathUtils.lerpNullableFloat(a.y, b.y, t));
}
public override Alignment resolve(TextDirection? direction) {

2
com.unity.uiwidgets/Runtime/painting/borders.cs


return b;
}
float width = Mathf.Lerp(a.width, b.width, t);
float width = MathUtils.lerpNullableFloat(a.width, b.width, t);
if (width < 0.0) {
return none;
}

4
com.unity.uiwidgets/Runtime/painting/box_shadow.cs


return new BoxShadow(
color: Color.lerp(a.color, b.color, t),
offset: Offset.lerp(a.offset, b.offset, t),
blurRadius: Mathf.Lerp(a.blurRadius, b.blurRadius, t),
spreadRadius: Mathf.Lerp(a.spreadRadius, b.spreadRadius, t)
blurRadius: MathUtils.lerpNullableFloat(a.blurRadius, b.blurRadius, t),
spreadRadius: MathUtils.lerpNullableFloat(a.spreadRadius, b.spreadRadius, t)
);
}

8
com.unity.uiwidgets/Runtime/painting/colors.cs


if (b == null)
return a._scaleAlpha(1.0f - t);
return HSLColor.fromAHSL(
Mathf.Lerp(a.alpha, b.alpha, t).clamp(0.0f, 1.0f),
Mathf.Lerp(a.hue, b.hue, t) % 360.0f,
Mathf.Lerp(a.saturation, b.saturation, t).clamp(0.0f, 1.0f),
Mathf.Lerp(a.lightness, b.lightness, t).clamp(0.0f, 1.0f)
MathUtils.lerpNullableFloat(a.alpha, b.alpha, t).clamp(0.0f, 1.0f),
MathUtils.lerpNullableFloat(a.hue, b.hue, t) % 360.0f,
MathUtils.lerpNullableFloat(a.saturation, b.saturation, t).clamp(0.0f, 1.0f),
MathUtils.lerpNullableFloat(a.lightness, b.lightness, t).clamp(0.0f, 1.0f)
);
}

28
com.unity.uiwidgets/Runtime/painting/edge_insets.cs


return EdgeInsetsDirectional.lerp(a, b, t);
return _MixedEdgeInsets.fromLRSETB(
Mathf.Lerp(a._left, b._left, t),
Mathf.Lerp(a._right, b._right, t),
Mathf.Lerp(a._start, b._start, t),
Mathf.Lerp(a._end, b._end, t),
Mathf.Lerp(a._top, b._top, t),
Mathf.Lerp(a._bottom, b._bottom, t)
MathUtils.lerpNullableFloat(a._left, b._left, t),
MathUtils.lerpNullableFloat(a._right, b._right, t),
MathUtils.lerpNullableFloat(a._start, b._start, t),
MathUtils.lerpNullableFloat(a._end, b._end, t),
MathUtils.lerpNullableFloat(a._top, b._top, t),
MathUtils.lerpNullableFloat(a._bottom, b._bottom, t)
);
}

if (b == null)
return a * (1.0f - t);
return fromSTEB(
Mathf.Lerp(a.start, b.start, t),
Mathf.Lerp(a.top, b.top, t),
Mathf.Lerp(a.end, b.end, t),
Mathf.Lerp(a.bottom, b.bottom, t)
MathUtils.lerpNullableFloat(a.start, b.start, t),
MathUtils.lerpNullableFloat(a.top, b.top, t),
MathUtils.lerpNullableFloat(a.end, b.end, t),
MathUtils.lerpNullableFloat(a.bottom, b.bottom, t)
);
}

}
return fromLTRB(
Mathf.Lerp(a.left, b.left, t),
Mathf.Lerp(a.top, b.top, t),
Mathf.Lerp(a.right, b.right, t),
Mathf.Lerp(a.bottom, b.bottom, t)
MathUtils.lerpNullableFloat(a.left, b.left, t),
MathUtils.lerpNullableFloat(a.top, b.top, t),
MathUtils.lerpNullableFloat(a.right, b.right, t),
MathUtils.lerpNullableFloat(a.bottom, b.bottom, t)
);
}

6
com.unity.uiwidgets/Runtime/painting/fractional_offset.cs


}
if (a == null) {
return new FractionalOffset(Mathf.Lerp(0.5f, b.dx, t), Mathf.Lerp(0.5f, b.dy, t));
return new FractionalOffset(MathUtils.lerpNullableFloat(0.5f, b.dx, t), MathUtils.lerpNullableFloat(0.5f, b.dy, t));
return new FractionalOffset(Mathf.Lerp(a.dx, 0.5f, t), Mathf.Lerp(a.dy, 0.5f, t));
return new FractionalOffset(MathUtils.lerpNullableFloat(a.dx, 0.5f, t), MathUtils.lerpNullableFloat(a.dy, 0.5f, t));
return new FractionalOffset(Mathf.Lerp(a.dx, b.dx, t), Mathf.Lerp(a.dy, b.dy, t));
return new FractionalOffset(MathUtils.lerpNullableFloat(a.dx, b.dx, t), MathUtils.lerpNullableFloat(a.dy, b.dy, t));
}
public override string ToString() {

8
com.unity.uiwidgets/Runtime/painting/gradient.cs


t);
return new RadialGradient(
center: AlignmentGeometry.lerp(a.center, b.center, t),
radius: Mathf.Max(0.0f, Mathf.Lerp(a.radius, b.radius, t)),
radius: Mathf.Max(0.0f, MathUtils.lerpNullableFloat(a.radius, b.radius, t)),
focalRadius: Mathf.Max(0.0f, Mathf.Lerp(a.focalRadius, b.focalRadius, t))
focalRadius: Mathf.Max(0.0f, MathUtils.lerpNullableFloat(a.focalRadius, b.focalRadius, t))
);
}

_ColorsAndStops._interpolateColorsAndStops(a.colors, a.stops, b.colors, b.stops, t);
return new SweepGradient(
center: Alignment.lerp(a.center, b.center, t),
startAngle: Mathf.Max(0.0f, Mathf.Lerp(a.startAngle, b.startAngle, t)),
endAngle: Mathf.Max(0.0f, Mathf.Lerp(a.endAngle, b.endAngle, t)),
startAngle: Mathf.Max(0.0f, MathUtils.lerpNullableFloat(a.startAngle, b.startAngle, t)),
endAngle: Mathf.Max(0.0f, MathUtils.lerpNullableFloat(a.endAngle, b.endAngle, t)),
colors: interpolated.colors,
stops: interpolated.stops,
tileMode: t < 0.5 ? a.tileMode : b.tileMode

4
com.unity.uiwidgets/Runtime/painting/rounded_rectangle_border.cs


return new _RoundedRectangleToCircleBorder(
side: BorderSide.lerp(border.side, side, t),
borderRadius: BorderRadius.lerp(border.borderRadius, borderRadius, t),
circleness: Mathf.Lerp(border.circleness, circleness, t)
circleness: MathUtils.lerpNullableFloat(border.circleness, circleness, t)
);
}

return new _RoundedRectangleToCircleBorder(
side: BorderSide.lerp(side, border.side, t),
borderRadius: BorderRadius.lerp(borderRadius, border.borderRadius, t),
circleness: Mathf.Lerp(circleness, border.circleness, t)
circleness: MathUtils.lerpNullableFloat(circleness, border.circleness, t)
);
}

8
com.unity.uiwidgets/Runtime/painting/stadium_border.cs


if (a is _StadiumToCircleBorder border) {
return new _StadiumToCircleBorder(
side: BorderSide.lerp(border.side, side, t),
circleness: Mathf.Lerp(border.circleness, circleness, t)
circleness: MathUtils.lerpNullableFloat(border.circleness, circleness, t)
);
}

if (b is _StadiumToCircleBorder border) {
return new _StadiumToCircleBorder(
side: BorderSide.lerp(side, border.side, t),
circleness: Mathf.Lerp(circleness, border.circleness, t)
circleness: MathUtils.lerpNullableFloat(circleness, border.circleness, t)
);
}

return new _StadiumToRoundedRectangleBorder(
side: BorderSide.lerp(border.side, side, t),
borderRadius: BorderRadius.lerp(border.borderRadius, borderRadius, t),
rectness: Mathf.Lerp(border.rectness, rectness, t)
rectness: MathUtils.lerpNullableFloat(border.rectness, rectness, t)
);
}

return new _StadiumToRoundedRectangleBorder(
side: BorderSide.lerp(side, border.side, t),
borderRadius: BorderRadius.lerp(borderRadius, border.borderRadius, t),
rectness: Mathf.Lerp(rectness, border.rectness, t)
rectness: MathUtils.lerpNullableFloat(rectness, border.rectness, t)
);
}

2
com.unity.uiwidgets/Runtime/painting/text_style.cs


decoration: t < 0.5 ? a.decoration : b.decoration,
decorationColor: Color.lerp(a.decorationColor, b.decorationColor, t),
decorationStyle: t < 0.5 ? a.decorationStyle : b.decorationStyle,
decorationThickness: Mathf.Lerp(
decorationThickness: MathUtils.lerpNullableFloat(
a.decorationThickness ?? b.decorationThickness ?? 0.0f,
b.decorationThickness ?? a.decorationThickness ?? 0.0f, t),
shadows: t < 0.5f ? a.shadows : b.shadows,

8
com.unity.uiwidgets/Runtime/rendering/box.cs


() => "Cannot interpolate between finite constraints and unbounded constraints.");
return new BoxConstraints(
minWidth: a.minWidth.isFinite()
? Mathf.Lerp(a.minWidth, b.minWidth, t)
? MathUtils.lerpNullableFloat(a.minWidth, b.minWidth, t)
? Mathf.Lerp(a.maxWidth, b.maxWidth, t)
? MathUtils.lerpNullableFloat(a.maxWidth, b.maxWidth, t)
? Mathf.Lerp(a.minHeight, b.minHeight, t)
? MathUtils.lerpNullableFloat(a.minHeight, b.minHeight, t)
? Mathf.Lerp(a.maxHeight, b.maxHeight, t)
? MathUtils.lerpNullableFloat(a.maxHeight, b.maxHeight, t)
: float.PositiveInfinity
);
}

4
com.unity.uiwidgets/Runtime/rendering/editable.cs


if (_resetFloatingCursorAnimationValue != null) {
sizeAdjustmentX =
Mathf.Lerp(sizeAdjustmentX, 0f, _resetFloatingCursorAnimationValue.Value);
MathUtils.lerpNullableFloat(sizeAdjustmentX, 0f, _resetFloatingCursorAnimationValue.Value);
Mathf.Lerp(sizeAdjustmentY, 0f, _resetFloatingCursorAnimationValue.Value);
MathUtils.lerpNullableFloat(sizeAdjustmentY, 0f, _resetFloatingCursorAnimationValue.Value);
}
Rect floatingCaretPrototype = Rect.fromLTRB(

8
com.unity.uiwidgets/Runtime/rendering/stack.cs


}
return fromLTRB(
Mathf.Lerp(a.left, b.left, t),
Mathf.Lerp(a.top, b.top, t),
Mathf.Lerp(a.right, b.right, t),
Mathf.Lerp(a.bottom, b.bottom, t)
MathUtils.lerpNullableFloat(a.left, b.left, t),
MathUtils.lerpNullableFloat(a.top, b.top, t),
MathUtils.lerpNullableFloat(a.right, b.right, t),
MathUtils.lerpNullableFloat(a.bottom, b.bottom, t)
);
}

28
com.unity.uiwidgets/Runtime/ui2/geometry.cs


b = b ?? a;
return a + (b - a) * t;
}
public static float lerpNullableFloat(float a, float b, float t) {
return a + (b - a) * t;
}
public static int round(this float value) {
return Mathf.RoundToInt(value);

return a * (1.0f - t);
}
return new Offset(Mathf.Lerp(a.dx, b.dx, t), Mathf.Lerp(a.dy, b.dy, t));
return new Offset(MathUtils.lerpNullableFloat(a.dx, b.dx, t), MathUtils.lerpNullableFloat(a.dy, b.dy, t));
}
public bool Equals(Offset other) {

return a * (1.0f - t);
}
return new Size(Mathf.Lerp(a.width, b.width, t), Mathf.Lerp(a.height, b.height, t));
return new Size(MathUtils.lerpNullableFloat(a.width, b.width, t), MathUtils.lerpNullableFloat(a.height, b.height, t));
}
public bool Equals(Size other) {

}
return fromLTRB(
Mathf.Lerp(a.left, b.left, t),
Mathf.Lerp(a.top, b.top, t),
Mathf.Lerp(a.right, b.right, t),
Mathf.Lerp(a.bottom, b.bottom, t)
MathUtils.lerpNullableFloat(a.left, b.left, t),
MathUtils.lerpNullableFloat(a.top, b.top, t),
MathUtils.lerpNullableFloat(a.right, b.right, t),
MathUtils.lerpNullableFloat(a.bottom, b.bottom, t)
);
}

}
return elliptical(
Mathf.Lerp(a.x, b.x, t),
Mathf.Lerp(a.y, b.y, t)
MathUtils.lerpNullableFloat(a.x, b.x, t),
MathUtils.lerpNullableFloat(a.y, b.y, t)
);
}

}
return fromLTRBAndCorners(
Mathf.Lerp(a.left, b.left, t),
Mathf.Lerp(a.top, b.top, t),
Mathf.Lerp(a.right, b.right, t),
Mathf.Lerp(a.bottom, b.bottom, t),
MathUtils.lerpNullableFloat(a.left, b.left, t),
MathUtils.lerpNullableFloat(a.top, b.top, t),
MathUtils.lerpNullableFloat(a.right, b.right, t),
MathUtils.lerpNullableFloat(a.bottom, b.bottom, t),
Radius.lerp(a.tlRadius, b.tlRadius, t),
Radius.lerp(a.trRadius, b.trRadius, t),
Radius.lerp(a.brRadius, b.brRadius, t),

10
com.unity.uiwidgets/Runtime/ui2/painting.cs


}
return fromARGB(
((int) Mathf.Lerp(a.alpha, b.alpha, t)).clamp(0, 255),
((int) Mathf.Lerp(a.red, b.red, t)).clamp(0, 255),
((int) Mathf.Lerp(a.green, b.green, t)).clamp(0, 255),
((int) Mathf.Lerp(a.blue, b.blue, t)).clamp(0, 255)
((int) MathUtils.lerpNullableFloat(a.alpha, b.alpha, t)).clamp(0, 255),
((int) MathUtils.lerpNullableFloat(a.red, b.red, t)).clamp(0, 255),
((int) MathUtils.lerpNullableFloat(a.green, b.green, t)).clamp(0, 255),
((int) MathUtils.lerpNullableFloat(a.blue, b.blue, t)).clamp(0, 255)
);
}

return new Shadow(
color: Color.lerp(a.color, b.color, t),
offset: Offset.lerp(a.offset, b.offset, t),
blurRadius: Mathf.Lerp(a.blurRadius, b.blurRadius, t)
blurRadius: MathUtils.lerpNullableFloat(a.blurRadius, b.blurRadius, t)
);
}

2
com.unity.uiwidgets/Runtime/ui2/text.cs


public static FontWeight lerp(FontWeight a, FontWeight b, float t) {
if (a == null && b == null)
return null;
return values[Mathf.Lerp(a?.index ?? normal.index, b?.index ?? normal.index, t).round().clamp(0, 8)];
return values[MathUtils.lerpNullableFloat(a?.index ?? normal.index, b?.index ?? normal.index, t).round().clamp(0, 8)];
}
public static readonly Dictionary<int, string> map = new Dictionary<int, string> {

4
com.unity.uiwidgets/Runtime/widgets/editable_text.cs


}
else {
float lerpValue = _floatingCursorResetController.value;
float lerpX = Mathf.Lerp(_lastBoundedOffset.dx, finalPosition.dx, lerpValue);
float lerpY = Mathf.Lerp(_lastBoundedOffset.dy, finalPosition.dy, lerpValue);
float lerpX = MathUtils.lerpNullableFloat(_lastBoundedOffset.dx, finalPosition.dx, lerpValue);
float lerpY = MathUtils.lerpNullableFloat(_lastBoundedOffset.dy, finalPosition.dy, lerpValue);
renderEditable.setFloatingCursor(FloatingCursorDragState.Update, new Offset(lerpX, lerpY),
_lastTextPosition, resetLerpValue: lerpValue);

正在加载...
取消
保存