작업 조건 분석 UI 수정
This commit is contained in:
@@ -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