Skip to content

Commit

Permalink
optimize variable in MarkAreaView.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
jiawulin001 committed Apr 15, 2022
1 parent d3366c9 commit cc3f4a7
Showing 1 changed file with 13 additions and 21 deletions.
34 changes: 13 additions & 21 deletions src/component/marker/MarkAreaView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,16 @@ function ifMarkAreaHasOnlyDim(
function markAreaFilter(coordSys: CoordinateSystem, item: MarkAreaMergedItemOption) {
const fromCoord = item.coord[0];
const toCoord = item.coord[1];
const item0 = {
coord: fromCoord,
x: item.x0,
y: item.y0
};
const item1 = {
coord: toCoord,
x: item.x1,
y: item.y1
};
if (isCoordinateSystemType<Cartesian2D>(coordSys, 'cartesian2d')) {
// In case
// {
Expand All @@ -128,28 +138,10 @@ function markAreaFilter(coordSys: CoordinateSystem, item: MarkAreaMergedItemOpti
//when it's not included in coordinate system.
//But filtering ahead can avoid keeping rendering markArea
//when there are too many of them.
return markerHelper.zoneFilter(coordSys, {
coord: fromCoord,
x: item.x0,
y: item.y0
},
{
coord: toCoord,
x: item.x1,
y: item.y1
}
);
return markerHelper.zoneFilter(coordSys, item0, item1);
}
return markerHelper.dataFilter(coordSys, {
coord: fromCoord,
x: item.x0,
y: item.y0
})
|| markerHelper.dataFilter(coordSys, {
coord: toCoord,
x: item.x1,
y: item.y1
});
return markerHelper.dataFilter(coordSys, item0)
|| markerHelper.dataFilter(coordSys, item1);
}

// dims can be ['x0', 'y0'], ['x1', 'y1'], ['x0', 'y1'], ['x1', 'y0']
Expand Down

0 comments on commit cc3f4a7

Please sign in to comment.