Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/core/echarts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ export interface SetOptionOpts {
export interface ResizeOpts {
width?: number | 'auto', // Can be 'auto' (the same as null/undefined)
height?: number | 'auto', // Can be 'auto' (the same as null/undefined)
devicePixelRatio?: number,
animation?: AnimationOption
silent?: boolean // by default false.
};
Expand Down Expand Up @@ -1364,7 +1365,14 @@ class ECharts extends Eventful<ECEventDefinition> {
return;
}

this._zr.resize(opts);
// Default to use window.devicePixelRatio to handle browser zoom changes.
const zrResizeOpts = opts ? extend({}, opts) : {};
if (zrResizeOpts.devicePixelRatio == null && env.hasGlobalWindow) {
/* eslint-disable-next-line */
zrResizeOpts.devicePixelRatio = window.devicePixelRatio;
}

this._zr.resize(zrResizeOpts);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the devicePixelRatio is now fetched and used by zrender, I think we can move this logic to zrender. Here, we only need to pass the user-defined resize options.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done. The devicePixelRatio is fetched in zrender now.


const ecModel = this._model;

Expand Down