]> git.tdb.fi Git - r2c2.git/commitdiff
Keep TrackAttachment offset within allowed limits
authorMikko Rasa <tdb@tdb.fi>
Sun, 7 Jul 2013 21:23:32 +0000 (00:23 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 7 Jul 2013 21:23:32 +0000 (00:23 +0300)
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);