浏览代码

Merge branch 'master' into gallery

/main
Yuncong Zhang 6 年前
当前提交
4f62ed91
共有 31 个文件被更改,包括 2508 次插入82 次删除
  1. 6
      Runtime/engine/UIWidgetsMessageManager.cs
  2. 17
      Runtime/engine/UIWidgetsPanel.cs
  3. 2
      Runtime/flow/opacity_layer.cs
  4. 2
      Runtime/flow/picture_layer.cs
  5. 19
      Runtime/flow/raster_cache.cs
  6. 2
      Runtime/painting/text_painter.cs
  7. 25
      Runtime/rendering/editable.cs
  8. 11
      Runtime/rendering/object.cs
  9. 142
      Runtime/service/keyboard.cs
  10. 27
      Runtime/service/text_input.cs
  11. 13
      Runtime/ui/geometry.cs
  12. 4
      Runtime/ui/matrix.cs
  13. 35
      Runtime/widgets/editable_text.cs
  14. 31
      Samples/UIWidgetSample/MaterialSample.cs
  15. 8
      Runtime/Plugins/platform/webgl.meta
  16. 1001
      Runtime/rendering/table.cs
  17. 11
      Runtime/rendering/table.cs.meta
  18. 273
      Runtime/rendering/table_border.cs
  19. 11
      Runtime/rendering/table_border.cs.meta
  20. 393
      Runtime/widgets/table.cs
  21. 11
      Runtime/widgets/table.cs.meta
  22. 289
      Runtime/Plugins/platform/webgl/UIWidgetsCanvasInput.jslib
  23. 36
      Runtime/Plugins/platform/webgl/UIWidgetsCanvasInput.jslib.meta
  24. 113
      Runtime/Plugins/platform/webgl/UIWidgetsInputPlugin.jslib
  25. 36
      Runtime/Plugins/platform/webgl/UIWidgetsInputPlugin.jslib.meta
  26. 65
      Runtime/Plugins/platform/webgl/webgl.jslib
  27. 7
      Runtime/Plugins/webgl.jslib
  28. 0
      /Runtime/Plugins/platform/ios/DeviceScreen.mm.meta
  29. 0
      /Runtime/Plugins/platform/webgl/webgl.jslib.meta
  30. 0
      /Runtime/Plugins/platform/ios/DeviceScreen.mm

6
Runtime/engine/UIWidgetsMessageManager.cs


managerObj.AddComponent<UIWidgetsMessageManager>();
}
#if UNITY_IOS || UNITY_ANDROID
#if UNITY_IOS || UNITY_ANDROID || UNITY_WEBGL
string _lastObjectName;
#endif

}
void UpdateNameIfNeed() {
#if UNITY_IOS || UNITY_ANDROID
#if UNITY_IOS || UNITY_ANDROID || UNITY_WEBGL
var name = this.gameObject.name;
if (name != this._lastObjectName) {

}
}
#if UNITY_IOS
#if UNITY_IOS || UNITY_WEBGL
[DllImport("__Internal")]
static extern void UIWidgetsMessageSetObjectName(string objectName);
#elif UNITY_ANDROID

17
Runtime/engine/UIWidgetsPanel.cs


size.y = Mathf.Round(size.y);
return size;
}
public Offset windowPosToScreenPos(Offset windowPos) {
Camera camera = null;
var canvas = this._uiWidgetsPanel.canvas;
if (canvas.renderMode != RenderMode.ScreenSpaceCamera) {
camera = canvas.GetComponent<GraphicRaycaster>().eventCamera;
}
var pos = new Vector2(windowPos.dx, windowPos.dy);
pos = pos * this.queryDevicePixelRatio() / this._uiWidgetsPanel.canvas.scaleFactor;
var rectTransform = this._uiWidgetsPanel.rectTransform;
var rect = rectTransform.rect;
pos.x += rect.min.x;
pos.y = rect.max.y - pos.y;
var worldPos = rectTransform.TransformPoint(new Vector2(pos.x, pos.y));
var screenPos = RectTransformUtility.WorldToScreenPoint(camera, worldPos);
return new Offset(screenPos.x, Screen.height - screenPos.y);
}
}
[RequireComponent(typeof(RectTransform))]

2
Runtime/flow/opacity_layer.cs


public override void preroll(PrerollContext context, Matrix3 matrix) {
var childMatrix = new Matrix3(matrix);
childMatrix.postTranslate(this._offset.dx, this._offset.dy); // TOOD: pre or post? https://github.com/flutter/engine/pull/7945
childMatrix.preTranslate(this._offset.dx, this._offset.dy); // TOOD: pre or post? https://github.com/flutter/engine/pull/7945
base.preroll(context, childMatrix);

2
Runtime/flow/picture_layer.cs


public override void preroll(PrerollContext context, Matrix3 matrix) {
if (context.rasterCache != null) {
Matrix3 ctm = new Matrix3(matrix);
ctm.postTranslate(this._offset.dx, this._offset.dy); // TOOD: pre or post? https://github.com/flutter/engine/pull/7945
ctm.preTranslate(this._offset.dx, this._offset.dy); // TOOD: pre or post? https://github.com/flutter/engine/pull/7945
ctm[2] = ctm[2].alignToPixel(context.devicePixelRatio);
ctm[5] = ctm[5].alignToPixel(context.devicePixelRatio);

19
Runtime/flow/raster_cache.cs


D.assert(matrix != null);
this.picture = picture;
this.matrix = new Matrix3(matrix);
var x = this.matrix[2] * devicePixelRatio;
var y = this.matrix[5] * devicePixelRatio;
this.matrix[2] = (x - (int) x) / devicePixelRatio; // x
this.matrix[5] = (y - (int) y) / devicePixelRatio; // y
D.assert(this.matrix[2] == 0);
D.assert(this.matrix[5] == 0);
D.assert(() => {
var x = this.matrix[2] * devicePixelRatio;
var y = this.matrix[5] * devicePixelRatio;
this.matrix[2] = (x - (int) x) / devicePixelRatio; // x
this.matrix[5] = (y - (int) y) / devicePixelRatio; // y
D.assert(Mathf.Abs(this.matrix[2]) <= 1e-5);
D.assert(Mathf.Abs(this.matrix[5]) <= 1e-5);
return true;
});
this.matrix[2] = 0.0f;
this.matrix[5] = 0.0f;
this.devicePixelRatio = devicePixelRatio;
}

2
Runtime/painting/text_painter.cs


}
Offset _getOffsetFromDownstream(int offset, Rect caretPrototype) {
var nextCodeUnit = this._text.codeUnitAt(offset);
var nextCodeUnit = this._text.codeUnitAt(offset - 1);
if (nextCodeUnit == null) {
return null;
}

25
Runtime/rendering/editable.cs


using System;
using System.Collections.Generic;
using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;

public void handleTapDown(TapDownDetails details) {
this._lastTapDownPosition = details.globalPosition - this._paintOffset;
if (!Application.isMobilePlatform) {
this._selectForTap(this._lastTapDownPosition);
}
if (this.onSelectionChanged != null) {
var position = this._textPainter.getPositionForOffset(this.globalToLocal(this._lastTapDownPosition));
this.onSelectionChanged(TextSelection.fromPosition(position), this, SelectionChangedCause.tap);
if (Application.isMobilePlatform) {
this._selectForTap(this._lastTapDownPosition);
}
}

}
}
if (this._hasFocus) {
var caretOffset = this._textPainter.getOffsetForCaret(this._selection.extendPos,
Rect.fromLTWH(0, 0, 1, this.preferredLineHeight));
var caretRec = this._caretPrototype.shift(caretOffset + effectiveOffset);
Input.compositionCursorPos = new Vector2(caretRec.left, caretRec.bottom);
}
this._textPainter.paint(context.canvas, effectiveOffset);
}

