Skip to content

Dynamically scale cross-probe zooming

CHANGED: When doing cross-probe zooming, KiCad zooms the selected component to fill the screen. This makes it hard to understand the part in context so users would have to always zoom out manually. This commit uses the default text height in Eeschema and Pcbnew as a constant (Thanks @craftyjon for that initial idea!) to compare the height of selected parts or components against. This lets the code determine how big the part is and scale the zoom wider accordingly. Big parts get less scaling and small part get more.

The code use LUTs that are linearly interpolated to arrive at the scaling needed for any given component/footprint. The relationship between component or footprint size and how much wider the view needs to be is very non-linear, which is why I use the interpolated LUT.

The amount the zoom is widened varies based on component/symbol size. As a sample, this is what the default fullscreen zoom looks like on a schematic of mine: Original_Kicad_HD_screen_fullsize

And this is what the scaled zoom looks like: Scaled_Zoom_Kicad_HD_screen_fullsize

NOTE: There is a little bit of debug code present. There are #ifdefs to let developers easily swap in the original KiCad zoom for comparison. There is also a bool added that can force each program to always perform the new calculated zoom since KiCad ignores zooms that are close to the current value. This debug code can be removed later as desired.

Edited by Peter Montgomery

Merge request reports