[apps/shared][python/port] CurveView::drawArrow uses pixel computation

instead of float computation to avoid precision errors, by default the
arrow size is decided in pixels.
This commit is contained in:
Émilie Feral
2020-06-03 12:17:08 +02:00
parent a9fbcf99b2
commit 420dd04766
5 changed files with 63 additions and 22 deletions

View File

@@ -46,7 +46,7 @@ void PlotView::traceSegment(KDContext * ctx, KDRect r, PlotStore::Segment segmen
segment.xEnd(), segment.yEnd(),
segment.color()
);
if (segment.arrowWidth() > 0.0f) {
if (!std::isnan(segment.arrowWidth())) {
float dx = segment.xEnd() - segment.xStart();
float dy = segment.yEnd() - segment.yStart();
drawArrow(ctx, r, segment.xEnd(), segment.yEnd(), dx, dy, segment.color(), segment.arrowWidth());