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

autoCenter: false does not seem to work correctly #1491

Open
Whiteflight opened this issue Nov 29, 2024 · 1 comment
Open

autoCenter: false does not seem to work correctly #1491

Whiteflight opened this issue Nov 29, 2024 · 1 comment

Comments

@Whiteflight
Copy link

Whiteflight commented Nov 29, 2024

Sigma with option autoRescale: false, autoCenter:false
Searching the code, I cannot find any code that is checking the autoCenter option.

Use case

A user wants to drag a icon from a toolbar into a sigma chart to create a node.

Expected behavior

When the user is dropping the icon on the chart a node is added to the chart at the position where it was dropped.

Actual behaviour

After droppping a node on the chart, Sigma automaticly centers the chart making the icon move away from the dropped position.

Possible workaround

It seems like adding the following line of code after sigma is initialized solves it but I dont know if there are any negavtive effects to it.

renderer.setCustomBBox(renderer.getBBox())

@Whiteflight Whiteflight changed the title Add autoCenter: false option autoCenter: false does not seem to work correctly Nov 29, 2024
@jacomyal jacomyal added the bug label Dec 6, 2024
@jacomyal
Copy link
Owner

jacomyal commented Dec 6, 2024

Hi @Whiteflight,

You're right, I added this setting while implementing autoRescale, but I never plugged it. I'll try to implement it as soon as I can.

About the workaround, you are using the same we use in the nodes dragging story. It should be fine, unless you have some operation that might move the graph affect its scale by a lot. In which case, calling renderer.setCustomBBox(null); will go back to the default behaviour, which is auto rescale and auto center, basically.

Since I actually added that setting and you found it, I agree it should work :) so I just add the "bug" label. Thanks for the report!

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

No branches or pull requests

2 participants