[python] matplotlib: PlotView: rectangle are always visible despite the

pixel width
This commit is contained in:
Émilie Feral
2020-03-30 16:17:44 +02:00
parent 51eabf08e1
commit ce33faad11

View File

@@ -52,11 +52,12 @@ void PlotView::traceSegment(KDContext * ctx, KDRect r, PlotStore::Segment segmen
}
}
static inline KDCoordinate maxKDCoordinate(KDCoordinate x, KDCoordinate y) { return x > y ? x : y; }
void PlotView::traceRect(KDContext * ctx, KDRect r, PlotStore::Rect rect) const {
KDRect pixelRect(
floatToPixel(Axis::Horizontal, rect.x()),
floatToPixel(Axis::Vertical, rect.y()),
rect.width() / pixelWidth(),
maxKDCoordinate(rect.width() / pixelWidth(), 1), // Rectangle should at least be visible
rect.height() / pixelHeight()
);
ctx->fillRect(pixelRect, rect.color());