Skip to content

Commit a275fb7

Browse files
authored
Couple bug fixes (#147)
* BugFix * Resolve several issues 1: Allow mouse scroll events to pass through to parent if the plot has not mouse scroll events to do. i.e. if scroll to zoom is disabled, and the graph is part of a scroll area, this allows scrolling the scroll area while the mouse is over the plot. 2: Fixed bug with resize timer resetting itself every time, rather than actually performing the countdown and calling the function. 3. Fixed bug with margins being calculated incorrectly, preventing the complete removal of margins from a plot.
1 parent b349f07 commit a275fb7

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

lib/jkqtplotter/jkqtpbaseplotter.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -916,20 +916,20 @@ void JKQTBasePlotter::calcPlotScaling(JKQTPEnhancedPainter& painter){
916916
auto s=xAxis->getSize1(painter);
917917
internalPlotMargins[PlotMarginUse::muAxesOutside].bottom+=s.requiredSize;
918918
if (s.elongateMin>0) elongateLeft=qMax(elongateLeft,s.elongateMin);
919-
if (s.elongateMax>0) elongateRight=qMax(elongateRight,s.elongateMax);
919+
if (s.elongateMax>0) elongateRight=qMin(elongateRight,s.elongateMax);
920920
s=xAxis->getSize2(painter);
921921
if (s.elongateMin>0) elongateLeft=qMax(elongateLeft,s.elongateMin);
922-
if (s.elongateMax>0) elongateRight=qMax(elongateRight,s.elongateMax);
922+
if (s.elongateMax>0) elongateRight=qMin(elongateRight,s.elongateMax);
923923
internalPlotMargins[PlotMarginUse::muAxesOutside].top+=s.requiredSize;
924924

925925
double elongateBottom=0,elongateTop=0;
926926
s=yAxis->getSize1(painter);
927927
if (s.elongateMin>0) elongateBottom=qMax(elongateBottom,s.elongateMin);
928-
if (s.elongateMax>0) elongateTop=qMax(elongateTop,s.elongateMax);
928+
if (s.elongateMax>0) elongateTop=qMin(elongateTop,s.elongateMax);
929929
internalPlotMargins[PlotMarginUse::muAxesOutside].left+=s.requiredSize;
930930
s=yAxis->getSize2(painter);
931931
if (s.elongateMin>0) elongateBottom=qMax(elongateBottom,s.elongateMin);
932-
if (s.elongateMax>0) elongateTop=qMax(elongateTop,s.elongateMax);
932+
if (s.elongateMax>0) elongateTop=qMin(elongateTop,s.elongateMax);
933933
internalPlotMargins[PlotMarginUse::muAxesOutside].right+=s.requiredSize;
934934

935935

lib/jkqtplotter/jkqtplotter.cpp

+7-2
Original file line numberDiff line numberDiff line change
@@ -1140,6 +1140,9 @@ void JKQTPlotter::wheelEvent ( QWheelEvent * event ) {
11401140
if (d.y()>=1 && d.y()<10) d.setY(10);
11411141
if (d.y()<=-1 && d.y()>-10) d.setY(-10);
11421142
}
1143+
}else{
1144+
event->ignore();
1145+
return;
11431146
}
11441147

11451148

@@ -1413,8 +1416,10 @@ void JKQTPlotter::resizeEvent(QResizeEvent *event) {
14131416
// Do this now
14141417
delayedResizeEvent();
14151418
} else {
1416-
resizeTimer.setSingleShot(true);
1417-
resizeTimer.start(jkqtp_RESIZE_DELAY);
1419+
if(!resizeTimer.isActive()){
1420+
resizeTimer.setSingleShot(true);
1421+
resizeTimer.start(jkqtp_RESIZE_DELAY);
1422+
}
14181423
}
14191424
}
14201425

0 commit comments

Comments
 (0)