Skip to content

Commit

Permalink
feat(transform): add supportCSSTransform option (#1674)
Browse files Browse the repository at this point in the history
  • Loading branch information
hustcc authored Sep 29, 2020
1 parent e9ae75f commit 79fcdc9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/core/plot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@ import { Adaptor } from './adaptor';
/** 单独 pick 出来的用于基类的类型定义 */
export type PickOptions = Pick<
Options,
'width' | 'height' | 'padding' | 'appendPadding' | 'renderer' | 'pixelRatio' | 'autoFit' | 'syncViewPadding'
| 'width'
| 'height'
| 'padding'
| 'appendPadding'
| 'renderer'
| 'pixelRatio'
| 'autoFit'
| 'syncViewPadding'
| 'supportCSSTransform'
>;

/**
Expand Down Expand Up @@ -43,7 +51,16 @@ export abstract class Plot<O extends PickOptions> extends EE {
* 创建 G2 实例
*/
private createG2() {
const { width, height, padding, appendPadding, renderer, pixelRatio, syncViewPadding } = this.options;
const {
width,
height,
padding,
appendPadding,
renderer,
pixelRatio,
syncViewPadding,
supportCSSTransform,
} = this.options;

this.chart = new Chart({
container: this.container,
Expand All @@ -55,6 +72,7 @@ export abstract class Plot<O extends PickOptions> extends EE {
pixelRatio,
localRefresh: false, // 默认关闭,目前 G 还有一些位置问题,难以排查!
syncViewPadding,
supportCSSTransform,
});
}

Expand Down
2 changes: 2 additions & 0 deletions src/types/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ export type Options = {
readonly pixelRatio?: number;
/** 是否开启局部渲染,默认为 true */
readonly localRefresh?: boolean;
/** 支持 CSS transform,开启后图表的交互以及事件将在页面设置了 css transform 属性时生效,默认关闭。 */
readonly supportCSSTransform?: boolean;

// 通用数据配置
/** 具体的数据 */
Expand Down

0 comments on commit 79fcdc9

Please sign in to comment.