작업 시간 분석 UI 디자인 적용
This commit is contained in:
@@ -19,9 +19,9 @@ public class UI_BarChartData : UIBase
|
||||
{
|
||||
SetActive(false);
|
||||
}
|
||||
public void SetData(BarChartData data)
|
||||
public void SetData(BarChartData data, Vector3 topPosition)
|
||||
{
|
||||
ShowUINextToClickedUI();
|
||||
ShowUINextToClickedUI(topPosition);
|
||||
|
||||
CoolingTimeData.SetText(ConvertFloatToString(data.coolingTime));
|
||||
HoldingPressureTimeData.SetText(ConvertFloatToString(data.holdingPressureTime));
|
||||
@@ -33,23 +33,20 @@ public class UI_BarChartData : UIBase
|
||||
private string ConvertFloatToString(float value)
|
||||
{
|
||||
float truncatedFloat = Mathf.Floor(value * 100f) / 100f;
|
||||
return truncatedFloat.ToString();
|
||||
return truncatedFloat.ToString() + " ÃÊ";
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
|
||||
float clampedX = Mathf.Clamp(localPoint.x + offset.x, -parentSize.x / 2 + uiSize.x / 2, parentSize.x / 2 - uiSize.x / 2);
|
||||
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);
|
||||
rectTransform.position = new Vector2(clampedX + offset.x, offset.y);
|
||||
gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user