Skip to content

Commit

Permalink
disable shape editing during pan/zoom mode
Browse files Browse the repository at this point in the history
  • Loading branch information
cleaaum committed Dec 19, 2023
1 parent bcaeeb0 commit eceda16
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions callbacks/control_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ def update_selected_class_style(selected_class, all_annotation_classes):
State("annotation-store", "data"),
State("generate-annotation-class-modal", "opened"),
State({"type": "edit-annotation-class-modal", "index": ALL}, "opened"),
State("image-viewer", "figure"),
prevent_initial_call=True,
)
def annotation_mode(
Expand All @@ -174,6 +175,7 @@ def annotation_mode(
annotation_store,
generate_modal_opened,
edit_modal_opened,
fig,
):
"""
This callback is responsible for changing the annotation mode and the style of the buttons.
Expand Down Expand Up @@ -235,6 +237,10 @@ def annotation_mode(
annotation_store["dragmode"] = "pan"
styles[trigger] = active

# disable shape editing when in pan/zoom mode
for shape in fig["layout"]["shapes"]:
shape["editable"] = trigger != "pan-and-zoom" and pan_and_zoom > 0
patched_figure["layout"]["shapes"] = fig["layout"]["shapes"]
return (
patched_figure,
styles["closed-freeform"],
Expand Down

0 comments on commit eceda16

Please sign in to comment.