Skip to content

Commit c135e09

Browse files
committed
🔪 coercePosition logic during annotations3d convert
- this is now handled in the axis convertion methods
1 parent e88656c commit c135e09

File tree

2 files changed

+0
-57
lines changed

2 files changed

+0
-57
lines changed

src/components/annotations3d/convert.js

-22
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
var Lib = require('../../lib');
1212
var Axes = require('../../plots/cartesian/axes');
13-
var attributes = require('./attributes');
1413

1514
module.exports = function convert(scene) {
1615
var fullSceneLayout = scene.fullSceneLayout;
@@ -61,25 +60,4 @@ function mockAnnAxes(ann, scene) {
6160
ann._ya.l2p = function() {
6261
return 0.5 * (1 - ann.pdata[1] / ann.pdata[3]) * size.h * (domain.y[1] - domain.y[0]);
6362
};
64-
65-
// or do something more similar to 2d
66-
// where Annotations.supplyLayoutDefaults is called after in Plots.doCalcdata
67-
// if category axes are found.
68-
function coerce(attr, dflt) {
69-
return Lib.coerce(ann, ann, attributes, attr, dflt);
70-
}
71-
72-
function coercePosition(axLetter) {
73-
var axName = axLetter + 'axis';
74-
75-
// mock in such way that getFromId grabs correct 3D axis
76-
var gdMock = { _fullLayout: {} };
77-
gdMock._fullLayout[axName] = fullSceneLayout[axName];
78-
79-
return Axes.coercePosition(ann, gdMock, coerce, axLetter, axLetter, 0.5);
80-
}
81-
82-
coercePosition('x');
83-
coercePosition('y');
84-
coercePosition('z');
8563
}

test/jasmine/tests/annotations_test.js

-35
Original file line numberDiff line numberDiff line change
@@ -97,41 +97,6 @@ describe('Test annotations', function() {
9797
expect(layoutOut.annotations[0].x).toEqual('2008-07-01');
9898
expect(layoutOut.annotations[0].ax).toEqual('2004-07-01');
9999
});
100-
101-
it('should convert ax/ay category coordinates to linear coords', function() {
102-
var layoutIn = {
103-
annotations: [{
104-
showarrow: true,
105-
axref: 'x',
106-
ayref: 'y',
107-
x: 'c',
108-
ax: 1,
109-
y: 'A',
110-
ay: 3
111-
}]
112-
};
113-
114-
var layoutOut = {
115-
xaxis: {
116-
type: 'category',
117-
_categories: ['a', 'b', 'c'],
118-
range: [-0.5, 2.5] },
119-
yaxis: {
120-
type: 'category',
121-
_categories: ['A', 'B', 'C'],
122-
range: [-0.5, 3]
123-
}
124-
};
125-
Axes.setConvert(layoutOut.xaxis);
126-
Axes.setConvert(layoutOut.yaxis);
127-
128-
_supply(layoutIn, layoutOut);
129-
130-
expect(layoutOut.annotations[0].x).toEqual(2);
131-
expect(layoutOut.annotations[0].ax).toEqual(1);
132-
expect(layoutOut.annotations[0].y).toEqual(0);
133-
expect(layoutOut.annotations[0].ay).toEqual(3);
134-
});
135100
});
136101
});
137102

0 commit comments

Comments
 (0)