浏览代码

fix sample errors

/main
xingwei.zhu 5 年前
当前提交
7d4cd4a7
共有 2 个文件被更改,包括 20 次插入9 次删除
  1. 10
      Samples/UIWidgetSample/txt/TextFieldSample.cs
  2. 19
      Tests/Editor/RenderEditable.cs

10
Samples/UIWidgetSample/txt/TextFieldSample.cs


namespace UIWidgetsSample {
public class TextFieldSample : UIWidgetsSamplePanel {
protected override void Awake() {
base.Awake();
FontManager.instance.addFont(Resources.Load<Font>(path: "MaterialIcons-Regular"), "Material Icons");
}
}
protected override void OnEnable() {
base.OnEnable();
FontManager.instance.addFont(Resources.Load<Font>(path: "MaterialIcons-Regular"), "Material Icons");
}
}

19
Tests/Editor/RenderEditable.cs


using TextStyle = Unity.UIWidgets.painting.TextStyle;
namespace UIWidgets.Tests {
public class RenderEditable : EditorWindow {
public class RenderEditable : EditorWindow, TextSelectionDelegate {
readonly Func<RenderBox>[] _options;
readonly string[] _optionStrings;

new _FixedViewportOffset(0.0f), new ValueNotifier<bool>(true),
onSelectionChanged: this.selectionChanged, cursorColor: Color.fromARGB(255, 0, 0, 0),
maxLines: 100,
selectionColor: Color.fromARGB(255, 255, 0, 0))
selectionColor: Color.fromARGB(255, 255, 0, 0),
textSelectionDelegate: this)
));
span = new TextSpan("", children:

new _FixedViewportOffset(0.0f), new ValueNotifier<bool>(true),
onSelectionChanged: this.selectionChanged, cursorColor: Color.fromARGB(255, 0, 0, 0),
maxLines: 100,
selectionColor: Color.fromARGB(255, 255, 0, 0))
selectionColor: Color.fromARGB(255, 255, 0, 0),
textSelectionDelegate: this)
));
span = new TextSpan("", children:

new Unity.UIWidgets.rendering.RenderEditable(span, TextDirection.ltr,
new _FixedViewportOffset(0.0f), new ValueNotifier<bool>(true),
onSelectionChanged: this.selectionChanged, cursorColor: Color.fromARGB(255, 0, 0, 0),
selectionColor: Color.fromARGB(255, 255, 0, 0))
selectionColor: Color.fromARGB(255, 255, 0, 0),
textSelectionDelegate: this)
, width: 300));
return flexbox;
}

SelectionChangedCause cause) {
Debug.Log($"selection {selection}");
renderObject.selection = selection;
}
public TextEditingValue textEditingValue { get; set; }
public void hideToolbar() {
}
public void bringIntoView(TextPosition textPosition) {
}
}
}
正在加载...
取消
保存