Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Bugfix drag and drop#5061

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
itepifanio wants to merge2 commits intoplotly:main
base:main
Choose a base branch
Loading
fromitepifanio:bugfix-drag-and-drop

Conversation

@itepifanio
Copy link

Code PR

This PRfixes#4374. The problem is that the Layout is initialized with no shapes and the drag and drop would trigger a relayout_data with shapes that weren't available at theCompoundArrayValidator (since it's initialized one time).

I'm not that familiar with the codebase, so I added a specific condition for this special case. I'm open to know more about the plotly validator flow if it can improve the code.

The internal calls of thebasedatatypes are quite complex, recursive calls everywhere, it's hard to track what's happening. Do you have any docs about this module? I don't think the docstring are enough to understand the big picture.

  • I have read through thecontributing notes and understand the structure of the package. In particular, if my PR modifies code ofplotly.graph_objects, my modifications concern thecodegen files and not generated files.
  • I have added tests (if submitting a new feature or correcting a bug) or
    modified existing tests.
  • For a new feature, I have added documentation examples in an existing or
    new tutorial notebook (please see the doc checklist as well).
  • I have added a CHANGELOG entry if fixing/changing/adding anything substantial.
  • For a new feature or a change in behaviour, I have updated the relevant docstrings in the code to describe the feature or behaviour (please see the doc checklist as well).

I actually tried to reproduce the error by writing a test programatically, but it didn't work. I wasn't able to find a way to reproduce the js events in the python code and relying on the relayout event wasn't enough to reproduce it.

deftest_plotly_relayout_drag_and_drop_polygons()->None:"""    Validate that the plotly_relayout method can handle drag and drop.    """fig=go.FigureWidget(layout=go.Layout(showlegend=False,autosize=True,dragmode="drawrect",modebar={"add": ["drawclosedpath","drawcircle","drawrect","eraseshape",                ]            },        )    )fig.add_shape(type="rect",x0=-0.06666666666666662,y0=2.4908854166666665,x1=2.1500000000000004,y1=0.3519965277777778,    )new_shape= {"x0":-0.07964149504195264,"x1":3.692616323417239,"y0":3.1297222222222225,"y1":1.213055555555555,    }drag_and_drop_relayout_data= {f'shapes[0].{pos}':valueforpos,valueinnew_shape.items()    }fig.plotly_relayout(relayout_data=drag_and_drop_relayout_data    )forpos,valueinnew_shape.items():assertfig.layout.shapes[0][pos]==value

@gvwilsongvwilson added featuresomething new P2considered for next cycle communitycommunity contribution labelsMar 3, 2025
@gvwilson
Copy link
Contributor

thanks very much@itepifanio - I'll try to get someone to review this in our next cycle.

itepifanio reacted with thumbs up emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

communitycommunity contributionfeaturesomething newP2considered for next cycle

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

FigureWidget doesn't allow draggable polygon

2 participants

@itepifanio@gvwilson

[8]ページ先頭

©2009-2025 Movatter.jp