From 1ba514de333b7c3f990201a60bd1b18a62c55133 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Mon, 8 Jul 2013 00:23:32 +0300 Subject: [PATCH] Keep TrackAttachment offset within allowed limits --- source/libr2c2/trackattachment.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libr2c2/trackattachment.cpp b/source/libr2c2/trackattachment.cpp index 3d28651..29521fd 100644 --- a/source/libr2c2/trackattachment.cpp +++ b/source/libr2c2/trackattachment.cpp @@ -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); -- 2.45.2