summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libnr/nr-path.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libnr/nr-path.cpp b/src/libnr/nr-path.cpp
index 99adcb3e1..f369b0140 100644
--- a/src/libnr/nr-path.cpp
+++ b/src/libnr/nr-path.cpp
@@ -231,12 +231,20 @@ nr_path_matrix_point_bbox_wind_distance (NRBPath *bpath, NR::Matrix const &m, NR
x0 = y0 = 0.0;
x3 = y3 = 0.0;
+ // remembering the start of subpath
+ NR::Coord x_start = 0, y_start = 0; bool start_set = false;
+
for (p = bpath->path; p->code != NR_END; p+= 1) {
switch (p->code) {
case NR_MOVETO_OPEN:
case NR_MOVETO:
+ if (start_set) { // this is a new subpath
+ if (x0 != x_start || y0 != y_start) // for correct picking, each subpath must be closed
+ nr_line_wind_distance (x0, y0, x_start, y_start, pt, wind, dist);
+ }
x0 = m[0] * p->x3 + m[2] * p->y3 + m[4];
y0 = m[1] * p->x3 + m[3] * p->y3 + m[5];
+ x_start = x0; y_start = y0; start_set = true;
if (bbox) {
bbox->x0 = (NR::Coord) MIN (bbox->x0, x0);
bbox->y0 = (NR::Coord) MIN (bbox->y0, y0);
@@ -277,6 +285,11 @@ nr_path_matrix_point_bbox_wind_distance (NRBPath *bpath, NR::Matrix const &m, NR
break;
}
}
+
+ if (start_set) {
+ if (x0 != x_start || y0 != y_start) // for correct picking, each subpath must be closed
+ nr_line_wind_distance (x0, y0, x_start, y_start, pt, wind, dist);
+ }
}
static void