pissang commented on code in PR #17426:
URL: https://github.com/apache/echarts/pull/17426#discussion_r945667718


##########
src/util/graphic.ts:
##########
@@ -280,12 +281,25 @@ export function subPixelOptimizeLine(param: {
     return param;
 }
 
-export function setGroupSubPixelOptimize(group: Group, useSubPixelOptimize: 
boolean) {
-    group.traverse((el: Element) => {
-        if (el.type === 'line') {
-            (el as Line).attr('subPixelOptimize', useSubPixelOptimize);
+/**
+ * Set the line with the optimized shape.
+ *
+ * @param line the line shape to set
+ * @param lineWidth the line width, if not given, line.style.lineWidth is used
+ */
+ export function setSubPixelOptimizeLine(line: Line, lineWidth?: number) {
+    const lineSubpixelParams = subPixelOptimizeLine({
+        shape: line.shape,
+        style: {
+            lineWidth: retrieve2(lineWidth, line.style.lineWidth)
         }
     });
+    const lineShape = line.shape;
+    const subPixelShape = lineSubpixelParams.shape;
+    lineShape.x1 = subPixelShape.x1;
+    lineShape.y1 = subPixelShape.y1;
+    lineShape.x2 = subPixelShape.x2;
+    lineShape.y2 = subPixelShape.y2;

Review Comment:
   No need to have another method here. `subPixelOptimizeLine` should do the 
work.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to