MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / setKeepRatioXY

Method setKeepRatioXY

pj_plotting/widget/src/PlotWidgetBase.cpp:455–471  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

453}
454
455void PlotWidgetBase::setKeepRatioXY(bool active) {
456 keep_aspect_ratio_ = active;
457 plot_->zoomer->keepAspectRatio(isXYPlot() && active);
458 if (!isXYPlot()) {
459 return;
460 }
461 // Reshape current view; otherwise the toggle only takes effect on the next
462 // drag-zoom. OFF re-fits to data bounds (loses zoom by design).
463 if (active) {
464 applyRectKeepingRatio(currentBoundingRect());
465 replot();
466 } else {
467 // resetZoom() refreshes max bounds first: data may have changed since the
468 // last reset, so the cached max_zoom_rect_ could be stale.
469 resetZoom();
470 }
471}
472
473void PlotWidgetBase::applyRectKeepingRatio(QRectF rect) {
474 if (isXYPlot() && keep_aspect_ratio_) {

Callers 2

applyGlobalTogglesMethod · 0.80
buildGlobalToolbarMethod · 0.80

Calls 1

keepAspectRatioMethod · 0.80

Tested by

no test coverage detected