작업 조건 분석 UI 수정
This commit is contained in:
@@ -15,7 +15,7 @@ public class UI_GraphChart : UIBase, IPointerClickHandler
|
||||
//public UI_DateTime prf_dateTime;
|
||||
//public RectTransform Content_DateTime;
|
||||
|
||||
private UI_GraphChartData chartDetailData;
|
||||
public UI_GraphChartData chartDetailData;
|
||||
private TextMeshProUGUI GraphName;
|
||||
|
||||
public string graphName;
|
||||
@@ -38,7 +38,24 @@ public class UI_GraphChart : UIBase, IPointerClickHandler
|
||||
{
|
||||
Graph = GetComponentInChildren<GraphChart>();
|
||||
//prf_dateTime = Resources.Load<UI_DateTime>("Prefabs/UI/PRF_UI_DateTime");
|
||||
chartDetailData = FindSingle<UI_GraphChartData>();
|
||||
chartDetailData = GetComponentInChildren<UI_GraphChartData>(true);
|
||||
}
|
||||
public void Update()
|
||||
{
|
||||
if (!isMainChart)
|
||||
return;
|
||||
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
{
|
||||
if (RectTransformUtility.RectangleContainsScreenPoint(chartDetailData.rectTransform, Input.mousePosition))
|
||||
{
|
||||
Debug.Log("¹þ¾î³²");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
chartDetailData.SetActive(false);
|
||||
}
|
||||
}
|
||||
public void OnPointerClick(PointerEventData eventData)
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ public class UI_GraphChartData : UIBase, ISingle
|
||||
}
|
||||
public void SetData(string dataName, float dataValue, string dateTime, Vector3 pos)
|
||||
{
|
||||
ShowUINextToClickedUI();
|
||||
ShowUINextToClickedUI(pos);
|
||||
|
||||
DataName.SetText(dataName);
|
||||
DateTime.SetText(dateTime);
|
||||
@@ -31,26 +31,16 @@ public class UI_GraphChartData : UIBase, ISingle
|
||||
}
|
||||
|
||||
|
||||
void ShowUINextToClickedUI()
|
||||
void ShowUINextToClickedUI(Vector3 topPosition)
|
||||
{
|
||||
RectTransform parentRectTransform = rectTransform.parent.GetComponent<RectTransform>();
|
||||
|
||||
Vector2 localPoint;
|
||||
RectTransformUtility.ScreenPointToLocalPointInRectangle(parentRectTransform, Input.mousePosition, null, out localPoint);
|
||||
var parentSize = parentRectTransform.rect.size;
|
||||
var uiSize = rectTransform.rect.size;
|
||||
|
||||
rectTransform.localPosition = new Vector2(localPoint.x + offset.x, localPoint.y + offset.y);
|
||||
float clampedX = Mathf.Clamp(topPosition.x + offset.x, -parentSize.x / 2 + uiSize.x / 2, parentSize.x / 2 - uiSize.x / 2);
|
||||
|
||||
rectTransform.localPosition = new Vector2(clampedX, offset.y);
|
||||
gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
{
|
||||
if (EventSystem.current.currentSelectedGameObject != null)
|
||||
return;
|
||||
|
||||
SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user