diff --git a/src/Mod/TechDraw/Gui/QGCustomSvg.cpp b/src/Mod/TechDraw/Gui/QGCustomSvg.cpp index aad1a8f63c..b6a105e33f 100644 --- a/src/Mod/TechDraw/Gui/QGCustomSvg.cpp +++ b/src/Mod/TechDraw/Gui/QGCustomSvg.cpp @@ -51,26 +51,17 @@ QGCustomSvg::~QGCustomSvg() void QGCustomSvg::centerAt(QPointF centerPos) { - if (group()) { - QRectF box = group()->boundingRect(); - double width = box.width(); - double height = box.height(); - double newX = centerPos.x() - width/2.; - double newY = centerPos.y() - height/2.; - setPos(newX,newY); - } + centerAt(centerPos.x(),centerPos.y()); } void QGCustomSvg::centerAt(double cX, double cY) { - if (group()) { - QRectF box = group()->boundingRect(); - double width = box.width(); - double height = box.height(); - double newX = cX - width/2.; - double newY = cY - height/2.; - setPos(newX,newY); - } + QRectF box = boundingRect(); + double width = box.width(); + double height = box.height(); + double newX = (cX - width/2.) * scale(); + double newY = (cY - height/2.) * scale(); + setPos(newX,newY); } bool QGCustomSvg::load(QByteArray *svgBytes) @@ -87,12 +78,14 @@ QRectF QGCustomSvg::boundingRect() const double w = box.width(); double h = box.height(); QRectF newRect(0,0,w,h); - return newRect.adjusted(-1.,-1.,1.,1.); + return newRect; } void QGCustomSvg::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget) { QStyleOptionGraphicsItem myOption(*option); myOption.state &= ~QStyle::State_Selected; + //painter->drawRect(boundingRect()); //good for debugging + QGraphicsSvgItem::paint (painter, &myOption, widget); } diff --git a/src/Mod/TechDraw/Gui/QGIViewSymbol.cpp b/src/Mod/TechDraw/Gui/QGIViewSymbol.cpp index ff7dce7cec..71ab65a1d5 100644 --- a/src/Mod/TechDraw/Gui/QGIViewSymbol.cpp +++ b/src/Mod/TechDraw/Gui/QGIViewSymbol.cpp @@ -107,9 +107,7 @@ void QGIViewSymbol::draw() } drawSvg(); - if (borderVisible) { - drawBorder(); - } + QGIView::draw(); } void QGIViewSymbol::drawSvg()