Skip to content

Commit

Permalink
dataZoom's start & end should not be round #1150
Browse files Browse the repository at this point in the history
  • Loading branch information
kener committed Jan 12, 2015
1 parent 4afec3a commit 6b37069
Showing 1 changed file with 24 additions and 32 deletions.
56 changes: 24 additions & 32 deletions src/component/dataZoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -606,26 +606,22 @@ define(function (require) {
this._startShape.style.x = this._fillerShae.style.x - this._handleSize;
this._endShape.style.x = this._fillerShae.style.x + this._fillerShae.style.width;

this._zoom.start = Math.floor(
(this._startShape.style.x - this._location.x)
/ this._location.width * 100
);
this._zoom.end = Math.ceil(
(this._endShape.style.x + this._handleSize - this._location.x)
/ this._location.width * 100
);
this._zoom.start = (
this._startShape.style.x - this._location.x
) / this._location.width * 100;
this._zoom.end = (
this._endShape.style.x + this._handleSize - this._location.x
) / this._location.width * 100;
}
else {
this._startShape.style.y = this._fillerShae.style.y - this._handleSize;
this._endShape.style.y = this._fillerShae.style.y + this._fillerShae.style.height;
this._zoom.start = Math.floor(
(this._startShape.style.y - this._location.y)
/ this._location.height * 100
);
this._zoom.end = Math.ceil(
(this._endShape.style.y + this._handleSize - this._location.y)
/ this._location.height * 100
);
this._zoom.start = (
this._startShape.style.y - this._location.y
) / this._location.height * 100;
this._zoom.end = (
this._endShape.style.y + this._handleSize - this._location.y
) / this._location.height * 100;
}
this.zr.modShape(this._startShape.id);
this.zr.modShape(this._endShape.id);
Expand All @@ -644,28 +640,24 @@ define(function (require) {
b = this._endShape.style.x;
this._fillerShae.style.x = Math.min(a, b) + this._handleSize;
this._fillerShae.style.width = Math.abs(a - b) - this._handleSize;
this._zoom.start = Math.floor(
(Math.min(a, b) - this._location.x)
/ this._location.width * 100
);
this._zoom.end = Math.ceil(
(Math.max(a, b) + this._handleSize - this._location.x)
/ this._location.width * 100
);
this._zoom.start = (
Math.min(a, b) - this._location.x
) / this._location.width * 100;
this._zoom.end = (
Math.max(a, b) + this._handleSize - this._location.x
) / this._location.width * 100;
}
else {
a = this._startShape.style.y;
b = this._endShape.style.y;
this._fillerShae.style.y = Math.min(a, b) + this._handleSize;
this._fillerShae.style.height = Math.abs(a - b) - this._handleSize;
this._zoom.start = Math.floor(
(Math.min(a, b) - this._location.y)
/ this._location.height * 100
);
this._zoom.end = Math.ceil(
(Math.max(a, b) + this._handleSize - this._location.y)
/ this._location.height * 100
);
this._zoom.start = (
Math.min(a, b) - this._location.y
) / this._location.height * 100;
this._zoom.end = (
Math.max(a, b) + this._handleSize - this._location.y
) / this._location.height * 100;
}

this.zr.modShape(this._fillerShae.id);
Expand Down

0 comments on commit 6b37069

Please sign in to comment.