Skip to content

Commit

Permalink
Merge pull request #273 from VisActor/fix/issue-265
Browse files Browse the repository at this point in the history
fix(components): overlap bitmap test will intercept invalid range met…
  • Loading branch information
xiaoluoHe authored Aug 8, 2023
2 parents 772f7dc + bbd5c58 commit ad39c74
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@visactor/vrender-components",
"comment": "fix(components): overlap bitmap test will intercept invalid range, fix #265",
"type": "patch"
}
],
"packageName": "@visactor/vrender-components"
}
8 changes: 7 additions & 1 deletion packages/vrender-components/src/label/overlap/bitmap.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IBoundsLike } from '@visactor/vutils';
import type { IBoundsLike } from '@visactor/vutils';

/**
* 防重叠逻辑参考 https://github.com/vega/vega/
Expand Down Expand Up @@ -78,6 +78,9 @@ export function bitmap(w: number, h: number) {
* @returns boolean
*/
getRange: ({ x1, y1, x2, y2 }: IBoundsLike) => {
if (x2 < 0 || y2 < 0 || x1 > w || y1 > h) {
return true;
}
let r = y2;
let start;
let end;
Expand Down Expand Up @@ -110,6 +113,9 @@ export function bitmap(w: number, h: number) {
},

setRange: ({ x1, y1, x2, y2 }: IBoundsLike) => {
if (x2 < 0 || y2 < 0 || x1 > w || y1 > h) {
return;
}
let start;
let end;
let indexStart;
Expand Down

0 comments on commit ad39c74

Please sign in to comment.