pissang commented on a change in pull request #14569:
URL: https://github.com/apache/echarts/pull/14569#discussion_r605355065



##########
File path: src/component/helper/BrushTargetManager.ts
##########
@@ -422,26 +423,30 @@ const coordConvert: Record<BrushType, ConvertCoord> = {
 
     lineY: curry(axisConvert, 1),
 
-    rect: function (to, coordSys, rangeOrCoordRange: BrushDimensionMinMax[]): {
+    rect: function (to, coordSys, rangeOrCoordRange: BrushDimensionMinMax[], 
clamp): {
         values: BrushDimensionMinMax[],
         xyMinMax: BrushDimensionMinMax[]
     } {
-        const xminymin = 
coordSys[COORD_CONVERTS[to]]([rangeOrCoordRange[0][0], 
rangeOrCoordRange[1][0]]);
-        const xmaxymax = 
coordSys[COORD_CONVERTS[to]]([rangeOrCoordRange[0][1], 
rangeOrCoordRange[1][1]]);
+        const xminymin = to
+            ? coordSys.pointToData([rangeOrCoordRange[0][0], 
rangeOrCoordRange[1][0]], [], [], clamp)
+            : coordSys.dataToPoint([rangeOrCoordRange[0][0], 
rangeOrCoordRange[1][0]]);
+        const xmaxymax = to
+            ? coordSys.pointToData([rangeOrCoordRange[0][1], 
rangeOrCoordRange[1][1]], [], [], clamp)
+            : coordSys.dataToPoint([rangeOrCoordRange[0][1], 
rangeOrCoordRange[1][1]]);

Review comment:
       I think `dataToPoint` also can be clamped?

##########
File path: src/coord/cartesian/Cartesian2D.ts
##########
@@ -146,15 +146,15 @@ class Cartesian2D extends Cartesian<Axis2D> implements 
CoordinateSystem {
         return out;
     }
 
-    pointToData(point: number[], out?: number[]): number[] {
+    pointToData(point: number[], out?: number[], reserved?: number[], clamp?: 
boolean): number[] {

Review comment:
       This `reserved` parameter in the base class is preserved for parameters 
like `clamp`. So there is no need to add another clamp parameter.  Also, the 
order is wrong. It should be `pointToData(point, clamp, out)`;
   
   There are two other changes I think we can do to simplify the design after 
searched the code.
   1. Remove the `out` parameter because I found there are no lines of code use 
it.
   2. Replace the `reserved?: any` parameter with a `clamp?: boolean` parameter 
because I didn't see any other possibilities. Correct me if I'm wrong




-- 
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.

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