]> git.tdb.fi Git - r2c2.git/blobdiff - source/libr2c2/trackattachment.cpp
Keep TrackAttachment offset within allowed limits
[r2c2.git] / source / libr2c2 / trackattachment.cpp
index 3d28651d882395bdd8baab18162e3e201ad3b1bc..29521fdc064659457d3dfaa97da30d3fc0b79563 100644 (file)
@@ -81,7 +81,7 @@ float TrackAttachment::find_offset(const TrackIter &trk, const Vector &point)
        Vector epp = trk->get_snap_node(trk.entry()).position;
 
        float dist = distance(epp, point);
-       float offs = dist;
+       float offs = min(dist, trk->get_type().get_path_length(0));
        while(1)
        {
                TrackPoint tp = trk->get_point(trk.entry(), offs);