浏览代码

minor fixes

/siyaoH-1.17-PlatformMessage
xingweizhu 4 年前
当前提交
c3571e56
共有 4 个文件被更改,包括 58 次插入10 次删除
  1. 61
      com.unity.uiwidgets/Runtime/material/slider.cs
  2. 3
      com.unity.uiwidgets/Runtime/rendering/editable.cs
  3. 2
      com.unity.uiwidgets/Runtime/rendering/object.mixin.gen.cs
  4. 2
      com.unity.uiwidgets/Runtime/rendering/object.mixin.njk

61
com.unity.uiwidgets/Runtime/material/slider.cs


}
}
class _RenderSlider : RenderBox {
class _RenderSlider : RelayoutWhenSystemFontsChangeMixinRenderBox {
static float _positionAnimationDurationMilliSeconds = 75;
static float _minimumInteractionTimeMilliSeconds = 500;

int? divisions = null,
string label = null,
SliderThemeData sliderTheme = null,
ThemeData theme = null,
MediaQueryData mediaQueryData = null,
RuntimePlatform? platform = null,
ValueChanged<float> onChanged = null,

TextDirection? texDirection = null
TextDirection? textDirection = null
this.onChangeStart = onChangeStart;
this.onChangeEnd = onChangeEnd;
_platform = platform;

_sliderTheme = sliderTheme;
_theme = theme;
_textDirection = textDirection.Value;
_updateLabelPainter();
GestureArenaTeam team = new GestureArenaTeam();

float maxValue = 0;
foreach (Size size in _sliderPartSizes) {
if (size.width > maxValue) {
maxValue = size.width;
maxValue = size.height;
}
}

public ValueChanged<float> onChangeStart;
public ValueChanged<float> onChangeEnd;
public TextDirection textDirection {
get { return _textDirection; }
set {
if (value == _textDirection) {
return;
}
_textDirection = value;
_updateLabelPainter();
}
}
TextDirection _textDirection;
public bool showValueIndicator {
get {
bool showValueIndicator = false;

get {
switch (_platform) {
case RuntimePlatform.IPhonePlayer:
case RuntimePlatform.OSXPlayer:
case RuntimePlatform.OSXEditor:
return 0.1f;
default:
return 0.05f;

style: _sliderTheme.valueIndicatorTextStyle,
text: label
);
_labelPainter.textDirection = textDirection;
_labelPainter.textScaleFactor = _mediaQueryData.textScaleFactor;
_labelPainter.layout();
}

markNeedsLayout();
}
protected override void systemFontsDidChange() {
base.systemFontsDidChange();
_labelPainter.markNeedsLayout();
_updateLabelPainter();
}
public override void attach(object owner) {
base.attach(owner);

}
float _getValueFromVisualPosition(float visualPosition) {
switch (textDirection) {
case TextDirection.rtl:
return 1.0f - visualPosition;
case TextDirection.ltr:
return visualPosition;
}
return visualPosition;
}

void _handleDragUpdate(DragUpdateDetails details) {
if (isInteractive) {
float valueDelta = details.primaryDelta.Value / _trackRect.width;
_currentDragValue += valueDelta;
switch (textDirection) {
case TextDirection.rtl:
_currentDragValue -= valueDelta;
break;
case TextDirection.ltr:
_currentDragValue += valueDelta;
break;
}
onChanged(_discretize(_currentDragValue));
}
}

public override void paint(PaintingContext context, Offset offset) {
float value = _state.positionController.value;
float visualPosition = value;
switch (textDirection) {
case TextDirection.rtl:
visualPosition = 1.0f - value;
break;
case TextDirection.ltr:
visualPosition = value;
break;
}
Rect trackRect = _sliderTheme.trackShape.getPreferredRect(
parentBox: this,

parentBox: this,
sliderTheme: _sliderTheme,
enableAnimation: _enableAnimation,
textDirection: _textDirection,
thumbCenter: thumbCenter,
isDiscrete: isDiscrete,
isEnabled: isInteractive

labelPainter: _labelPainter,
parentBox: this,
sliderTheme: _sliderTheme,
textDirection: _textDirection,
value: _value
);
}

parentBox: this,
sliderTheme: _sliderTheme,
enableAnimation: _enableAnimation,
textDirection: _textDirection,
thumbCenter: thumbCenter,
isEnabled: isInteractive
);

labelPainter: _labelPainter,
parentBox: this,
sliderTheme: _sliderTheme,
textDirection: _textDirection,
value: _value
);
}

labelPainter: _labelPainter,
parentBox: this,
sliderTheme: _sliderTheme,
textDirection: _textDirection,
value: _value
);
}

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


markNeedsLayout();
}
public void systemFontsDidChange() {
protected override void systemFontsDidChange() {
base.systemFontsDidChange();
_textPainter.markNeedsLayout();
_textLayoutLastMaxWidth = null;
_textLayoutLastMinWidth = null;

2
com.unity.uiwidgets/Runtime/rendering/object.mixin.gen.cs


public abstract class RelayoutWhenSystemFontsChangeMixinRenderBox : RenderBox {
protected void systemFontsDidChange() {
protected virtual void systemFontsDidChange() {
markNeedsLayout();
}

2
com.unity.uiwidgets/Runtime/rendering/object.mixin.njk


{% macro RelayoutWhenSystemFontsChangeMixin(with) %}
public abstract class RelayoutWhenSystemFontsChangeMixin{{with}} : {{with}} {
protected void systemFontsDidChange() {
protected virtual void systemFontsDidChange() {
markNeedsLayout();
}

正在加载...
取消
保存