Skip to content

Commit f382f40

Browse files
committed
Fix: add handle_final_shape method to MultiLineTool for final shape handling
Fix #30
1 parent e874075 commit f382f40

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog #
22

3+
## Version 2.7.2 ##
4+
5+
🛠️ Bug fixes:
6+
7+
* [Issue #30](https://github.com/PlotPyStack/PlotPy/issues/30) - `handle_final_shape_cb` argument doesn't work on `MultilineTool`, `PolygonTool`, `AnnotatedPolygonTool`
8+
39
## Version 2.7.1 ##
410

511
🛠️ Bug fixes:

plotpy/tools/shape.py

+11
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,16 @@ def setup_filter(self, baseplot: BasePlot) -> StatefulEventFilter:
136136
self.handler.set_shape(shape, self.setup_shape)
137137
return setup_standard_tool_filter(filter, start_state)
138138

139+
def handle_final_shape(self, shape) -> None:
140+
"""
141+
Handle the final shape after it's been created.
142+
143+
Args:
144+
shape: The final shape object.
145+
"""
146+
if self.handle_final_shape_cb is not None:
147+
self.handle_final_shape_cb(shape)
148+
139149
def end_polyline(self, filter: StatefulEventFilter, points: np.ndarray) -> None:
140150
"""
141151
End the polyline and reset the tool.
@@ -149,6 +159,7 @@ def end_polyline(self, filter: StatefulEventFilter, points: np.ndarray) -> None:
149159
shape.set_points(points)
150160
shape.set_closed(self.CLOSED)
151161
plot.add_item_with_z_offset(shape, SHAPE_Z_OFFSET)
162+
self.handle_final_shape(shape)
152163
self.SIG_TOOL_JOB_FINISHED.emit()
153164
if self.switch_to_default_tool:
154165
plot.set_active_item(shape)

0 commit comments

Comments
 (0)