X-Git-Url: https://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fcwindowgui.C;fp=cinelerra-5.1%2Fcinelerra%2Fcwindowgui.C;h=c854ce31cac4eeb8c0dbb6b79ecf5856102f723c;hb=3ceaf97d3b161445161eb5d48f3e8d5e9c34e3f8;hp=3e980b8b99308e7d89c99de872db4bc413af10cd;hpb=568bf4145a8bc66472ea3625741dacbd3b56ccc0;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/cinelerra/cwindowgui.C b/cinelerra-5.1/cinelerra/cwindowgui.C index 3e980b8b..c854ce31 100644 --- a/cinelerra-5.1/cinelerra/cwindowgui.C +++ b/cinelerra-5.1/cinelerra/cwindowgui.C @@ -396,14 +396,18 @@ void CWindowGUI::zoom_canvas(double value, int update_menu) { float x = 0, y = 0; float zoom = !value ? get_auto_zoom() : value; - mwindow->edl->session->cwindow_scrollbars = !value ? 0 : 1; + EDL *edl = mwindow->edl; + edl->session->cwindow_scrollbars = !value ? 0 : 1; if( value ) { - float cx = canvas->get_xscroll() + 0.5f*canvas->w_visible; - float cy = canvas->get_yscroll() + 0.5f*canvas->h_visible; - float output_x = cx, output_y = cy; - canvas->output_to_canvas(mwindow->edl, 0, cx, cy); - x = output_x - cx / zoom; - y = output_y - cy / zoom; + float cx = 0.5f * canvas->w; x = cx; + float cy = 0.5f * canvas->h; y = cy; + canvas->canvas_to_output(edl, 0, x, y); + canvas->update_zoom(0, 0, zoom); + float zoom_x, zoom_y, conformed_w, conformed_h; + canvas->get_zooms(edl, 0, zoom_x, zoom_y, conformed_w, conformed_h); + x -= cx / zoom_x; + y -= cy / zoom_y; + } canvas->update_zoom((int)(x+0.5), (int)(y+0.5), zoom);