You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Under some conditions, the click position of the user does not match the click position interpreted by Cytoscape. This results in, for example, the user clicking on a node but Cytoscape interpreting the click as below the node. The issue disappears after the browser window is resized.
Suspect this is caused by some nuance of CSS styling messing up the position of the Cytoscape canvas, but difficult to debug as I have not been able to reproduce on my machine.
Screen Recording
click.position.mismatch.mov
Steps/Code to Reproduce
importdashfromdashimporthtml, dcc, callback, Input, Outputimportdash_cytoscapeascytoimportdash_leafletasdlELEMENTS= [
{"data": {"id": "a", "label": "Node A", "lat": 45.519, "lon": -73.576}},
{"data": {"id": "b", "label": "Node B", "lat": 45.521, "lon": -73.574}},
{"data": {"id": "c", "label": "Node C", "lat": 45.520, "lon": -73.572}},
{"data": {"id": "ab", "source": "a", "target": "b"}},
]
defserve_layout():
returnhtml.Div(
children=[
html.H1("CyLeaflet: Initial click position mismatch / Resize issue"),
html.Hr(),
dcc.Markdown(""" * Make sure you refresh the browser (F5) * After the initial load, try to click in the center of a Node B. * Notice the grey circle displayed BELOW your click location, resulting in a pan insted of a node selection or a node drag. * To set things straight, here are 2 ways i found: * Resizing the browser window * Modifify the application file (.py), save, and let it reload by itself * But then if whenever you refresh the browser, the problem comes up again. """),
cyto.CyLeaflet(
id="cyleaflet",
cytoscape_props=dict(
elements=ELEMENTS,
),
),
],
)
app=dash.Dash(__name__)
server=app.serverapp.layout=serve_layoutif__name__=="__main__":
app.run_server(debug=True)
Description
Under some conditions, the click position of the user does not match the click position interpreted by Cytoscape. This results in, for example, the user clicking on a node but Cytoscape interpreting the click as below the node. The issue disappears after the browser window is resized.
Suspect this is caused by some nuance of CSS styling messing up the position of the Cytoscape canvas, but difficult to debug as I have not been able to reproduce on my machine.
Screen Recording
click.position.mismatch.mov
Steps/Code to Reproduce
Versions
OS: Windows
Browser: Chrome