Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit mode when an annotation is selected erroneously allows for creation of new annotation #114

Closed
droumis opened this issue Jun 26, 2024 · 1 comment · Fixed by #117
Closed

Comments

@droumis
Copy link
Member

droumis commented Jun 26, 2024

Looks like the relevant change is here. Indeed, reverting this function resolves the issue. @ahuang11

Notice that in the "After #101" video below, the erroneously created annotation also goes to the wrong axis. This remains the case even with #113. But I guess it doesn't matter because the intended behavior is to not allow new drag-created annotations when an existing annotation is selected, and edit mode is active.

Code

This code is a bit simpler than what is shown in the video because the tabulator app is not yet merged.

import holoviews as hv; hv.extension('bokeh')
import panel as pn; pn.extension()
import numpy as np

from holonote.annotate import Annotator
from holonote.app import PanelWidgets

annotator = Annotator({"x": float, "y": float}, fields=["description"])
annotator_widgets = PanelWidgets(annotator)

bounds = (-1, -1, 1, 1)
data = np.array([[0, 1], [1, 0]])
img = hv.Image(data, kdims=['x', 'y'], bounds=bounds)
img_right = hv.Image(data, kdims=['z', 'y'], bounds=bounds)  # y as second kdim! so HSpan

left_plot = annotator * img
right_plot = annotator * img_right
layout = left_plot + right_plot

annotator.set_regions(x=(-0.15, 0.15), y=(-0.25, 0.25))
annotator.add_annotation(description="Test")

pn.Column(annotator_widgets, layout)

Prior to #101

video1786144967.mp4

After #101

video2786144967.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants