Skip to content

Commit

Permalink
Merge pull request #18950 from benlongo/patch-1
Browse files Browse the repository at this point in the history
fix(type): add `undefined` to the return type of `graphic.clipRectByRect` function
  • Loading branch information
plainheart authored Aug 2, 2023
2 parents 3f9c0b9 + 3bcb901 commit 586ca04
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/util/graphic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ export function clipPointsByRect(points: vector.VectorArray[], rect: ZRRectLike)
/**
* Return a new clipped rect. If rect size are negative, return undefined.
*/
export function clipRectByRect(targetRect: ZRRectLike, rect: ZRRectLike): ZRRectLike {
export function clipRectByRect(targetRect: ZRRectLike, rect: ZRRectLike): ZRRectLike | undefined {
const x = mathMax(targetRect.x, rect.x);
const x2 = mathMin(targetRect.x + targetRect.width, rect.x + rect.width);
const y = mathMax(targetRect.y, rect.y);
Expand Down

0 comments on commit 586ca04

Please sign in to comment.