MCPcopy Create free account
hub / github.com/KDE/labplot / zoomInOut

Method zoomInOut

src/backend/worksheet/plots/cartesian/CartesianPlot.cpp:3101–3134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3099}
3100
3101void CartesianPlot::zoomInOut(const int index, const Dimension dim, const bool zoomIn, const double relScenePosRange) {
3102 Dimension dim_other = Dimension::Y;
3103 if (dim == Dimension::Y)
3104 dim_other = Dimension::X;
3105
3106 setUndoAware(false);
3107 enableAutoScale(dim, index, false);
3108 setUndoAware(true);
3109 setRangeDirty(dim_other, index, true);
3110 zoom(index, dim, zoomIn, relScenePosRange);
3111
3112 bool retrans = false;
3113 for (int i = 0; i < m_coordinateSystems.count(); i++) {
3114 const auto cs = coordinateSystem(i);
3115 if (index == -1 || index == cs->index(dim)) {
3116 if (autoScale(dim_other, cs->index(dim_other)))
3117 scaleAuto(dim_other, cs->index(dim_other), false);
3118 retrans = true;
3119 }
3120 }
3121
3122 Q_D(CartesianPlot);
3123 if (retrans) {
3124 // If the other dimension is autoScale it will be scaled and then
3125 // retransformScale() will be called. So here we just have to do
3126 // it for the nontransformed scale because in zoom it will not be done
3127 if (index == -1) {
3128 for (int i = 0; i < rangeCount(dim); i++)
3129 d->retransformScale(dim, i);
3130 } else
3131 d->retransformScale(dim, index);
3132 WorksheetElementContainer::retransform();
3133 }
3134}
3135
3136/*!
3137 * helper function called in other zoom*() functions

Callers 1

wheelEventMethod · 0.80

Calls 3

retransformScaleMethod · 0.80
countMethod · 0.45
indexMethod · 0.45

Tested by

no test coverage detected