From d77c8169f2d88540bd2a31f0d941d28836dffa72 Mon Sep 17 00:00:00 2001 From: ale rimoldi Date: Sun, 23 Mar 2025 20:05:45 +0100 Subject: always smooth the freehand drawing diff --git a/scribus/canvasmode_drawfreehand.cpp b/scribus/canvasmode_drawfreehand.cpp index 1733c0ed1..230ae1905 100644 --- a/scribus/canvasmode_drawfreehand.cpp +++ b/scribus/canvasmode_drawfreehand.cpp @@ -217,31 +217,14 @@ void FreehandMode::mouseReleaseEvent(QMouseEvent *m) uint z = m_doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, m_xp, m_yp, 1, 1, m_doc->itemToolPrefs().lineWidth, CommonStrings::None, m_doc->itemToolPrefs().lineColor); currItem = m_doc->Items->at(z); currItem->PoLine.resize(0); - if (m->modifiers() & Qt::ControlModifier) + QList clip; + for (int px = 0; px < m_poly.size()-1; ++px) { - QList clip; - for (int px = 0; px < m_poly.size()-1; ++px) - { - FPoint clp = m_poly.point(px); - clip.append(QPointF(clp.x(), clp.y())); - } - QPainterPath pp = bezierFit(clip, 5.0); - currItem->PoLine.fromQPainterPath(pp); - } - else - { - currItem->PoLine.addPoint(m_poly.point(0)); - currItem->PoLine.addPoint(m_poly.point(0)); - for (int px = 1; px < m_poly.size()-1; ++px) - { - currItem->PoLine.addPoint(m_poly.point(px)); - currItem->PoLine.addPoint(m_poly.point(px)); - currItem->PoLine.addPoint(m_poly.point(px)); - currItem->PoLine.addPoint(m_poly.point(px)); - } - currItem->PoLine.addPoint(m_poly.point(m_poly.size()-1)); - currItem->PoLine.addPoint(m_poly.point(m_poly.size()-1)); + FPoint clp = m_poly.point(px); + clip.append(QPointF(clp.x(), clp.y())); } + QPainterPath pp = bezierFit(clip, 5.0); + currItem->PoLine.fromQPainterPath(pp); FPoint tp2(getMinClipF(&currItem->PoLine)); currItem->setXYPos(tp2.x(), tp2.y(), true); currItem->PoLine.translate(-tp2.x(), -tp2.y());