fix: node edge bounding box (causing bug

This commit is contained in:
parker
2025-06-23 14:49:46 +01:00
parent 278a3c552f
commit 882dde0ea3
2 changed files with 3 additions and 1 deletions

View File

@@ -57,6 +57,7 @@ QRectF NodeEdgeGraphic::boundingRect() const
// std::cout << "bounds set" << socket1_->scenePos().x() << " " << socket1_->scenePos().y() << " " << socket2_->scenePos().x() << " " << socket2_->scenePos().y() << "\n"; // std::cout << "bounds set" << socket1_->scenePos().x() << " " << socket1_->scenePos().y() << " " << socket2_->scenePos().x() << " " << socket2_->scenePos().y() << "\n";
// QRectF boundRect_ = QRectF(socket1_->scenePos(), socket1_->scenePos()).normalized(); // QRectF boundRect_ = QRectF(socket1_->scenePos(), socket1_->scenePos()).normalized();
QRectF boundRect_ = QRectF(pos1_, pos2_).normalized(); QRectF boundRect_ = QRectF(pos1_, pos2_).normalized();
boundRect_.adjust(-padding_,-padding_,padding_,padding_);
return boundRect_; return boundRect_;
} }
@@ -65,7 +66,7 @@ QPainterPath NodeEdgeGraphic::shape() const{
std::cout << "setting shape to: " << socket1_->scenePos().x() << " " << socket2_->scenePos().x() <<"\n"; std::cout << "setting shape to: " << socket1_->scenePos().x() << " " << socket2_->scenePos().x() <<"\n";
QPainterPathStroker stroker; QPainterPathStroker stroker;
stroker.setWidth(40); stroker.setWidth(padding_);
return stroker.createStroke(path_); return stroker.createStroke(path_);
} }

View File

@@ -30,6 +30,7 @@ private:
QPointF pos2_; QPointF pos2_;
QPainterPath path_; QPainterPath path_;
QRectF boundRect_; QRectF boundRect_;
qreal padding_=40;
void updatePath(); void updatePath();
}; };