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