Skip to content

Commit 3126863

Browse files
committed
Fix problem handling with tf1 zooming
When saved points are used, properly extract saved range
1 parent b3ecc9c commit 3126863

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

modules/hist/TF1Painter.mjs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,13 @@ class TF1Painter extends TH1Painter {
234234

235235
/** @summary Checks if it makes sense to zoom inside specified axis range */
236236
canZoomInside(axis, min, max) {
237-
if ((this.$func?.fSave.length > 0) && this._use_saved_points && (axis === 'x')) {
237+
const nsave = this.$func?.fSave.length ?? 0;
238+
if ((nsave > 3) && this._use_saved_points && (axis === 'x')) {
238239
// in the case where the points have been saved, useful for example
239240
// if we don't have the user's function
240-
const nb_points = this.$func.fNpx,
241-
xmin = this.$func.fSave[nb_points + 1],
242-
xmax = this.$func.fSave[nb_points + 2];
241+
const nb_points = nsave - 2,
242+
xmin = this.$func.fSave[nsave - 2],
243+
xmax = this.$func.fSave[nsave - 1];
243244

244245
return Math.abs(xmax - xmin) / nb_points < Math.abs(max - min);
245246
}

0 commit comments

Comments
 (0)