File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -49,11 +49,12 @@ function change(
49
49
if ( node . children . length === 0 ) {
50
50
const midx = [ target . left , target . right ] . filter ( ( a ) =>
51
51
current . left < a && current . right > a
52
- ) [ 0 ] ;
52
+ ) [ 0 ] ?? current . right ;
53
53
const midy = [ target . down , target . up ] . filter ( ( a ) =>
54
54
current . down < a && current . up > a
55
- ) [ 0 ] ;
55
+ ) [ 0 ] ?? current . up ;
56
56
const subinterval = TwoDSplit ( current , midx , midy ) ;
57
+ // console.log(current, subinterval);
57
58
if ( subinterval . length ) {
58
59
node . children = subinterval . map (
59
60
( c ) =>
@@ -112,7 +113,9 @@ export function TwoDSplit(
112
113
. flat ( ) ;
113
114
return result . filter (
114
115
( { left, right, up, down } ) =>
115
- left <= right && down <= up && ( right - left ) * ( up - down ) ,
116
+ left <= right && down <= up && ( right - left ) * ( up - down ) &&
117
+ ! ( left === current . left && down === current . down &&
118
+ up === current . up && right === current . right ) ,
116
119
) ;
117
120
}
118
121
export class SegmentNode {
You can’t perform that action at this time.
0 commit comments