|
|
|
|
|
|
using Unity.UIWidgets.foundation; |
|
|
|
using Unity.UIWidgets.painting; |
|
|
|
using Unity.UIWidgets.rendering; |
|
|
|
using Unity.UIWidgets.ui; |
|
|
|
using UnityEngine; |
|
|
|
using Color = Unity.UIWidgets.ui.Color; |
|
|
|
|
|
|
|
namespace UIWidgets.Tests { |
|
|
|
public class MouseHoverWidget : StatefulWidget { |
|
|
|
|
|
|
Widget result = new Container(width: 200, height: 60, color: Color.fromARGB(255, 255, 0, 255)); |
|
|
|
if (canHover) { |
|
|
|
result = new HoverTrackWidget(null, |
|
|
|
result); |
|
|
|
result, "inner"); |
|
|
|
} |
|
|
|
|
|
|
|
if (nest) { |
|
|
|
|
|
|
result); |
|
|
|
result, "outer"); |
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
|
|
|
public class HoverTrackWidget : StatefulWidget { |
|
|
|
public readonly Widget child; |
|
|
|
public readonly string name; |
|
|
|
public HoverTrackWidget(Key key, Widget child) : base(key) { |
|
|
|
public HoverTrackWidget(Key key, Widget child, string name) : base(key) { |
|
|
|
this.name = name; |
|
|
|
} |
|
|
|
|
|
|
|
public override State createState() { |
|
|
|
|
|
|
), |
|
|
|
onPointerEnter: (evt) => { |
|
|
|
if (this.mounted) { |
|
|
|
Debug.Log(this.widget.name + " pointer enter"); |
|
|
|
Debug.Log(this.widget.name + " pointer exit"); |
|
|
|
this.setState(() => { this.hover = false; }); |
|
|
|
} |
|
|
|
} |
|
|
|