Zoom & offset

In v1 I updated settings::zoom and RackScrollWidget::offset in some of my utility modules for moving the scene around.

This seem not to work anymore since settings::zoom was removed if I set RackSrollWidget::setZoom and RackScrollWidget::offset on the same frame. I believe this is because RackScrollWidget::step uses RackScrollWidget::Internal::oldOffset first and RackScrollWidget::offset afterwards. I know I used unstable API but mybe I’m doing something wrong here or there is some other way.
My use-case is centering something on the screen, like a module.

I feel that I’ll have same problems (still to discover)

Did you try calling RackWidget::setGridOffset() first and then setZoom()?

I’m still strugling with this. Any chance you can give me an example how to center a module in the center of the screen and setting the zoom level the same time? I tried

APP->scene->rackScroll->setGridOffset(...);
APP->scene->rackScroll->setZoom(...);

but I get it only working when the zoom level stays unchanged.

What if you set the zoom first?

I don’t know where the origin of the zoom scaling is?

Problem solved. My code was fine but calling setZoom() within a widget’s step() resulted in strange jumping within the viewport.

1 Like