Skip to content

Commit

Permalink
Fix crash in Zoom Mean Centered and shared axis boxes.
Browse files Browse the repository at this point in the history
  • Loading branch information
netterfield committed Dec 4, 2014
1 parent 9aab883 commit c0ed212
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/libkstapp/plotitem.cpp
Expand Up @@ -3075,7 +3075,7 @@ void PlotItem::zoomMeanCentered(bool force) {

void PlotItem::zoomYMeanCentered(qreal dY, bool force) {
if (isInSharedAxisBox() && !force) {
sharedAxisBox()->zoomYMeanCentered(this);
sharedAxisBox()->zoomYMeanCentered(dY, this);
} else {
ZoomCommand *cmd = new ZoomYMeanCenteredCommand(this, dY, force);
_undoStack->push(cmd);
Expand Down Expand Up @@ -4099,7 +4099,7 @@ void ZoomYMeanCenteredCommand::applyZoomTo(ViewItem *item, bool applyX, bool app
SharedAxisBoxItem *shareBox = qobject_cast<SharedAxisBoxItem*>(item);
if (shareBox) {
if (applyY) {
shareBox->zoomYMeanCentered(0);
shareBox->zoomYMeanCentered(_dY, 0);
}
}
}
Expand Down
11 changes: 6 additions & 5 deletions src/libkstapp/sharedaxisboxitem.cpp
Expand Up @@ -594,12 +594,13 @@ void SharedAxisBoxItem::zoomMeanCentered(PlotItem* originPlotItem) {
applyZoom(computeRect(PlotAxis::Auto, PlotAxis::MeanCentered), originPlotItem, false, true);
}

void SharedAxisBoxItem::zoomYMeanCentered(PlotItem* originPlotItem) {
_yAxisZoomMode = PlotAxis::MeanCentered;
if (originPlotItem) {
originPlotItem->zoomYMeanCentered(true);
void SharedAxisBoxItem::zoomYMeanCentered(qreal dY, PlotItem* originPlotItem) {
if (!_shareY) {
_yAxisZoomMode = PlotAxis::MeanCentered;
if (originPlotItem) {
originPlotItem->zoomYMeanCentered(dY, true);
}
}
applyZoom(computeRect(PlotAxis::Auto, PlotAxis::MeanCentered), originPlotItem, false, true);
}

void SharedAxisBoxItem::zoomXMeanCentered(PlotItem* originPlotItem) {
Expand Down
2 changes: 1 addition & 1 deletion src/libkstapp/sharedaxisboxitem.h
Expand Up @@ -87,7 +87,7 @@ class SharedAxisBoxItem : public ViewItem
void zoomNormalizeXtoY(PlotItem* originPlotItem);
void zoomLogX(PlotItem* originPlotItem, bool autoEnable = true, bool enable = true);

void zoomYMeanCentered(PlotItem* originPlotItem);
void zoomYMeanCentered(qreal dY, PlotItem* originPlotItem);
void zoomYLocalMaximum(PlotItem* originPlotItem);
void zoomYMaximum(PlotItem* originPlotItem);
void zoomYNoSpike(PlotItem* originPlotItem);
Expand Down

0 comments on commit c0ed212

Please sign in to comment.