I'm trying to make a Plotly.js window that covers the entire available window. In order to do this, I am adding a listener to resize the window, and animating the resize. When I do this, the camera changes all of its parameters to reset to its original location, ignoring what the user may have done to rotate and zoom.
Any suggestions on how to make this less jaring? I can't find any way to see how the camera is adjusted per the user, which would allow me to manually figure things out if it came to that, but... This is effectively the code I am working with currently.
window.addEventListener("resize",Refresh)
function resize(data) {
var size = {
width: window.innerWidth || document.body.clientWidth,
height: window.innerHeight || document.body.clientHeight
}
newLayout = {width:size.width * 0.99, height:size.height * 0.90, }
Plotly.animate('solarPlot', {layout:newLayout},
{transition: {duration:100, easing:'cubic-in-out'},
frame:{duration:100},})
}
The answer was elsewhere. The initial plot should be created using Plotly.newPlot. I was using Plotly.react, which will create a plot the first time, but it will change cameras when things are changed.