Skip to content

Commit 5718eb0

Browse files
committed
fix: 修复单元格宽度为浮点数时出现多余空隙的问题 close #3014
1 parent 598fc42 commit 5718eb0

File tree

8 files changed

+845
-2190
lines changed

8 files changed

+845
-2190
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/**
2+
* @description spec for issue #3014
3+
* https://github.com/antvis/S2/issues/3014
4+
*/
5+
import { pick } from 'lodash';
6+
import { createPivotSheet } from '../util/helpers';
7+
8+
describe('Cell SubPixel Render Tests', () => {
9+
test('should not render sub pixel cell', async () => {
10+
const s2 = createPivotSheet({
11+
width: 800,
12+
height: 600,
13+
});
14+
15+
s2.setThemeCfg({
16+
name: 'colorful',
17+
theme: {
18+
background: {
19+
color: 'red',
20+
},
21+
cornerCell: {
22+
cell: {
23+
backgroundColor: '#ccc',
24+
horizontalBorderWidth: 0,
25+
verticalBorderColor: 'transparent',
26+
verticalBorderColorOpacity: 0,
27+
},
28+
},
29+
},
30+
});
31+
32+
await s2.render();
33+
34+
const sizeList = s2.facet
35+
.getRowNodes()
36+
.map((node) => pick(node, ['width', 'height']));
37+
38+
expect(sizeList).toEqual([
39+
{
40+
width: 200,
41+
height: 60,
42+
},
43+
{
44+
width: 200,
45+
height: 30,
46+
},
47+
{
48+
width: 200,
49+
height: 30,
50+
},
51+
]);
52+
});
53+
});

0 commit comments

Comments
 (0)