Skip to content

Commit c7f98b4

Browse files
authored
fix(sync-view-padding): add syncViewPadding in core plot (#1600)
* fix(sync-view-padding): add syncViewPadding in core plot * fix: type define
1 parent e712a0b commit c7f98b4

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"dependencies": {
5656
"@antv/data-set": "^0.11.5",
5757
"@antv/event-emitter": "^0.1.2",
58-
"@antv/g2": "^4.1.0-beta.6",
58+
"@antv/g2": "^4.1.0-beta.7",
5959
"dayjs": "^1.8.34",
6060
"size-sensor": "^1.0.1",
6161
"tslib": "^1.13.0"

src/core/plot.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { Adaptor } from './adaptor';
1010
/** 单独 pick 出来的用于基类的类型定义 */
1111
export type PickOptions = Pick<
1212
Options,
13-
'width' | 'height' | 'padding' | 'appendPadding' | 'renderer' | 'pixelRatio' | 'autoFit'
13+
'width' | 'height' | 'padding' | 'appendPadding' | 'renderer' | 'pixelRatio' | 'autoFit' | 'syncViewPadding'
1414
>;
1515

1616
/**
@@ -43,7 +43,7 @@ export abstract class Plot<O extends PickOptions> extends EE {
4343
* 创建 G2 实例
4444
*/
4545
private createG2() {
46-
const { width, height, padding, appendPadding, renderer, pixelRatio } = this.options;
46+
const { width, height, padding, appendPadding, renderer, pixelRatio, syncViewPadding } = this.options;
4747

4848
this.chart = new Chart({
4949
container: this.container,
@@ -54,6 +54,7 @@ export abstract class Plot<O extends PickOptions> extends EE {
5454
renderer,
5555
pixelRatio,
5656
localRefresh: false, // 默认关闭,目前 G 还有一些位置问题,难以排查!
57+
syncViewPadding,
5758
});
5859
}
5960

src/types/common.ts

+2
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ export type Options = {
8585
readonly padding?: number[] | number | 'auto';
8686
/** 额外怎加的 padding 值 */
8787
readonly appendPadding?: number[] | number;
88+
/** 是否同步子 view 的 padding */
89+
readonly syncViewPadding?: boolean;
8890

8991
// G 相关
9092
/** 渲染引擎 */

0 commit comments

Comments
 (0)