fix: node edge bounding box (causing bug
This commit is contained in:
@@ -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_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ private:
|
|||||||
QPointF pos2_;
|
QPointF pos2_;
|
||||||
QPainterPath path_;
|
QPainterPath path_;
|
||||||
QRectF boundRect_;
|
QRectF boundRect_;
|
||||||
|
qreal padding_=40;
|
||||||
|
|
||||||
void updatePath();
|
void updatePath();
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user