浏览代码

Merge pull request #220 from Unity-Technologies/zgh/fix_orientation_bug

fix: raycastable rect doesn't update when orientation changed
/main
GitHub 3 年前
当前提交
f6c57bf6
共有 2 个文件被更改,包括 13 次插入0 次删除
  1. 8
      com.unity.uiwidgets/Runtime/engine/raycastable/RaycastManager.cs
  2. 5
      com.unity.uiwidgets/Runtime/engine/raycastable/UIWidgetsRaycastablePanel.cs

8
com.unity.uiwidgets/Runtime/engine/raycastable/RaycastManager.cs


instance.raycastHandlerMap[windowHashCode][widgetHashCode] = new RaycastableRect();
}
public static void OnScreenSizeChanged(int windowHashCode) {
if (!instance.raycastHandlerMap.ContainsKey(windowHashCode)) return;
Dictionary<int, RaycastableRect> raycastableWidgets = RaycastManager.instance.raycastHandlerMap[windowHashCode];
foreach (var item in raycastableWidgets) {
MarkDirty(item.Key, windowHashCode);
}
}
public static void MarkDirty(int widgetHashCode, int windowHashCode) {
D.assert(instance.raycastHandlerMap.ContainsKey(windowHashCode), () =>
$"Raycast Handler Map doesn't contain Window {windowHashCode}");

5
com.unity.uiwidgets/Runtime/engine/raycastable/UIWidgetsRaycastablePanel.cs


RaycastManager.DisposeWindow(windowHashCode);
}
protected override void OnRectTransformDimensionsChange() {
base.OnRectTransformDimensionsChange();
RaycastManager.OnScreenSizeChanged(windowHashCode);
}
public bool IsRaycastLocationValid(Vector2 screenPoint, Camera eventCamera) {
if (!enabled) {
return true;

正在加载...
取消
保存