Skip to content

Commit

Permalink
chore: beautify
Browse files Browse the repository at this point in the history
  • Loading branch information
maihde committed Dec 26, 2024
1 parent a4566fe commit 6da0760
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 72 deletions.
142 changes: 71 additions & 71 deletions js/mx.js
Original file line number Diff line number Diff line change
Expand Up @@ -1046,86 +1046,86 @@
}
/* FALL THROUGH!!! */
/* jshint -W086 */
case mx.XW_COMMAND:
/* jshint +W086 */
case mx.XW_COMMAND:
/* jshint +W086 */

smin = sv.smin;
srange = sv.srange;
smin = sv.smin;
srange = sv.srange;

switch (sv.action) {
case mx.SB_STEPINC:
smin += sv.step;
break;
case mx.SB_STEPDEC:
smin -= sv.step;
break;
case mx.SB_PAGEINC:
smin += sv.page;
break;
case mx.SB_PAGEDEC:
smin -= sv.page;
break;
case mx.SB_FULL:
smin = sv.tmin;
srange = sv.trange;
break;
case mx.SB_EXPAND:
srange = srange * sv.scale;
if (smin <= 0 && smin + sv.srange >= 0) {
smin *= sv.scale;
} else {
smin -= (srange - sv.srange) / 2.0;
}
break;
case mx.SB_SHRINK:
srange = srange / sv.scale;
if (smin < 0 && smin + sv.srange >= 0) {
smin += srange / sv.scale; /* Plot crosses axis */
} else if (smin === 0 && smin + sv.srange >= 0) {
smin = srange / sv.scale; /* Plot touches axis */
} else {
smin += (sv.srange - srange) / 2.0; /* Plot is completely contained on positive side of axis */
}
break;
/* The mouse wheel needs to scroll 1 page at a time, if you want an
switch (sv.action) {
case mx.SB_STEPINC:
smin += sv.step;
break;
case mx.SB_STEPDEC:
smin -= sv.step;
break;
case mx.SB_PAGEINC:
smin += sv.page;
break;
case mx.SB_PAGEDEC:
smin -= sv.page;
break;
case mx.SB_FULL:
smin = sv.tmin;
srange = sv.trange;
break;
case mx.SB_EXPAND:
srange = srange * sv.scale;
if (smin <= 0 && smin + sv.srange >= 0) {
smin *= sv.scale;
} else {
smin -= (srange - sv.srange) / 2.0;
}
break;
case mx.SB_SHRINK:
srange = srange / sv.scale;
if (smin < 0 && smin + sv.srange >= 0) {
smin += srange / sv.scale; /* Plot crosses axis */
} else if (smin === 0 && smin + sv.srange >= 0) {
smin = srange / sv.scale; /* Plot touches axis */
} else {
smin += (sv.srange - srange) / 2.0; /* Plot is completely contained on positive side of axis */
}
break;
/* The mouse wheel needs to scroll 1 page at a time, if you want an
application to scroll differently, change sv.page with
mx_scroll_vals in the application code */
case mx.SB_WHEELUP:
smin -= sv.page;
break;
case mx.SB_WHEELDOWN:
smin += sv.page;
break;
}
case mx.SB_WHEELUP:
smin -= sv.page;
break;
case mx.SB_WHEELDOWN:
smin += sv.page;
break;
}

if (sv.trange > 0) {
smin = Math.max(sv.tmin, Math.min(smin, sv.tmin + sv.trange - srange));
srange = Math.min(srange, sv.trange);
} else {
smin = Math.min(sv.tmin, Math.max(smin, sv.tmin + sv.trange - srange));
srange = Math.max(srange, sv.trange);
}
if (sv.trange > 0) {
smin = Math.max(sv.tmin, Math.min(smin, sv.tmin + sv.trange - srange));
srange = Math.min(srange, sv.trange);
} else {
smin = Math.min(sv.tmin, Math.max(smin, sv.tmin + sv.trange - srange));
srange = Math.max(srange, sv.trange);
}

if (sv.smin === smin && sv.srange === srange) {
if (sv.action !== mx.SB_DRAG) {
sv.action = sv.repeat_count = 0;
if (sv.smin === smin && sv.srange === srange) {
if (sv.action !== mx.SB_DRAG) {
sv.action = sv.repeat_count = 0;
}
} else {
// UPDATE SCROLLBAR STATE as well
sv.smin = scrollbarState.smin = smin;
sv.srange = scrollbarState.srange = srange;
sv.repeat_count++;
}
} else {
// UPDATE SCROLLBAR STATE as well
sv.smin = scrollbarState.smin = smin;
sv.srange = scrollbarState.srange = srange;
sv.repeat_count++;
}

if (op === mx.XW_COMMAND) {
mx.scroll(Mx, sv, mx.XW_UPDATE, undefined);
sv.action = 0;
}
if (op === mx.XW_COMMAND) {
mx.scroll(Mx, sv, mx.XW_UPDATE, undefined);
sv.action = 0;
}

break;
case mx.XW_DRAW:
case mx.XW_UPDATE:
mx.redrawScrollbar(sv, Mx, op);
break;
case mx.XW_DRAW:
case mx.XW_UPDATE:
mx.redrawScrollbar(sv, Mx, op);

} /* switch */
return true;
Expand Down
6 changes: 5 additions & 1 deletion test/tests.interactive-layer2d.js
Original file line number Diff line number Diff line change
Expand Up @@ -1725,6 +1725,10 @@ interactiveTest('type1000 file', 'Do you see ydelta calculated correctly?', func
var container = document.getElementById('plot');
var plot = new sigplot.Plot(container, {});
assert.notEqual(plot, null);
plot.overlay_href("dat/ramp.tmp", null, { layerType: sigplot.Layer2D }, {subsize: 10});
plot.overlay_href("dat/ramp.tmp", null, {
layerType: sigplot.Layer2D
}, {
subsize: 10
});

});

0 comments on commit 6da0760

Please sign in to comment.