mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-28 20:28:46 +00:00
优化DataZoom的Marquee框选功能
This commit is contained in:
@@ -122,10 +122,7 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
if (axis is YAxis)
|
if (axis is YAxis)
|
||||||
{
|
{
|
||||||
var yRate = axis.context.minMaxRange / grid.context.height;
|
var yValue = axis.context.minValue + (chart.pointerPos.y - grid.context.y) / grid.context.height * axis.context.minMaxRange;
|
||||||
var yValue = yRate * (chart.pointerPos.y - grid.context.y - axis.context.offset);
|
|
||||||
if (axis.context.minValue > 0)
|
|
||||||
yValue += axis.context.minValue;
|
|
||||||
if (axis.inverse)
|
if (axis.inverse)
|
||||||
yValue = -yValue;
|
yValue = -yValue;
|
||||||
|
|
||||||
@@ -152,10 +149,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var xRate = axis.context.minMaxRange / grid.context.width;
|
xValue = axis.context.minValue + (chart.pointerPos.x - grid.context.x) / grid.context.width * axis.context.minMaxRange;
|
||||||
xValue = xRate * (chart.pointerPos.x - grid.context.x - axis.context.offset);
|
|
||||||
if (axis.context.minValue > 0)
|
|
||||||
xValue += axis.context.minValue;
|
|
||||||
if (axis.inverse)
|
if (axis.inverse)
|
||||||
xValue = -xValue;
|
xValue = -xValue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ namespace XCharts.Runtime
|
|||||||
dataZoom.context.isCoordinateDrag = true;
|
dataZoom.context.isCoordinateDrag = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dataZoom.supportMarquee)
|
if (dataZoom.supportMarquee && grid.Contains(pos))
|
||||||
{
|
{
|
||||||
dataZoom.context.isMarqueeDrag = true;
|
dataZoom.context.isMarqueeDrag = true;
|
||||||
dataZoom.context.marqueeStartPos = pos;
|
dataZoom.context.marqueeStartPos = pos;
|
||||||
@@ -167,7 +167,7 @@ namespace XCharts.Runtime
|
|||||||
|
|
||||||
var dataZoom = component;
|
var dataZoom = component;
|
||||||
var grid = chart.GetGridOfDataZoom(dataZoom);
|
var grid = chart.GetGridOfDataZoom(dataZoom);
|
||||||
if (dataZoom.supportMarquee)
|
if (dataZoom.supportMarquee && dataZoom.context.isMarqueeDrag)
|
||||||
{
|
{
|
||||||
Vector2 pos;
|
Vector2 pos;
|
||||||
if (!chart.ScreenPointToChartPoint(eventData.position, out pos))
|
if (!chart.ScreenPointToChartPoint(eventData.position, out pos))
|
||||||
@@ -211,7 +211,7 @@ namespace XCharts.Runtime
|
|||||||
|
|
||||||
var dataZoom = component;
|
var dataZoom = component;
|
||||||
|
|
||||||
if (dataZoom.supportMarquee)
|
if (dataZoom.supportMarquee && dataZoom.context.isMarqueeDrag)
|
||||||
{
|
{
|
||||||
dataZoom.context.isMarqueeDrag = false;
|
dataZoom.context.isMarqueeDrag = false;
|
||||||
if (dataZoom.marqueeStyle.apply)
|
if (dataZoom.marqueeStyle.apply)
|
||||||
@@ -264,7 +264,8 @@ namespace XCharts.Runtime
|
|||||||
var dataZoom = component;
|
var dataZoom = component;
|
||||||
var grid = chart.GetGridOfDataZoom(dataZoom);
|
var grid = chart.GetGridOfDataZoom(dataZoom);
|
||||||
if (dataZoom.IsInStartZoom(localPos) ||
|
if (dataZoom.IsInStartZoom(localPos) ||
|
||||||
dataZoom.IsInEndZoom(localPos))
|
dataZoom.IsInEndZoom(localPos) ||
|
||||||
|
dataZoom.IsInSelectedZoom(localPos))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user