Skip to content

Commit 31c3b36

Browse files
committed
Merge pull request #353 from plotly/zoom-on-line-bug
Correctly compute ultra-zoomed line paths [fixes #217]
2 parents bbb8205 + f356b9e commit 31c3b36

File tree

3 files changed

+47
-2
lines changed

3 files changed

+47
-2
lines changed

src/plots/cartesian/set_convert.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ module.exports = function setConvert(ax) {
123123

124124
ax.l2p = function(v) {
125125
if(!isNumeric(v)) return constants.BADNUM;
126+
126127
// include 2 fractional digits on pixel, for PDF zooming etc
127-
return d3.round(Lib.constrain(ax._b + ax._m*v,
128-
-clipMult*ax._length, (1+clipMult)*ax._length), 2);
128+
return d3.round(ax._b + ax._m * v, 2);
129129
};
130130

131131
ax.p2l = function(px) { return (px-ax._b)/ax._m; };

test/image/baselines/ultra_zoom.png

19 KB
Loading

test/image/mocks/ultra_zoom.json

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"data": [
3+
{
4+
"x": [
5+
10000,
6+
0.0001
7+
],
8+
"y": [
9+
0.0001,
10+
10000
11+
],
12+
"uid": "1376de"
13+
}
14+
],
15+
"layout": {
16+
"xaxis": {
17+
"range": [
18+
4990.012238820174,
19+
5009.888574816098
20+
],
21+
"type": "linear",
22+
"autorange": false
23+
},
24+
"yaxis": {
25+
"range": [
26+
4907.413431128477,
27+
5132.099078595185
28+
],
29+
"type": "linear",
30+
"autorange": false
31+
},
32+
"shapes": [
33+
{
34+
"type": "line",
35+
"x0": 10000,
36+
"x1": 0.0001,
37+
"y0": 10000,
38+
"y1": 0.0001
39+
}
40+
],
41+
"height": 450,
42+
"width": 1000,
43+
"autosize": true
44+
}
45+
}

0 commit comments

Comments
 (0)