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

Method navigate

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

Source from the content-addressed store, hash-verified

879}
880
881void CartesianPlot::navigate(int cSystemIndex, NavigationOperation op) {
882 PERFTRACE(QLatin1String(Q_FUNC_INFO));
883 const auto* cSystem = coordinateSystem(cSystemIndex);
884 int xIndex = -1, yIndex = -1;
885 if (cSystem) {
886 xIndex = cSystem->index(Dimension::X);
887 yIndex = cSystem->index(Dimension::Y);
888 }
889
890 if (op == NavigationOperation::ScaleAuto) {
891 if (!cSystem) { // all csystems
892 for (int i = 0; i < coordinateSystemCount(); i++) {
893 auto* cSystem = coordinateSystem(i);
894 auto xDirty = rangeDirty(Dimension::X, cSystem->index(Dimension::X));
895 auto yDirty = rangeDirty(Dimension::Y, cSystem->index(Dimension::Y));
896
897 if (xDirty || yDirty || !autoScale(Dimension::X, cSystem->index(Dimension::X)) || !autoScale(Dimension::Y, cSystem->index(Dimension::Y))) {
898 setRangeDirty(Dimension::X, cSystem->index(Dimension::X), true);
899 setRangeDirty(Dimension::Y, cSystem->index(Dimension::Y), true);
900 }
901 if (!autoScale(Dimension::X, cSystem->index(Dimension::X)))
902 enableAutoScale(Dimension::X, cSystem->index(Dimension::X), true, true);
903 else // if already autoscale set, scaleAutoX will not be called anymore, so force it to do
904 scaleAuto(Dimension::X, cSystem->index(Dimension::X));
905
906 if (!autoScale(Dimension::Y, cSystem->index(Dimension::Y)))
907 enableAutoScale(Dimension::Y, cSystem->index(Dimension::Y), true, true);
908 else
909 scaleAuto(Dimension::Y, cSystem->index(Dimension::Y));
910 }
911 WorksheetElementContainer::retransform();
912 } else {
913 auto xDirty = rangeDirty(Dimension::X, xIndex);
914 auto yDirty = rangeDirty(Dimension::Y, yIndex);
915
916 if (xDirty || yDirty || !autoScale(Dimension::X, xIndex) || !autoScale(Dimension::Y, yIndex)) {
917 setRangeDirty(Dimension::X, xIndex, true);
918 setRangeDirty(Dimension::Y, yIndex, true);
919 }
920 if (!autoScale(Dimension::X, cSystem->index(Dimension::X)))
921 enableAutoScale(Dimension::X, cSystem->index(Dimension::X), true, true);
922 else
923 scaleAuto(Dimension::X, cSystem->index(Dimension::X), true);
924
925 if (!autoScale(Dimension::Y, cSystem->index(Dimension::Y)))
926 enableAutoScale(Dimension::Y, cSystem->index(Dimension::Y), true, true);
927 else
928 scaleAuto(Dimension::Y, cSystem->index(Dimension::Y), true);
929 WorksheetElementContainer::retransform();
930 }
931 } else if (op == NavigationOperation::ScaleAutoX) {
932 bool update = rangeDirty(Dimension::X, xIndex);
933 if (!autoScale(Dimension::X, xIndex)) {
934 enableAutoScale(Dimension::X, xIndex, true, true);
935 update = true;
936 } else
937 update |= scaleAuto(Dimension::X, xIndex);
938 if (update) {

Callers 15

zoomInX_SingleRangeMethod · 0.80
zoomInX_AllRangesMethod · 0.80
zoomInY_SingleRangeMethod · 0.80
zoomInY_AllRangesMethod · 0.80
zoomOutX_SingleRangeMethod · 0.80
zoomOutX_AllRangesMethod · 0.80
zoomOutY_SingleRangeMethod · 0.80
zoomOutY_AllRangesMethod · 0.80
shiftLeft_SingleRangeMethod · 0.80
shiftLeft_AllRangesMethod · 0.80

Calls 2

indexMethod · 0.45
countMethod · 0.45

Tested by 15

zoomInX_SingleRangeMethod · 0.64
zoomInX_AllRangesMethod · 0.64
zoomInY_SingleRangeMethod · 0.64
zoomInY_AllRangesMethod · 0.64
zoomOutX_SingleRangeMethod · 0.64
zoomOutX_AllRangesMethod · 0.64
zoomOutY_SingleRangeMethod · 0.64
zoomOutY_AllRangesMethod · 0.64
shiftLeft_SingleRangeMethod · 0.64
shiftLeft_AllRangesMethod · 0.64
shiftRight_AllRangesMethod · 0.64