summaryrefslogtreecommitdiffstats
path: root/src/conn-avoid-ref.cpp
diff options
context:
space:
mode:
authorThomas Holder <thomas@thomas-holder.de>2019-07-27 12:42:19 +0000
committerThomas Holder <thomas@thomas-holder.de>2019-07-27 19:26:14 +0000
commit51b535dd590a1f1571f2de261e425d17b16eb0cf (patch)
treeaccaf08a29486392a281369fbf900bbfadf69f64 /src/conn-avoid-ref.cpp
parentMake doc2dt a document property (diff)
downloadinkscape-51b535dd590a1f1571f2de261e425d17b16eb0cf.tar.gz
inkscape-51b535dd590a1f1571f2de261e425d17b16eb0cf.zip
Fix #336 Connector avoid bbox of non-shapes
Diffstat (limited to 'src/conn-avoid-ref.cpp')
-rw-r--r--src/conn-avoid-ref.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/conn-avoid-ref.cpp b/src/conn-avoid-ref.cpp
index 4723d142b..0cd9eeeef 100644
--- a/src/conn-avoid-ref.cpp
+++ b/src/conn-avoid-ref.cpp
@@ -237,6 +237,7 @@ static std::vector<Geom::Point> approxItemWithPoints(SPItem const *item, const G
{
// The structure to hold the output
std::vector<Geom::Point> poly_points;
+ SPCurve *item_curve = nullptr;
if (SP_IS_GROUP(item))
{
@@ -252,16 +253,24 @@ static std::vector<Geom::Point> approxItemWithPoints(SPItem const *item, const G
else if (SP_IS_SHAPE(item))
{
SP_SHAPE(item)->set_shape();
- SPCurve* item_curve = SP_SHAPE(item)->getCurve();
+ item_curve = SP_SHAPE(item)->getCurve();
// make sure it has an associated curve
if (item_curve)
{
// apply transformations (up to common ancestor)
item_curve->transform(item_transform);
- std::vector<Geom::Point> curve_points = approxCurveWithPoints(item_curve);
- poly_points.insert(poly_points.end(), curve_points.begin(), curve_points.end());
- item_curve->unref();
}
+ } else {
+ auto bbox = item->documentPreferredBounds();
+ if (bbox) {
+ item_curve = SPCurve::new_from_rect(*bbox);
+ }
+ }
+
+ if (item_curve) {
+ std::vector<Geom::Point> curve_points = approxCurveWithPoints(item_curve);
+ poly_points.insert(poly_points.end(), curve_points.begin(), curve_points.end());
+ item_curve->unref();
}
return poly_points;