mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-24 10:36:00 +00:00
diagram: select more nodes by drag rectangke
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { arrayDifference } from 'interval-operations';
|
||||
import { intersection, arrayDifference } from 'interval-operations';
|
||||
import _ from 'lodash';
|
||||
|
||||
export interface IPoint {
|
||||
x: number;
|
||||
y: number;
|
||||
@@ -101,6 +102,13 @@ export function rectangleIntersectArea(rect1: IBoxBounds, rect2: IBoxBounds) {
|
||||
return x_overlap * y_overlap;
|
||||
}
|
||||
|
||||
export function rectanglesHaveIntersection(rect1: IBoxBounds, rect2: IBoxBounds) {
|
||||
const xIntersection = intersection([rect1.left, rect1.right], [rect2.left, rect2.right]);
|
||||
const yIntersection = intersection([rect1.top, rect1.bottom], [rect2.top, rect2.bottom]);
|
||||
|
||||
return !!xIntersection && !!yIntersection;
|
||||
}
|
||||
|
||||
export class Vector2D {
|
||||
constructor(public x: number, public y: number) {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user