You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by wa...@apache.org on 2021/01/11 01:46:33 UTC

[incubator-echarts] branch fix-export-dpr created (now c9da1c9)

This is an automated email from the ASF dual-hosted git repository.

wangzx pushed a change to branch fix-export-dpr
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git.


      at c9da1c9  fix(toolbox): use current device pixel ratio by default for exporting crisp and clear images.

This branch includes the following new commits:

     new c9da1c9  fix(toolbox): use current device pixel ratio by default for exporting crisp and clear images.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


[incubator-echarts] 01/01: fix(toolbox): use current device pixel ratio by default for exporting crisp and clear images.

Posted by wa...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

wangzx pushed a commit to branch fix-export-dpr
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git

commit c9da1c91837a56e65be3dc95fcb8928763d8be4b
Author: plainheart <yh...@all-my-life.cn>
AuthorDate: Mon Jan 11 09:44:14 2021 +0800

    fix(toolbox): use current device pixel ratio by default for exporting crisp and clear images.
---
 src/component/toolbox/feature/SaveAsImage.ts | 4 ++--
 src/core/echarts.ts                          | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/component/toolbox/feature/SaveAsImage.ts b/src/component/toolbox/feature/SaveAsImage.ts
index 65a57aa..f7caa58 100644
--- a/src/component/toolbox/feature/SaveAsImage.ts
+++ b/src/component/toolbox/feature/SaveAsImage.ts
@@ -44,7 +44,6 @@ export interface ToolboxSaveAsImageFeatureOption extends ToolboxFeatureOption {
 class SaveAsImage extends ToolboxFeature<ToolboxSaveAsImageFeatureOption> {
 
     onclick(ecModel: GlobalModel, api: ExtensionAPI) {
-
         const model = this.model;
         const title = model.get('name') || ecModel.get('title.0.text') || 'echarts';
         const isSvg = api.getZr().painter.getType() === 'svg';
@@ -133,7 +132,8 @@ class SaveAsImage extends ToolboxFeature<ToolboxSaveAsImageFeatureOption> {
             connectedBackgroundColor: '#fff',
             name: '',
             excludeComponents: ['toolbox'],
-            pixelRatio: 1,
+            // use current pixel ratio of device by default
+            // pixelRatio: 1,
             lang: ecModel.getLocale(['toolbox', 'saveAsImage', 'lang'])
         };
 
diff --git a/src/core/echarts.ts b/src/core/echarts.ts
index eaf1550..4e9a06a 100644
--- a/src/core/echarts.ts
+++ b/src/core/echarts.ts
@@ -653,7 +653,7 @@ class ECharts extends Eventful {
             return;
         }
         opts = zrUtil.extend({}, opts || {});
-        opts.pixelRatio = opts.pixelRatio || 1;
+        opts.pixelRatio = opts.pixelRatio || this.getDevicePixelRatio();
         opts.backgroundColor = opts.backgroundColor
             || this._model.get('backgroundColor');
         const zr = this._zr;
@@ -755,7 +755,7 @@ class ECharts extends Eventful {
             let right = -MAX_NUMBER;
             let bottom = -MAX_NUMBER;
             const canvasList: {dom: HTMLCanvasElement | string, left: number, top: number}[] = [];
-            const dpr = (opts && opts.pixelRatio) || 1;
+            const dpr = (opts && opts.pixelRatio) || this.getDevicePixelRatio();
 
             zrUtil.each(instances, function (chart, id) {
                 if (chart.group === groupId) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org