You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by "Ovilia (via GitHub)" <gi...@apache.org> on 2023/08/30 06:31:25 UTC

[GitHub] [echarts] Ovilia commented on a diff in pull request #19056: fix(clip): calculate with dpr when extending clip path. close #19051

Ovilia commented on code in PR #19056:
URL: https://github.com/apache/echarts/pull/19056#discussion_r1309744690


##########
src/chart/helper/createClipPathFromCoordSys.ts:
##########
@@ -43,7 +44,14 @@ function createGridClipPath(
     let width = rect.width;
     let height = rect.height;
 
-    const lineWidth = seriesModel.get(['lineStyle', 'width']) || 2;
+    const zr = cartesian.model.ecModel.scheduler.ecInstance.getZr();
+    const dpr = zr.painter instanceof CanvasPainter

Review Comment:
   A better way to get dpr is from https://github.com/apache/echarts/blob/master/src/core/echarts.ts#L703 . You may add a new parameter to this function like `dpr`.



##########
src/chart/helper/createClipPathFromCoordSys.ts:
##########
@@ -43,7 +44,14 @@ function createGridClipPath(
     let width = rect.width;
     let height = rect.height;
 
-    const lineWidth = seriesModel.get(['lineStyle', 'width']) || 2;
+    const zr = cartesian.model.ecModel.scheduler.ecInstance.getZr();
+    const dpr = zr.painter instanceof CanvasPainter
+        ? zr.painter.dpr
+        : window.devicePixelRatio; /* global window */
+
+    const _lineWidth = seriesModel.get(['lineStyle', 'width']) || 2;
+    const lineWidth = _lineWidth * (dpr || 1);

Review Comment:
   Better with `const lineWidth = (seriesModel.get(['lineStyle', 'width']) || 2) * (dpr || 1);`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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