mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-23 09:20:08 +00:00
修复图例判断超范围异常的问题
This commit is contained in:
@@ -25,69 +25,78 @@ namespace XCharts
|
||||
EditorGUI.PropertyField(drawRect, align, new GUIContent("Location"));
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
++EditorGUI.indentLevel;
|
||||
switch ((Location.Align)align.enumValueIndex)
|
||||
{
|
||||
case Location.Align.TopCenter:
|
||||
EditorGUI.PropertyField(drawRect, top);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
break;
|
||||
case Location.Align.TopLeft:
|
||||
EditorGUI.PropertyField(drawRect, top);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, left);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
break;
|
||||
case Location.Align.TopRight:
|
||||
EditorGUI.PropertyField(drawRect, top);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, right);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
break;
|
||||
case Location.Align.BottomCenter:
|
||||
EditorGUI.PropertyField(drawRect, bottom);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
break;
|
||||
case Location.Align.BottomLeft:
|
||||
EditorGUI.PropertyField(drawRect, bottom);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, left);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
break;
|
||||
case Location.Align.BottomRight:
|
||||
EditorGUI.PropertyField(drawRect, bottom);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, right);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
break;
|
||||
case Location.Align.Center:
|
||||
break;
|
||||
case Location.Align.CenterLeft:
|
||||
EditorGUI.PropertyField(drawRect, left);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
break;
|
||||
case Location.Align.CenterRight:
|
||||
EditorGUI.PropertyField(drawRect, right);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
break;
|
||||
}
|
||||
EditorGUI.PropertyField(drawRect, top);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, bottom);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, left);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, right);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
// switch ((Location.Align)align.enumValueIndex)
|
||||
// {
|
||||
// case Location.Align.TopCenter:
|
||||
// EditorGUI.PropertyField(drawRect, top);
|
||||
// drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
// break;
|
||||
// case Location.Align.TopLeft:
|
||||
// EditorGUI.PropertyField(drawRect, top);
|
||||
// drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
// EditorGUI.PropertyField(drawRect, left);
|
||||
// drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
// break;
|
||||
// case Location.Align.TopRight:
|
||||
// EditorGUI.PropertyField(drawRect, top);
|
||||
// drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
// EditorGUI.PropertyField(drawRect, right);
|
||||
// drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
// break;
|
||||
// case Location.Align.BottomCenter:
|
||||
// EditorGUI.PropertyField(drawRect, bottom);
|
||||
// drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
// break;
|
||||
// case Location.Align.BottomLeft:
|
||||
// EditorGUI.PropertyField(drawRect, bottom);
|
||||
// drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
// EditorGUI.PropertyField(drawRect, left);
|
||||
// drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
// break;
|
||||
// case Location.Align.BottomRight:
|
||||
// EditorGUI.PropertyField(drawRect, bottom);
|
||||
// drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
// EditorGUI.PropertyField(drawRect, right);
|
||||
// drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
// break;
|
||||
// case Location.Align.Center:
|
||||
// break;
|
||||
// case Location.Align.CenterLeft:
|
||||
// EditorGUI.PropertyField(drawRect, left);
|
||||
// drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
// break;
|
||||
// case Location.Align.CenterRight:
|
||||
// EditorGUI.PropertyField(drawRect, right);
|
||||
// drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
// break;
|
||||
// }
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
SerializedProperty align = prop.FindPropertyRelative("m_Align");
|
||||
switch ((Location.Align)align.enumValueIndex)
|
||||
{
|
||||
case Location.Align.Center:
|
||||
return 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
|
||||
case Location.Align.TopCenter:
|
||||
case Location.Align.BottomCenter:
|
||||
case Location.Align.CenterLeft:
|
||||
case Location.Align.CenterRight:
|
||||
return 2 * EditorGUIUtility.singleLineHeight + 2 * EditorGUIUtility.standardVerticalSpacing;
|
||||
default:
|
||||
return 3 * EditorGUIUtility.singleLineHeight + 3 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
return 5 * EditorGUIUtility.singleLineHeight + 4 * EditorGUIUtility.standardVerticalSpacing;
|
||||
// SerializedProperty align = prop.FindPropertyRelative("m_Align");
|
||||
// switch ((Location.Align)align.enumValueIndex)
|
||||
// {
|
||||
// case Location.Align.Center:
|
||||
// return 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
|
||||
// case Location.Align.TopCenter:
|
||||
// case Location.Align.BottomCenter:
|
||||
// case Location.Align.CenterLeft:
|
||||
// case Location.Align.CenterRight:
|
||||
// return 2 * EditorGUIUtility.singleLineHeight + 2 * EditorGUIUtility.standardVerticalSpacing;
|
||||
// default:
|
||||
// return 3 * EditorGUIUtility.singleLineHeight + 3 * EditorGUIUtility.standardVerticalSpacing;
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -92,7 +92,7 @@ namespace XCharts
|
||||
foreach (var kv in legend.buttonList)
|
||||
{
|
||||
var item = kv.Value;
|
||||
if (currHeight + item.height + legend.itemGap > legendHeight)
|
||||
if (currHeight + item.height > legendHeight)
|
||||
{
|
||||
currHeight = 0;
|
||||
offsetX += legendRuntimeWidth + legend.itemGap;
|
||||
@@ -105,7 +105,7 @@ namespace XCharts
|
||||
foreach (var kv in legend.buttonList)
|
||||
{
|
||||
var item = kv.Value;
|
||||
if (currHeight + item.height + legend.itemGap > legendHeight)
|
||||
if (currHeight + item.height > legendHeight)
|
||||
{
|
||||
currHeight = 0;
|
||||
offsetX += legendRuntimeWidth + legend.itemGap;
|
||||
@@ -118,7 +118,7 @@ namespace XCharts
|
||||
foreach (var kv in legend.buttonList)
|
||||
{
|
||||
var item = kv.Value;
|
||||
if (currHeight + item.height + legend.itemGap > legendHeight)
|
||||
if (currHeight + item.height > legendHeight)
|
||||
{
|
||||
currHeight = 0;
|
||||
offsetX -= legendRuntimeWidth + legend.itemGap;
|
||||
@@ -134,7 +134,7 @@ namespace XCharts
|
||||
foreach (var kv in legend.buttonList)
|
||||
{
|
||||
var item = kv.Value;
|
||||
if (currHeight + item.height + legend.itemGap > legendHeight)
|
||||
if (currHeight + item.height > legendHeight)
|
||||
{
|
||||
currHeight = 0;
|
||||
offsetX += legendRuntimeWidth + legend.itemGap;
|
||||
@@ -148,7 +148,7 @@ namespace XCharts
|
||||
foreach (var kv in legend.buttonList)
|
||||
{
|
||||
var item = kv.Value;
|
||||
if (currHeight + item.height + legend.itemGap > legendHeight)
|
||||
if (currHeight + item.height > legendHeight)
|
||||
{
|
||||
currHeight = 0;
|
||||
offsetX += legendRuntimeWidth + legend.itemGap;
|
||||
@@ -163,7 +163,7 @@ namespace XCharts
|
||||
foreach (var kv in legend.buttonList)
|
||||
{
|
||||
var item = kv.Value;
|
||||
if (currHeight + item.height + legend.itemGap > legendHeight)
|
||||
if (currHeight + item.height > legendHeight)
|
||||
{
|
||||
currHeight = 0;
|
||||
offsetX -= legendRuntimeWidth + legend.itemGap;
|
||||
@@ -178,7 +178,7 @@ namespace XCharts
|
||||
foreach (var kv in legend.buttonList)
|
||||
{
|
||||
var item = kv.Value;
|
||||
if (currHeight + item.height + legend.itemGap > legendHeight)
|
||||
if (currHeight + item.height > legendHeight)
|
||||
{
|
||||
currHeight = 0;
|
||||
offsetX += legendRuntimeWidth + legend.itemGap;
|
||||
@@ -193,7 +193,7 @@ namespace XCharts
|
||||
foreach (var kv in legend.buttonList)
|
||||
{
|
||||
var item = kv.Value;
|
||||
if (currHeight + item.height + legend.itemGap > legendHeight)
|
||||
if (currHeight + item.height > legendHeight)
|
||||
{
|
||||
currHeight = 0;
|
||||
offsetX += legendRuntimeWidth + legend.itemGap;
|
||||
@@ -208,7 +208,7 @@ namespace XCharts
|
||||
foreach (var kv in legend.buttonList)
|
||||
{
|
||||
var item = kv.Value;
|
||||
if (currHeight + item.height + legend.itemGap > legendHeight)
|
||||
if (currHeight + item.height > legendHeight)
|
||||
{
|
||||
currHeight = 0;
|
||||
offsetX -= legendRuntimeWidth + legend.itemGap;
|
||||
@@ -229,7 +229,7 @@ namespace XCharts
|
||||
foreach (var kv in legend.buttonList)
|
||||
{
|
||||
var item = kv.Value;
|
||||
if (currWidth + item.width + legend.itemGap >= legendWidth)
|
||||
if (currWidth + item.width > legendWidth)
|
||||
{
|
||||
currWidth = 0f;
|
||||
if (isBottom) currHeight += legend.itemGap + item.height;
|
||||
@@ -247,7 +247,7 @@ namespace XCharts
|
||||
foreach (var kv in legend.buttonList)
|
||||
{
|
||||
var item = kv.Value;
|
||||
if (currWidth + item.width + legend.itemGap >= legendWidth)
|
||||
if (currWidth + item.width > legendWidth)
|
||||
{
|
||||
currWidth = 0f;
|
||||
if (isBottom) currHeight += legend.itemGap + item.height;
|
||||
@@ -265,7 +265,7 @@ namespace XCharts
|
||||
foreach (var kv in legend.buttonList)
|
||||
{
|
||||
var item = kv.Value;
|
||||
if (currWidth + item.width + legend.itemGap >= legendWidth)
|
||||
if (currWidth + item.width > legendWidth)
|
||||
{
|
||||
currWidth = 0f;
|
||||
if (isBottom) currHeight += legend.itemGap + item.height;
|
||||
|
||||
Reference in New Issue
Block a user