-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Disable Rotation Drag on Polar when dragmode = false #5219
Comments
@Phil-DS Did you find any workaround for this? |
I could also use a fix for this, been trying a multitude of things, but dragmode is the one that makes most sense, but it doesn't seem there is a way to do it :( |
We'd accept a PR for this if someone is interested :) |
Had a look at the source code, it's beyond me I'm afraid =/ |
Sadly, I never found a fix for it. While I could have lived without removing the drag rotation, it had another aspect that it disabled click events, which were pivotal to the use case I had. I did update to the latest today to see if the click events were still disabled by it, and they were. In the end, I ignored the issue. I did have a deeper look into the source code at the time, and unless I did some major overriding, I wouldn't be able to get the click events working with disabling the rotation and zoom. |
I have a workaround if you're using // Add the following state
const [rotation, setRotation] = useState(90);
const [revision, setRevision] = useState(1);
// Add a callback that we will use whenever the layout is updated.
const onLayoutCallbacks = data => {
if (data['polar.angularaxis.rotation']) {
setRotation(90);
setRevision(revision + 1);
}
};
// Add the callback to the component.
// Be sure the layout is based on state, and that it takes in a "revision"
<Plot
onRelayout={onLayoutCallbacks}
onRelayouting={onLayoutCallbacks}
...
layout={{
revision: revision,
polar: {
angularaxis: {
rotation: rotation, It should make it so that callback is executed on/during layout changes, and it specifically resets the angular rotation if that's the data being changed. The result is that you get a gazillion refreshes if someone drags the axis, but it shouldn't change what it looks like. YMMV. |
This will turn off drag event on element that is responsible for drag/rotate action. |
When I set dragmode to false, I'm expecting all drag events to be halted. On polar, the zoom event was halted, but you are still able to click and drag the outer edge of the polar chart, and rotate the chart, which is seemingly impossible to disable without going deep into the halting of events, or making it a static chart (Which means that you lose any sort of interactivity that is enabled by Plotly)
The text was updated successfully, but these errors were encountered: