diff --git a/src/draw.cpp b/src/draw.cpp index 40a58eca..f25e0deb 100644 --- a/src/draw.cpp +++ b/src/draw.cpp @@ -389,6 +389,8 @@ void GraphicsWindow::HitTestMakeSelection(Point2d mp) { } } + canvas.Clear(); + if(!s.Equals(&hover)) { hover = s; PaintGraphics(); @@ -787,5 +789,6 @@ void GraphicsWindow::Paint() { } canvas.EndFrame(); + canvas.Clear(); #endif } diff --git a/src/drawconstraint.cpp b/src/drawconstraint.cpp index 5c09a2f4..6442989c 100644 --- a/src/drawconstraint.cpp +++ b/src/drawconstraint.cpp @@ -1187,19 +1187,21 @@ void Constraint::Draw(DrawAs how, Canvas *canvas) { } Vector Constraint::GetLabelPos(const Camera &camera) { + Vector p; + ObjectPicker canvas = {}; canvas.camera = camera; - - Vector p; DoLayout(DrawAs::DEFAULT, &canvas, &p, NULL); + canvas.Clear(); + return p; } void Constraint::GetReferencePoints(const Camera &camera, std::vector *refs) { ObjectPicker canvas = {}; canvas.camera = camera; - DoLayout(DrawAs::DEFAULT, &canvas, NULL, refs); + canvas.Clear(); } bool Constraint::IsStylable() const { diff --git a/src/drawentity.cpp b/src/drawentity.cpp index b8f157ba..4576c86b 100644 --- a/src/drawentity.cpp +++ b/src/drawentity.cpp @@ -126,14 +126,17 @@ void Entity::GetReferencePoints(std::vector *refs) { } int Entity::GetPositionOfPoint(const Camera &camera, Point2d p) { + int position; + ObjectPicker canvas = {}; canvas.camera = camera; canvas.point = p; canvas.minDistance = 1e12; - Draw(DrawAs::DEFAULT, &canvas); + position = canvas.position; + canvas.Clear(); - return canvas.position; + return position; } bool Entity::IsStylable() const { diff --git a/src/export.cpp b/src/export.cpp index e16ce3b5..2ef4ee73 100644 --- a/src/export.cpp +++ b/src/export.cpp @@ -220,6 +220,8 @@ void SolveSpaceUI::ExportViewOrWireframeTo(const std::string &filename, bool exp for(Constraint &c : SK.constraint) { c.Draw(Constraint::DrawAs::DEFAULT, &canvas); } + + canvas.Clear(); } } diff --git a/src/textwin.cpp b/src/textwin.cpp index 2519cb92..56c54b07 100644 --- a/src/textwin.cpp +++ b/src/textwin.cpp @@ -858,6 +858,7 @@ void TextWindow::Paint() { DrawOrHitTestColorPicker(&uiCanvas, PAINT, false, 0, 0); canvas.EndFrame(); + canvas.Clear(); #endif }