작업 시간 분석 UI 디자인 적용
This commit is contained in:
@@ -55,13 +55,10 @@ public class UI_BarChart : UIBase
|
||||
public void OnClickItem(BarEventArgs arg)
|
||||
{
|
||||
int.TryParse(arg.Group, out var index);
|
||||
barChartData.SetData(barChartDatas[index]);
|
||||
|
||||
barChart.GetBarTrackPosition("CycleTime", index.ToString(), out var topPosition);
|
||||
barChartData.SetData(barChartDatas[index], topPosition);
|
||||
|
||||
var bottomPosition = new Vector3(topPosition.x, rectTransform.rect.yMax - (rectTransform.transform.localPosition.y / 2), 0);
|
||||
var height = Mathf.Abs(topPosition.y - bottomPosition.y);
|
||||
|
||||
stackBar.SetStackBar(barChartDatas[index], topPosition, height);
|
||||
var bottomPosition = new Vector3(topPosition.x, rectTransform.rect.height / 2, 0);
|
||||
stackBar.SetStackBar(barChartDatas[index], topPosition, bottomPosition);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,12 +17,17 @@ public class UI_StackBar : UIBase
|
||||
targetImage = GetComponent<Image>();
|
||||
var images = transform.GetComponentsInChildren<Image>();
|
||||
stackedImages = images.Where(t => t != targetImage).ToArray();
|
||||
SetActive(false);
|
||||
}
|
||||
public void SetStackBar(BarChartData barChartData, Vector3 topPosition, float height)
|
||||
public void SetStackBar(BarChartData barChartData, Vector3 topPosition, Vector3 bottomPosition)
|
||||
{
|
||||
SetActive(true);
|
||||
rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, height);
|
||||
|
||||
transform.position = topPosition;
|
||||
|
||||
var height = (transform.localPosition.y + bottomPosition.y);
|
||||
rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, height);
|
||||
|
||||
SetImageRatios(barChartData);
|
||||
}
|
||||
private void SetImageRatios(BarChartData barChartData)
|
||||
|
||||
Reference in New Issue
Block a user