clip bars to viewport.

This commit is contained in:
Martin Preuss
2025-12-30 10:50:09 +01:00
parent fb6af5ef1b
commit 87053c5029

View File

@@ -533,7 +533,9 @@ void _drawCurveVertBars(AQDG_OBJECT *o, AQDG_DRAW_CONTEXT *dc, const AQDG_GRAPH_
valueMinDist, barWidth, baseLineValueY, baseLinePosY);
#endif
while(dp) {
int xPos;
int pos;
int xPos1;
int xPos2;
int yPos;
int h;
double xValue;
@@ -542,14 +544,18 @@ void _drawCurveVertBars(AQDG_OBJECT *o, AQDG_DRAW_CONTEXT *dc, const AQDG_GRAPH_
xValue=AQDG_Graph_DataPair_GetValueX(dp);
yValue=AQDG_Graph_DataPair_GetValueY(dp);
xPos=_calcHorizontalPos(xValue, width, minValueX, maxValueX)-barWidth/2;
pos=_calcHorizontalPos(xValue, width, minValueX, maxValueX);
xPos1=pos-barWidth/2;
xPos2=pos+barWidth/2;
xPos1=(xPos1<0)?0:xPos1;
xPos2=(width>xPos2)?xPos2:(width-1);
yPos=_calcVerticalPos(yValue, height, minValueY, maxValueY);
h=baseLinePosY-yPos;
if (h<0) {
yPos+=h;
h=-h;
}
AQDG_Draw_Context_DrawFilledRect(dc, pen, absX+xPos, absY+yPos, barWidth, h);
AQDG_Draw_Context_DrawFilledRect(dc, pen, absX+xPos1, absY+yPos, (xPos2-xPos1)+1, h);
dp=AQDG_Graph_DataPair_List_Next(dp);
}
}