return new TextSelection(baseOffset: word.start, extentOffset: word.end);
}
void _selectForTap(Offset pointerPosition) {
if (this.onSelectionChanged != null) {
var position = this._textPainter.getPositionForOffset(this.globalToLocal(pointerPosition));
this.onSelectionChanged(TextSelection.fromPosition(position), this, SelectionChangedCause.tap);
}
}
bool _isMultiline {
get { return this._maxLines != 1; }
}

11
Runtime/rendering/object.cs


public void pushTransform(bool needsCompositing, Offset offset, Matrix3 transform,
PaintingContextCallback painter) {
var effectiveTransform = Matrix3.makeTrans(offset.dx, offset.dy);
effectiveTransform.preConcat(transform);
effectiveTransform.preTranslate(-offset.dx, -offset.dy);
Matrix3 effectiveTransform;
if (offset == null || offset == Offset.zero) {
effectiveTransform = transform;
} else {
effectiveTransform = Matrix3.makeTrans(offset.dx, offset.dy);
effectiveTransform.preConcat(transform);
effectiveTransform.preTranslate(-offset.dx, -offset.dy);
}
if (needsCompositing) {
var inverse = Matrix3.I();

142
Runtime/service/keyboard.cs


void hide();
void setEditingState(TextEditingValue value);
void setIMEPos(Offset imeGlobalPos);
bool hashPreview();
bool imeRequired();
}
public interface TextInputUpdateListener {

this._value = value;
}
public void setIMEPos(Offset imeGlobalPos) {
var uiWidgetWindowAdapter = Window.instance as UIWidgetWindowAdapter;
if (uiWidgetWindowAdapter != null) {
var screenPos = uiWidgetWindowAdapter.windowPosToScreenPos(imeGlobalPos);
Input.compositionCursorPos = new Vector2(screenPos.dx, screenPos.dy);
}
else { // editor window case
Input.compositionCursorPos = new Vector2(imeGlobalPos.dx, imeGlobalPos.dy);
}
}
public void setClient(int client, TextInputConfiguration configuration) {
this._client = client;
}

}
public bool hashPreview() {
return false;
public bool imeRequired() {
return true;
}
public void OnGUI() {

this._client = 0;
}
public bool hashPreview() {
return this._keyboard != null;
public bool imeRequired() {
return false;
}
public void setIMEPos(Offset imeGlobalPos) {
}
public void setClient(int client, TextInputConfiguration configuration) {

}
}
#if UNITY_IOS || UNITY_ANDROID
class UIWidgetsTouchScreenKeyboardDelegate : KeyboardDelegate {
public UIWidgetsTouchScreenKeyboardDelegate() {
UIWidgetsMessageManager.instance.AddChannelMessageDelegate("TextInput", this.handleMethodCall);
abstract class AbstractUIWidgetsKeyboardDelegate : KeyboardDelegate {
protected AbstractUIWidgetsKeyboardDelegate() {
UIWidgetsMessageManager.instance.AddChannelMessageDelegate("TextInput", this._handleMethodCall);
UIWidgetsMessageManager.instance.RemoveChannelMessageDelegate("TextInput", this.handleMethodCall);
UIWidgetsMessageManager.instance.RemoveChannelMessageDelegate("TextInput", this._handleMethodCall);
public void show() {
UIWidgetsTextInputShow();
}
public abstract void show();
public void hide() {
UIWidgetsTextInputHide();
}
public abstract void hide();
public void setEditingState(TextEditingValue value) {
UIWidgetsTextInputSetTextInputEditingState(value.toJson().ToString());
}
public abstract void setEditingState(TextEditingValue value);
public abstract void setIMEPos(Offset imeGlobalPos);
public abstract void setClient(int client, TextInputConfiguration configuration);
public void setClient(int client, TextInputConfiguration configuration) {
UIWidgetsTextInputSetClient(client, configuration.toJson().ToString());
}
public void clearClient() {
UIWidgetsTextInputClearTextInputClient();
}
public bool hashPreview() {
public abstract void clearClient();
public virtual bool imeRequired() {
void handleMethodCall(string method, List<JSONNode> args) {
void _handleMethodCall(string method, List<JSONNode> args) {
if (TextInput._currentConnection == null) {
return;
}

throw new UIWidgetsError($"unknown method ${method}");
}
}
}
}
#if UNITY_WEBGL
class UIWidgetsWebGLKeyboardDelegate : AbstractUIWidgetsKeyboardDelegate {
public override void show() {
Input.imeCompositionMode = IMECompositionMode.On;
}
public override void hide() {
}
public override void setEditingState(TextEditingValue value) {
UIWidgetsTextInputSetTextInputEditingState(value.toJson().ToString());
}
public override void setIMEPos(Offset imeGlobalPos) {
var window = Window.instance as UIWidgetWindowAdapter;
var canvasPos = window.windowPosToScreenPos(imeGlobalPos);
UIWidgetsTextInputSetIMEPos(canvasPos.dx, canvasPos.dy);
}
public override void setClient(int client, TextInputConfiguration configuration) {
WebGLInput.captureAllKeyboardInput = false;
Input.imeCompositionMode = IMECompositionMode.On;
UIWidgetsTextInputSetClient(client, configuration.toJson().ToString());
}
public override void clearClient() {
UIWidgetsTextInputClearTextInputClient();
}
public override bool imeRequired() {
return true;
}
[DllImport ("__Internal")]
internal static extern void UIWidgetsTextInputSetClient(int client, string configuration);
[DllImport ("__Internal")]
internal static extern void UIWidgetsTextInputSetTextInputEditingState(string jsonText);
[DllImport ("__Internal")]
internal static extern void UIWidgetsTextInputClearTextInputClient();
[DllImport ("__Internal")]
internal static extern void UIWidgetsTextInputSetIMEPos(float x, float y);
}
#endif
#if UNITY_IOS || UNITY_ANDROID
class UIWidgetsTouchScreenKeyboardDelegate : AbstractUIWidgetsKeyboardDelegate {
public override void show() {
UIWidgetsTextInputShow();
}
public override void hide() {
UIWidgetsTextInputHide();
}
public override void setEditingState(TextEditingValue value) {
UIWidgetsTextInputSetTextInputEditingState(value.toJson().ToString());
}
public override void setIMEPos(Offset imeGlobalPos) {
}
public override void setClient(int client, TextInputConfiguration configuration) {
UIWidgetsTextInputSetClient(client, configuration.toJson().ToString());
}
public override void clearClient() {
UIWidgetsTextInputClearTextInputClient();
}
#if UNITY_IOS

internal static extern void UIWidgetsTextInputSetClient(int client, string configuration);
[DllImport ("__Internal")]
internal static extern void UIWidgetsTextInputSetTextInputEditingState(string jsonText); // also send to client ?
internal static extern void UIWidgetsTextInputSetTextInputEditingState(string jsonText);
[DllImport ("__Internal")]
internal static extern void UIWidgetsTextInputClearTextInputClient();

27
Runtime/service/text_input.cs


TextInput.keyboardDelegate.setEditingState(value);
}
public void setCompositionCursorPos(float x, float y) {
public void setIMEPos(Offset imeGlobalPos) {
TextInput.setCompositionCursorPos(x, y);
D.assert(imeGlobalPos != null);
D.assert(this.imeRequired());
TextInput.keyboardDelegate.setIMEPos(imeGlobalPos);
}
public bool imeRequired() {
return TextInput.keyboardDelegate != null && TextInput.keyboardDelegate.imeRequired();
public void close() {
if (this.attached) {

D.assert(client != null);
var connection = new TextInputConnection(client);
_currentConnection = connection;
string x = configuration.toJson();
if (TouchScreenKeyboard.isSupported) {
if (Application.isEditor) {
keyboardDelegate = new DefaultKeyboardDelegate();
} else {
#if UNITY_IOS || UNITY_ANDROID
if (configuration.unityTouchKeyboard) {
keyboardDelegate = new UnityTouchScreenKeyboardDelegate();

}
#elif UNITY_WEBGL
keyboardDelegate = new UIWidgetsWebGLKeyboardDelegate();
keyboardDelegate = new UnityTouchScreenKeyboardDelegate();
keyboardDelegate = new DefaultKeyboardDelegate();
else {
keyboardDelegate = new DefaultKeyboardDelegate();
}
keyboardDelegate.setClient(connection._id, configuration);
return connection;
}

if (_currentConnection != null && _currentConnection._window == Window.instance) {
(keyboardDelegate as TextInputOnGUIListener)?.OnGUI();
}
}
public static void setCompositionCursorPos(float x, float y) {
Input.compositionCursorPos = new Vector2(x, y);
}
internal static void _updateEditingState(int client, TextEditingValue value) {

13
Runtime/ui/geometry.cs


Mathf.Floor(this.right), Mathf.Floor(this.bottom));
}
public Rect normalize() {
if (this.left <= this.right && this.top <= this.bottom) {
return this;
}
return fromLTRB(
Mathf.Min(this.left, this.right),
Mathf.Min(this.top, this.bottom),
Mathf.Max(this.left, this.right),
Mathf.Max(this.top, this.bottom)
);
}
public static Rect lerp(Rect a, Rect b, float t) {
if (a == null && b == null) {
return null;

4
Runtime/ui/matrix.cs


src.top + ty,
src.right + tx,
src.bottom + ty
);
).normalize();
return true;
}

src.top * sy + ty,
src.right * sx + tx,
src.bottom * sy + ty
);
).normalize();
}
public static bool operator ==(Matrix3 a, Matrix3 b) {

35
Runtime/widgets/editable_text.cs


oldWidget.controller.removeListener(this._didChangeTextEditingValue);
this.widget.controller.addListener(this._didChangeTextEditingValue);
this._updateRemoteEditingValueIfNeeded();
this._updateImePosIfNeed();
}
if (this.widget.focusNode != oldWidget.focusNode) {

));
this._textInputConnection.setEditingState(localValue);
this._updateImePosIfNeed();
}
this._textInputConnection.show();

this._hideSelectionOverlayIfNeeded();
if (this.widget.selectionControls != null && !this._unityKeyboard()) {
if (this.widget.selectionControls != null && Application.isMobilePlatform && !this._unityKeyboard()) {
this._selectionOverlay = new TextSelectionOverlay(
context: this.context,
value: this._value,

this._value = value;
this._updateRemoteEditingValueIfNeeded();
this._updateImePosIfNeed();
}
else {
this._value = value;

void _didChangeTextEditingValue() {
this._updateRemoteEditingValueIfNeeded();
this._updateImePosIfNeed();
this._startOrStopCursorTimerIfNeeded();
this._updateOrDisposeSelectionOverlayIfNeeded();
this._textChangedSinceLastCaretUpdate = true;

// in the case
bool _unityKeyboard() {
return TouchScreenKeyboard.isSupported && this.widget.unityTouchKeyboard;
}
Offset _getImePos() {
if (this._hasInputConnection && this._textInputConnection.imeRequired()) {
var localPos = this.renderEditable.getLocalRectForCaret(this._value.selection.basePos).bottomLeft;
return this.renderEditable.localToGlobal(localPos);
}
return null;
}
bool _imePosUpdateScheduled = false;
void _updateImePosIfNeed() {
if (!this._hasInputConnection || !this._textInputConnection.imeRequired()) {
return;
}
if (this._imePosUpdateScheduled) {
return;
}
this._imePosUpdateScheduled = true;
SchedulerBinding.instance.addPostFrameCallback(_ => {
this._imePosUpdateScheduled = false;
if (!this._hasInputConnection) {
return;
}
this._textInputConnection.setIMEPos(this._getImePos());
});
}
}

31
Samples/UIWidgetSample/MaterialSample.cs


namespace UIWidgetsSample {
public class MaterialSample : UIWidgetsSamplePanel {
int testCaseId = 3;
int testCaseId = 4;
new MaterialTabBarWidget()
new MaterialTabBarWidget(),
new TableWidget()
};
protected override Widget createWidget() {

protected override void OnEnable() {
base.OnEnable();
FontManager.instance.addFont(Resources.Load<Font>(path: "MaterialIcons-Regular"));
}
}
class TableWidget : StatelessWidget {
public TableWidget(Key key = null) : base(key) {
}
public override Widget build(BuildContext context) {
return new Scaffold(
body: new Table(
children: new List<TableRow> {
new TableRow(
decoration: new BoxDecoration(color: Colors.blue),
children: new List<Widget> {
new Text("item 1"),
new Text("item 2")
}
),
new TableRow(children: new List<Widget> {
new Text("item 3"),
new Text("item 4")
}
)
},
defaultVerticalAlignment: TableCellVerticalAlignment.middle));
}
}

8
Runtime/Plugins/platform/webgl.meta


fileFormatVersion: 2
guid: 2a5204f908bc54d789ea5933245a3bf5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

1001
Runtime/rendering/table.cs
文件差异内容过多而无法显示
查看文件

11
Runtime/rendering/table.cs.meta


fileFormatVersion: 2
guid: d05c9824abf8446e3b28c9734f104dd4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

273
Runtime/rendering/table_border.cs


using System;
using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
namespace Unity.UIWidgets.rendering {
public class TableBorder : IEquatable<TableBorder> {
public TableBorder(
BorderSide top = null,
BorderSide right = null,
BorderSide bottom = null,
BorderSide left = null,
BorderSide horizontalInside = null,
BorderSide verticalInside = null
) {
this.top = top ?? BorderSide.none;
this.right = right ?? BorderSide.none;
this.bottom = bottom ?? BorderSide.none;
this.left = left ?? BorderSide.none;
this.horizontalInside = horizontalInside ?? BorderSide.none;
this.verticalInside = verticalInside ?? BorderSide.none;
}
public static TableBorder all(
Color color = null,
float width = 1.0f,
BorderStyle style = BorderStyle.solid
) {
color = color ?? new Color(0xFF000000);
BorderSide side = new BorderSide(color: color, width: width, style: style);
return new TableBorder(
top: side, right: side, bottom: side, left: side, horizontalInside: side, verticalInside: side);
}
public static TableBorder symmetric(
BorderSide inside = null,
BorderSide outside = null
) {
inside = inside ?? BorderSide.none;
outside = outside ?? BorderSide.none;
return new TableBorder(
top: outside,
right: outside,
bottom: outside,
left: outside,
horizontalInside: inside,
verticalInside: inside
);
}
public readonly BorderSide top;
public readonly BorderSide right;
public readonly BorderSide bottom;
public readonly BorderSide left;
public readonly BorderSide horizontalInside;
public readonly BorderSide verticalInside;
public EdgeInsets dimensions {
get {
return EdgeInsets.fromLTRB(this.left.width,
this.top.width,
this.right.width,
this.bottom.width);
}
}
public bool isUniform {
get {
D.assert(this.top != null);
D.assert(this.right != null);
D.assert(this.bottom != null);
D.assert(this.left != null);
D.assert(this.horizontalInside != null);
D.assert(this.verticalInside != null);
Color topColor = this.top.color;
if (this.right.color != topColor ||
this.bottom.color != topColor ||
this.left.color != topColor ||
this.horizontalInside.color != topColor ||
this.verticalInside.color != topColor) {
return false;
}
float topWidth = this.top.width;
if (this.right.width != topWidth ||
this.bottom.width != topWidth ||
this.left.width != topWidth ||
this.horizontalInside.width != topWidth ||
this.verticalInside.width != topWidth) {
return false;
}
BorderStyle topStyle = this.top.style;
if (this.right.style != topStyle ||
this.bottom.style != topStyle ||
this.left.style != topStyle ||
this.horizontalInside.style != topStyle ||
this.verticalInside.style != topStyle) {
return false;
}
return true;
}
}
TableBorder scale(float t) {
return new TableBorder(
top: this.top.scale(t),
right: this.right.scale(t),
bottom: this.bottom.scale(t),
left: this.left.scale(t),
horizontalInside: this.horizontalInside.scale(t),
verticalInside: this.verticalInside.scale(t)
);
}
public static TableBorder lerp(TableBorder a, TableBorder b, float t) {
if (a == null && b == null) {
return null;
}
if (a == null) {
return b.scale(t);
}
if (b == null) {
return a.scale(1.0f - t);
}
return new TableBorder(
top: BorderSide.lerp(a.top, b.top, t),
right: BorderSide.lerp(a.right, b.right, t),
bottom: BorderSide.lerp(a.bottom, b.bottom, t),
left: BorderSide.lerp(a.left, b.left, t),
horizontalInside: BorderSide.lerp(a.horizontalInside, b.horizontalInside, t),
verticalInside: BorderSide.lerp(a.verticalInside, b.verticalInside, t)
);
}
public void paint(Canvas canvas, Rect rect, List<float> rows, List<float> columns) {
D.assert(this.top != null);
D.assert(this.right != null);
D.assert(this.bottom != null);
D.assert(this.left != null);
D.assert(this.horizontalInside != null);
D.assert(this.verticalInside != null);
D.assert(canvas != null);
D.assert(rect != null);
D.assert(rows != null);
D.assert(rows.isEmpty() || (rows.First() >= 0.0f && rows.Last() <= rect.height));
D.assert(columns != null);
D.assert(columns.isEmpty() || (columns.First() >= 0.0f && columns.Last() <= rect.width));
if (columns.isNotEmpty() || rows.isNotEmpty()) {
Paint paint = new Paint();
if (columns.isNotEmpty()) {
switch (this.verticalInside.style) {
case BorderStyle.solid: {
paint.color = this.verticalInside.color;
paint.strokeWidth = this.verticalInside.width;
paint.style = PaintingStyle.stroke;
Path path = new Path();
foreach (float x in columns) {
path.moveTo(rect.left + x, rect.top);
path.lineTo(rect.left + x, rect.bottom);
}
canvas.drawPath(path, paint);
break;
}
case BorderStyle.none: {
break;
}
}
}
if (rows.isNotEmpty()) {
switch (this.horizontalInside.style) {
case BorderStyle.solid: {
paint.color = this.horizontalInside.color;
paint.strokeWidth = this.horizontalInside.width;
paint.style = PaintingStyle.stroke;
Path path = new Path();
foreach (float y in rows) {
path.moveTo(rect.left, rect.top + y);
path.lineTo(rect.right, rect.top + y);
}
canvas.drawPath(path, paint);
break;
}
case BorderStyle.none: {
break;
}
}
}
BorderUtils.paintBorder(canvas, rect, top: this.top, right: this.right, bottom: this.bottom,
left: this.left);
}
}
public bool Equals(TableBorder other) {
if (ReferenceEquals(null, other)) {
return false;
}
if (ReferenceEquals(this, other)) {
return true;
}
return other.top == this.top &&
other.right == this.right &&
other.bottom == this.bottom &&
other.left == this.left &&
other.horizontalInside == this.horizontalInside &&
other.verticalInside == this.verticalInside;
}
public override bool Equals(object obj) {
if (ReferenceEquals(null, obj)) {
return false;
}
if (ReferenceEquals(this, obj)) {
return true;
}
if (obj.GetType() != this.GetType()) {
return false;
}
return this.Equals((TableBorder) obj);
}
public static bool operator ==(TableBorder left, TableBorder right) {
return Equals(left, right);
}
public static bool operator !=(TableBorder left, TableBorder right) {
return !Equals(left, right);
}
public override int GetHashCode() {
unchecked {
var hashCode = this.top.GetHashCode();
hashCode = (hashCode * 397) ^ this.right.GetHashCode();
hashCode = (hashCode * 397) ^ this.bottom.GetHashCode();
hashCode = (hashCode * 397) ^ this.left.GetHashCode();
hashCode = (hashCode * 397) ^ this.horizontalInside.GetHashCode();
hashCode = (hashCode * 397) ^ this.verticalInside.GetHashCode();
return hashCode;
}
}
public override string ToString() {
return
$"TableBorder({this.top}, {this.right}, {this.bottom}, {this.left}, {this.horizontalInside}, {this.verticalInside})";
}
}
}

11
Runtime/rendering/table_border.cs.meta


fileFormatVersion: 2
guid: ca951bb29ed0546f0b6c9ae9a42985bc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

393
Runtime/widgets/table.cs


using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;
namespace Unity.UIWidgets.widgets {
public class TableRow {
public TableRow(
LocalKey key = null,
Decoration decoration = null,
List<Widget> children = null
) {
this.key = key;
this.decoration = decoration;
this.children = children;
}
public readonly LocalKey key;
public readonly Decoration decoration;
public readonly List<Widget> children;
public override string ToString() {
return "TableRow("
+ (this.key != null ? this.key.ToString() : "")
+ (this.decoration != null ? this.decoration.toString() : "")
+ (this.children == null ? "child list is null" :
this.children.isEmpty() ? "no children" :
this.children.ToString())
+ ")";
}
}
class _TableElementRow {
public _TableElementRow(
LocalKey key = null,
List<Element> children = null
) {
this.key = key;
this.children = children;
}
public readonly LocalKey key;
public readonly List<Element> children;
}
public class Table : RenderObjectWidget {
public Table(
Key key = null,
List<TableRow> children = null,
Dictionary<int, TableColumnWidth> columnWidths = null,
TableColumnWidth defaultColumnWidth = null,
TableBorder border = null,
TableCellVerticalAlignment defaultVerticalAlignment = TableCellVerticalAlignment.top,
TextBaseline? textBaseline = null
) : base(key: key) {
children = children ?? new List<TableRow>();
defaultColumnWidth = defaultColumnWidth ?? new FlexColumnWidth(1.0f);
this.children = children;
this.columnWidths = columnWidths;
this.defaultColumnWidth = defaultColumnWidth;
this.border = border;
this.defaultVerticalAlignment = defaultVerticalAlignment;
this.textBaseline = textBaseline;
D.assert(() => {
if (children.Any((TableRow row) => {
return row.children.Any((Widget cell) => { return cell == null; });
})) {
throw new UIWidgetsError(
"One of the children of one of the rows of the table was null.\n" +
"The children of a TableRow must not be null."
);
}
return true;
});
D.assert(() => {
if (children.Any((TableRow row1) => {
return row1.key != null &&
children.Any((TableRow row2) => { return row1 != row2 && row1.key == row2.key; });
})) {
throw new UIWidgetsError(
"Two or more TableRow children of this Table had the same key.\n" +
"All the keyed TableRow children of a Table must have different Keys."
);
}
return true;
});
D.assert(() => {
if (children.isNotEmpty()) {
int cellCount = this.children.First().children.Count;
if (children.Any((TableRow row) => { return row.children.Count != cellCount; })) {
throw new UIWidgetsError(
"Table contains irregular row lengths.\n" +
"Every TableRow in a Table must have the same number of children, so that every cell is filled. " +
"Otherwise, the table will contain holes."
);
}
}
return true;
});
this._rowDecorations = null;
if (children.Any((TableRow row) => { return row.decoration != null; })) {
this._rowDecorations = new List<Decoration>();
foreach (TableRow row in children) {
this._rowDecorations.Add(row.decoration);
}
}
D.assert(() => {
List<Widget> flatChildren = new List<Widget>();
foreach (TableRow row in children) {
flatChildren.AddRange(row.children);
}
if (WidgetsD.debugChildrenHaveDuplicateKeys(this, flatChildren)) {
throw new UIWidgetsError(
"Two or more cells in this Table contain widgets with the same key.\n" +
"Every widget child of every TableRow in a Table must have different keys. The cells of a Table are " +
"flattened out for processing, so separate cells cannot have duplicate keys even if they are in " +
"different rows."
);
}
return true;
});
}
public readonly List<TableRow> children;
public readonly Dictionary<int, TableColumnWidth> columnWidths;
public readonly TableColumnWidth defaultColumnWidth;
public readonly TableBorder border;
public readonly TableCellVerticalAlignment defaultVerticalAlignment;
public readonly TextBaseline? textBaseline;
public readonly List<Decoration> _rowDecorations;
public override Element createElement() {
return new _TableElement(this);
}
public override RenderObject createRenderObject(BuildContext context) {
return new RenderTable(
columns: this.children.isNotEmpty() ? this.children[0].children.Count : 0,
rows: this.children.Count,
columnWidths: this.columnWidths,
defaultColumnWidth: this.defaultColumnWidth,
border: this.border,
rowDecorations: this._rowDecorations,
configuration: ImageUtils.createLocalImageConfiguration(context),
defaultVerticalAlignment: this.defaultVerticalAlignment,
textBaseline: this.textBaseline
);
}
public override void updateRenderObject(BuildContext context, RenderObject renderObject) {
RenderTable _renderObject = (RenderTable) renderObject;
D.assert(_renderObject.columns == (this.children.isNotEmpty() ? this.children[0].children.Count : 0));
D.assert(_renderObject.rows == this.children.Count);
_renderObject.columnWidths = this.columnWidths;
_renderObject.defaultColumnWidth = this.defaultColumnWidth;
_renderObject.border = this.border;
_renderObject.rowDecorations = this._rowDecorations;
_renderObject.configuration = ImageUtils.createLocalImageConfiguration(context);
_renderObject.defaultVerticalAlignment = this.defaultVerticalAlignment;
_renderObject.textBaseline = this.textBaseline;
}
}
class _TableElement : RenderObjectElement {
public _TableElement(Table widget) : base(widget) {
}
public new Table widget {
get { return (Table) base.widget; }
}
public new RenderTable renderObject {
get { return (RenderTable) base.renderObject; }
}
List<_TableElementRow> _children = new List<_TableElementRow>();
bool _debugWillReattachChildren = false;
public override void mount(Element parent, object newSlot) {
base.mount(parent, newSlot);
D.assert(!this._debugWillReattachChildren);
D.assert(() => {
this._debugWillReattachChildren = true;
return true;
});
this._children.Clear();
foreach (TableRow row in this.widget.children) {
List<Element> elements = new List<Element>();
foreach (Widget child in row.children) {
D.assert(child != null);
elements.Add(this.inflateWidget(child, null));
}
this._children.Add(
new _TableElementRow(
key: row.key,
children: elements)
);
}
D.assert(() => {
this._debugWillReattachChildren = false;
return true;
});
this._updateRenderObjectChildren();
}
protected override void insertChildRenderObject(RenderObject child, object slot) {
D.assert(this._debugWillReattachChildren);
this.renderObject.setupParentData(child);
}
protected override void moveChildRenderObject(RenderObject child, object slot) {
D.assert(this._debugWillReattachChildren);
}
protected override void removeChildRenderObject(RenderObject child) {
D.assert(() => {
if (this._debugWillReattachChildren) {
return true;
}
foreach (Element forgottenChild in this._forgottenChildren) {
if (forgottenChild.renderObject == child) {
return true;
}
}
return false;
});
TableCellParentData childParentData = (TableCellParentData) child.parentData;
this.renderObject.setChild(childParentData.x, childParentData.y, null);
}
readonly HashSet<Element> _forgottenChildren = new HashSet<Element>();
public override void update(Widget newWidget) {
D.assert(!this._debugWillReattachChildren);
D.assert(() => {
this._debugWillReattachChildren = true;
return true;
});
Table _newWidget = (Table) newWidget;
Dictionary<LocalKey, List<Element>> oldKeyedRows = new Dictionary<LocalKey, List<Element>>();
foreach (_TableElementRow row in this._children) {
if (row.key != null) {
oldKeyedRows[row.key] = row.children;
}
}
List<_TableElementRow> oldUnkeyedRows = new List<_TableElementRow>();
foreach (_TableElementRow row in this._children) {
if (row.key == null) {
oldUnkeyedRows.Add(row);
}
}
List<_TableElementRow> newChildren = new List<_TableElementRow>();
HashSet<List<Element>> taken = new HashSet<List<Element>>();
int unkeyedRow = 0;
foreach (TableRow row in _newWidget.children) {
List<Element> oldChildren = null;
if (row.key != null && oldKeyedRows.ContainsKey(row.key)) {
oldChildren = oldKeyedRows[row.key];
taken.Add(oldChildren);
}
else if (row.key == null && unkeyedRow < oldUnkeyedRows.Count) {
oldChildren = oldUnkeyedRows[unkeyedRow].children;
unkeyedRow++;
}
else {
oldChildren = new List<Element>();
}
newChildren.Add(new _TableElementRow(
key: row.key,
children: this.updateChildren(oldChildren, row.children,
forgottenChildren: this._forgottenChildren))
);
}
while (unkeyedRow < oldUnkeyedRows.Count) {
this.updateChildren(oldUnkeyedRows[unkeyedRow].children, new List<Widget>(),
forgottenChildren: this._forgottenChildren);
unkeyedRow++;
}
foreach (List<Element> oldChildren in oldKeyedRows.Values) {
if (taken.Contains(oldChildren)) {
continue;
}
this.updateChildren(oldChildren, new List<Widget>(), forgottenChildren: this._forgottenChildren);
}
D.assert(() => {
this._debugWillReattachChildren = false;
return true;
});
this._children = newChildren;
this._updateRenderObjectChildren();
this._forgottenChildren.Clear();
base.update(newWidget);
D.assert(this.widget == newWidget);
}
void _updateRenderObjectChildren() {
D.assert(this.renderObject != null);
List<RenderBox> renderBoxes = new List<RenderBox>();
foreach (_TableElementRow row in this._children) {
foreach (Element child in row.children) {
renderBoxes.Add((RenderBox) child.renderObject);
}
}
this.renderObject.setFlatChildren(
this._children.isNotEmpty() ? this._children[0].children.Count : 0,
renderBoxes
);
}
public override void visitChildren(ElementVisitor visitor) {
foreach (_TableElementRow row in this._children) {
foreach (Element child in row.children) {
if (!this._forgottenChildren.Contains(child)) {
visitor(child);
}
}
}
}
protected override void forgetChild(Element child) {
this._forgottenChildren.Add(child);
}
}
public class TableCell : ParentDataWidget<Table> {
public TableCell(
Key key = null,
TableCellVerticalAlignment? verticalAlignment = null,
Widget child = null
) : base(key: key, child: child) {
this.verticalAlignment = verticalAlignment;
}
public readonly TableCellVerticalAlignment? verticalAlignment;
public override void applyParentData(RenderObject renderObject) {
TableCellParentData parentData = (TableCellParentData) renderObject.parentData;
if (parentData.verticalAlignment != this.verticalAlignment) {
parentData.verticalAlignment = this.verticalAlignment;
AbstractNodeMixinDiagnosticableTree targetParent = renderObject.parent;
if (targetParent is RenderObject) {
((RenderObject) targetParent).markNeedsLayout();
}
}
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new EnumProperty<TableCellVerticalAlignment?>("verticalAlignment", this.verticalAlignment));
}
}
}

11
Runtime/widgets/table.cs.meta


fileFormatVersion: 2
guid: 17e636abadff64cdeb536be14444d7eb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

289
Runtime/Plugins/platform/webgl/UIWidgetsCanvasInput.jslib


mergeInto(LibraryManager.library, {
$UIWidgetsCanvasInputModule__postset: 'UIWidgetsCanvasInputModule.init();',
$UIWidgetsCanvasInputModule: { init: function() {
// create a buffer that stores all inputs so that tabbing
// between them is made possible.
var inputs = [];
// initialize the Canvas Input
var UIWidgetsCanvasInput = window.UIWidgetsCanvasInput = function(o) {
var self = this;
o = o ? o : {};
// setup the defaults
self._canvas = o.canvas || null;
self._x = o.x || 0;
self._y = o.y || 0;
self._type = o.type || 'text';
self._onchange = o.onchange || function() {};
self._onsubmit = o.onsubmit || function() {};
self._onkeydown = o.onkeydown || function() {};
self._onkeyup = o.onkeyup || function() {};
self._onfocus = o.onfocus || function() {};
self._onblur = o.onblur || function() {};
self._multiline = o.multiline || false;
self._hasFocus = false;
self._createHiddenInput();
self.value(o.value || '');
self._inputsIndex = inputs.length - 1;
};
// setup the prototype
UIWidgetsCanvasInput.prototype = {
x: function(data) {
var self = this;
if (typeof data !== 'undefined') {
self._x = data;
self._updateHiddenInput();
return;
} else {
return self._x;
}
},
y: function(data) {
var self = this;
if (typeof data !== 'undefined') {
self._y = data;
self._updateHiddenInput();
return;
} else {
return self._y;
}
},
multiline: function(data) {
var self = this;
if (typeof data !== 'undefined') {
if (data === self._multiline) {
return;
}
self._multiline = !!data;
self._createHiddenInput();
return;
} else {
return self._multiline;
}
},
type: function(data) {
var self = this;
if (typeof data !== 'undefined') {
self._type = data;
self._hiddenInput.type = data;
return;
} else {
return self._type;
}
},
value: function(data) {
var self = this;
if (typeof data !== 'undefined') {
self._hiddenInput.value = data;
return;
} else {
return self._hiddenInput.value;
}
},
selection: function() {
var self = this;
return [self._hiddenInput.selectionStart, self._hiddenInput.selectionEnd];
},
onsubmit: function(fn) {
var self = this;
if (typeof fn !== 'undefined') {
self._onsubmit = fn;
return self;
} else {
self._onsubmit();
}
},
onkeydown: function(fn) {
var self = this;
if (typeof fn !== 'undefined') {
self._onkeydown = fn;
return self;
} else {
self._onkeydown();
}
},
onkeyup: function(fn) {
var self = this;
if (typeof fn !== 'undefined') {
self._onkeyup = fn;
return self;
} else {
self._onkeyup();
}
},
focus: function() {
var self = this;
// only fire the focus event when going from unfocussed
if (!self._hasFocus) {
self._onfocus(self);
// remove focus from all other inputs
for (var i=0; i<inputs.length; i++) {
if (inputs[i]._hasFocus) {
inputs[i].blur();
}
}
}
self._hasFocus = true;
self._hiddenInput.focus();
return;
},
blur: function(_this) {
var self = _this || this;
self._onblur(self);
self._hasFocus = false;
self._hiddenInput.blur();
},
keydown: function(e, self) {
var keyCode = e.which,
isShift = e.shiftKey,
key = null,
startText, endText;
// make sure the correct text field is being updated
if (!self._hasFocus) {
return;
}
// fire custom user event
self._onkeydown(e, self);
// add support for Ctrl/Cmd+A selection
if (keyCode === 65 && (e.ctrlKey || e.metaKey)) {
self.selectText();
e.preventDefault();
return;
}
// block keys that shouldn't be processed
if (keyCode === 17 || e.metaKey || e.ctrlKey) {
return;
}
if (keyCode === 13 && !self._multiline) { // enter key
e.preventDefault();
self._onsubmit(e, self);
} else {
self._onchange();
}
return;
},
selectText: function(range) {
var self = this,
range = range || [0, self.value().length];
// select the range of text specified (or all if none specified)
setTimeout(function() {
self._hiddenInput.selectionStart = range[0];
self._hiddenInput.selectionEnd = range[1];
self._onchange();
}, 1);
return self;
},
destroy: function() {
var self = this;
// pull from the inputs array
var index = inputs.indexOf(self);
if (index !== -1) {
inputs.splice(index, 1);
}
// remove focus
if (self._hasFocus) {
self.blur();
}
// remove the hidden input box
self._hiddenInput.parentNode.removeChild(self._hiddenInput);
self._renderCtx = null;
},
_updateHiddenInput: function() {
var self = this;
self._hiddenInput.style.left = (self._x + (self._canvas ? self._canvas.offsetLeft : 0)) + 'px';
self._hiddenInput.style.top = (self._y + (self._canvas ? self._canvas.offsetTop : 0)) + 'px';
},
_createHiddenInput: function () {
var self = this;
if (self._hiddenInput) {
self._hiddenInput.parentNode.removeChild(self._hiddenInput);
self._hiddenInput = null;
}
self._hiddenInput = document.createElement(self._multiline ? 'textarea' : 'input');
self._hiddenInput.type = self._type;
self._hiddenInput.style.position = 'absolute';
self._hiddenInput.style.opacity = 0;
self._hiddenInput.style.pointerEvents = 'none';
self._hiddenInput.style.zIndex = 0;
// hide native blue text cursor on iOS
self._hiddenInput.style.transform = 'scale(0)';
self._updateHiddenInput();
self._canvas.parentNode.appendChild(self._hiddenInput);
// setup the keydown listener
self._hiddenInput.addEventListener('keydown', function(e) {
e = e || window.event;
if (self._hasFocus) {
// hack to fix touch event bug in iOS Safari
window.focus();
self._hiddenInput.focus();
// continue with the keydown event
self.keydown(e, self);
}
});
// setup the keyup listener
self._hiddenInput.addEventListener('keyup', function(e) {
e = e || window.event;
self._onchange();
if (self._hasFocus) {
self._onkeyup(e, self);
}
});
}
};
}}});

36
Runtime/Plugins/platform/webgl/UIWidgetsCanvasInput.jslib.meta


fileFormatVersion: 2
guid: ac437980a48c8464abea9c9c31a16e10
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 1
isExplicitlyReferenced: 0
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
Facebook: WebGL
second:
enabled: 1
settings: {}
- first:
WebGL: WebGL
second:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:

113
Runtime/Plugins/platform/webgl/UIWidgetsInputPlugin.jslib


mergeInto(LibraryManager.library, {
$UIWidgetsInputPluginModule__postset: 'UIWidgetsInputPluginModule.init();',
$UIWidgetsInputPluginModule: { init: function() {
var UIWidgetsTextInputPlugin = window.UIWidgetsTextInputPlugin = function(o) {
this._canvas = o.canvas;
this._messageManager = o.messageManager;
};
// setup the prototype
UIWidgetsTextInputPlugin.prototype = {
setClient: function (client, configuration) {
var self = this;
if (!self._canvasInput) {
self._canvasInput = new UIWidgetsCanvasInput({
canvas: self._canvas,
onchange: self._onchange.bind(self),
onsubmit: self._onsubmit.bind(self),
});
self._canvas.addEventListener('mouseup', function(e) {
if (self._client) {
self._canvasInput.focus();
}
}, false);
}
var configObj = JSON.parse(configuration);
var multiline = configObj.inputType.name === 'TextInputType.multiline';
self._canvasInput.type(configObj.obscureText ? 'password' : 'text');
self._canvasInput.multiline(multiline);
self._canvasInput.focus();
self._client = client;
},
setTextInputEditingState: function (jsonText) {
var self = this;
var state = JSON.parse(jsonText);
self._canvasInput.value(state.text);
self._canvasInput.selectText([state.selectionBase, state.selectionExtent]);
},
setTextInputIMEPos: function(x, y) {
var self = this;
self._canvasInput.x(x);
self._canvasInput.y(y);
},
clearTextInputClient: function () {
var self = this;
self._canvasInput.blur();
self._client = null;
},
_onsubmit: function() {
var self = this;
if (!self._client) {
return;
}
self._messageManager.sendMethodInvokeMessage('TextInput', 'TextInputClient.performAction',
[self._client, 'TextInputAction.done']);
},
_onchange: function() {
var self = this;
if (!self._client) {
return;
}
var value = self._canvasInput.value();
var selection = self._canvasInput.selection();
var state = {
selectionBase: selection[0],
selectionExtent: selection[1],
selectionIsDirectional: false,
text: value
};
self._messageManager.sendMethodInvokeMessage('TextInput', 'TextInputClient.updateEditingState',
[self._client, state]);
}
};
var UIWidgetsMessageManager = window.UIWidgetsMessageManager = function(sendMessage) {
var self = this;
self._sendMesssage = sendMessage;
};
UIWidgetsMessageManager.prototype = {
setObjectName: function (name) {
var self = this;
self._gameObjectName = name;
},
sendMethodInvokeMessage: function(channel, method, args) {
var self = this;
var body = {
channel: channel,
method: method,
args: args
};
self._sendMesssage(self._gameObjectName, 'OnUIWidgetsMethodMessage', JSON.stringify(body));
}
};
}}});

36
Runtime/Plugins/platform/webgl/UIWidgetsInputPlugin.jslib.meta


fileFormatVersion: 2
guid: 77df7fa0e2fd844359da12725acf5825
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 1
isExplicitlyReferenced: 0
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
Facebook: WebGL
second:
enabled: 1
settings: {}
- first:
WebGL: WebGL
second:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:

65
Runtime/Plugins/platform/webgl/webgl.jslib


var UIWidgetsLibrary = {
//$method_support__postset: 'method_support.init1();method_support.init2();',
//$method_support: {
//},
$UIWidgetsPlugin: {
textInput: null,
messageManager: null,
getTextInput: function() {
if (UIWidgetsPlugin.textInput) {
return UIWidgetsPlugin.textInput;
}
UIWidgetsPlugin.textInput = new UIWidgetsTextInputPlugin({
messageManager: UIWidgetsPlugin.getMessageManager(),
canvas: Module.canvas
});
return UIWidgetsPlugin.textInput;
},
getMessageManager: function() {
if (UIWidgetsPlugin.messageManager) {
return UIWidgetsPlugin.messageManager;
}
UIWidgetsPlugin.messageManager = new UIWidgetsMessageManager(SendMessage);
return UIWidgetsPlugin.messageManager;
},
messageObjectName: ""
},
UIWidgetsWebGLDevicePixelRatio: function () {
return window.devicePixelRatio || 1;
},
UIWidgetsTextInputSetClient: function (client, configuration) {
UIWidgetsPlugin.getTextInput().setClient(client, Pointer_stringify(configuration));
},
UIWidgetsTextInputSetTextInputEditingState: function (jsonText) {
UIWidgetsPlugin.getTextInput().setTextInputEditingState(Pointer_stringify(jsonText));
},
UIWidgetsTextInputSetIMEPos: function(x, y) {
UIWidgetsPlugin.getTextInput().setTextInputIMEPos(x, y);
},
UIWidgetsTextInputClearTextInputClient: function () {
UIWidgetsPlugin.getTextInput().clearTextInputClient();
},
UIWidgetsMessageSetObjectName: function (name) {
UIWidgetsPlugin.getMessageManager().setObjectName(Pointer_stringify(name));
}
};
autoAddDeps(UIWidgetsLibrary, '$UIWidgetsPlugin');
autoAddDeps(UIWidgetsLibrary, '$UIWidgetsCanvasInputModule');
autoAddDeps(UIWidgetsLibrary, '$UIWidgetsInputPluginModule');
mergeInto(LibraryManager.library, UIWidgetsLibrary);

7
Runtime/Plugins/webgl.jslib


mergeInto(LibraryManager.library, {
UIWidgetsWebGLDevicePixelRatio: function () {
return window.devicePixelRatio || 1;
},
});

/Runtime/Plugins/DeviceScreen.mm.meta → /Runtime/Plugins/platform/ios/DeviceScreen.mm.meta

/Runtime/Plugins/webgl.jslib.meta → /Runtime/Plugins/platform/webgl/webgl.jslib.meta

/Runtime/Plugins/DeviceScreen.mm → /Runtime/Plugins/platform/ios/DeviceScreen.mm

正在加载...
取消
保存