[interpolatablePlot] Fix indexing when mixed problems

This commit is contained in:
Behdad Esfahbod 2023-11-20 12:39:22 -07:00
parent c6e24b23ef
commit 0967829f16

View File

@ -466,6 +466,7 @@ class InterpolatablePlot:
cr.set_line_width(self.handle_width / scale) cr.set_line_width(self.handle_width / scale)
cr.stroke() cr.stroke()
matching = None
for problem in problems: for problem in problems:
if problem["type"] == "contour_order": if problem["type"] == "contour_order":
matching = problem["value_2"] matching = problem["value_2"]
@ -494,7 +495,9 @@ class InterpolatablePlot:
recording.replay(perContourPen) recording.replay(perContourPen)
points = SimpleRecordingPointPen() points = SimpleRecordingPointPen()
converter = SegmentToPointPen(points, False) converter = SegmentToPointPen(points, False)
perContourPen.value[idx].replay(converter) perContourPen.value[
idx if matching is None else matching[idx]
].replay(converter)
targetPoint = points.value[problem["value_2"]][0] targetPoint = points.value[problem["value_2"]][0]
cr.move_to(*targetPoint) cr.move_to(*targetPoint)
cr.line_to(*targetPoint) cr.line_to(*targetPoint)