Skip to content

Commit

Permalink
fix y auto-scaling bug with adaptive-unidirectional zooming
Browse files Browse the repository at this point in the history
  • Loading branch information
leeoniya committed May 15, 2020
1 parent 188e521 commit 0895041
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 17 deletions.
11 changes: 7 additions & 4 deletions dist/uPlot.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2085,6 +2085,8 @@ function uPlot(opts, data, then) {

var drag = cursor.drag;

var dragX = drag.x;
var dragY = drag.y;
if ( cursor.show) {
var c = "cursor-";

Expand Down Expand Up @@ -2355,8 +2357,9 @@ function uPlot(opts, data, then) {
if (mouseLeft1 >= 0 && select.show && dragging) {
// setSelect should not be triggered on move events

var dragX = drag.x;
var dragY = drag.y;
dragX = drag.x;
dragY = drag.y;

var uni = drag.uni;

if (uni != null) {
Expand Down Expand Up @@ -2511,14 +2514,14 @@ function uPlot(opts, data, then) {

if (drag.setScale) {
batch(function () {
if (drag.x) {
if (dragX) {
_setScale(xScaleKey,
scaleValueAtPos(select[LEFT], xScaleKey),
scaleValueAtPos(select[LEFT] + select[WIDTH], xScaleKey)
);
}

if (drag.y) {
if (dragY) {
for (var k in scales) {
var sc = scales[k];

Expand Down
11 changes: 7 additions & 4 deletions dist/uPlot.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -2077,6 +2077,8 @@ function uPlot(opts, data, then) {

const drag = cursor.drag;

let dragX = drag.x;
let dragY = drag.y;
if ( cursor.show) {
let c = "cursor-";

Expand Down Expand Up @@ -2347,8 +2349,9 @@ function uPlot(opts, data, then) {
if (mouseLeft1 >= 0 && select.show && dragging) {
// setSelect should not be triggered on move events

let dragX = drag.x;
let dragY = drag.y;
dragX = drag.x;
dragY = drag.y;

let uni = drag.uni;

if (uni != null) {
Expand Down Expand Up @@ -2503,14 +2506,14 @@ function uPlot(opts, data, then) {

if (drag.setScale) {
batch(() => {
if (drag.x) {
if (dragX) {
_setScale(xScaleKey,
scaleValueAtPos(select[LEFT], xScaleKey),
scaleValueAtPos(select[LEFT] + select[WIDTH], xScaleKey),
);
}

if (drag.y) {
if (dragY) {
for (let k in scales) {
let sc = scales[k];

Expand Down
11 changes: 7 additions & 4 deletions dist/uPlot.iife.js
Original file line number Diff line number Diff line change
Expand Up @@ -2086,6 +2086,8 @@ var uPlot = (function () {

var drag = cursor.drag;

var dragX = drag.x;
var dragY = drag.y;
if ( cursor.show) {
var c = "cursor-";

Expand Down Expand Up @@ -2356,8 +2358,9 @@ var uPlot = (function () {
if (mouseLeft1 >= 0 && select.show && dragging) {
// setSelect should not be triggered on move events

var dragX = drag.x;
var dragY = drag.y;
dragX = drag.x;
dragY = drag.y;

var uni = drag.uni;

if (uni != null) {
Expand Down Expand Up @@ -2512,14 +2515,14 @@ var uPlot = (function () {

if (drag.setScale) {
batch(function () {
if (drag.x) {
if (dragX) {
_setScale(xScaleKey,
scaleValueAtPos(select[LEFT], xScaleKey),
scaleValueAtPos(select[LEFT] + select[WIDTH], xScaleKey)
);
}

if (drag.y) {
if (dragY) {
for (var k in scales) {
var sc = scales[k];

Expand Down
Loading

0 comments on commit 0895041

Please sign in to comment.