@@ -53,6 +53,7 @@ export function getDragItems(
53
53
extent : n . extent ,
54
54
parentNode : n . parentNode ,
55
55
dimensions : n . dimensions ,
56
+ expandParent : n . expandParent ,
56
57
} ) ,
57
58
)
58
59
}
@@ -132,7 +133,10 @@ export function getExtent<T extends NodeDragItem | GraphNode>(
132
133
) {
133
134
let currentExtent = item . extent || extent
134
135
135
- if ( currentExtent === 'parent' || ( ! Array . isArray ( currentExtent ) && currentExtent ?. range === 'parent' ) ) {
136
+ if (
137
+ ( currentExtent === 'parent' || ( ! Array . isArray ( currentExtent ) && currentExtent ?. range === 'parent' ) ) &&
138
+ ! item . expandParent
139
+ ) {
136
140
if ( item . parentNode && parent && item . dimensions . width && item . dimensions . height ) {
137
141
const parentExtent = getParentExtent ( currentExtent , item , parent )
138
142
@@ -152,7 +156,7 @@ export function getExtent<T extends NodeDragItem | GraphNode>(
152
156
[ currentExtent [ 0 ] [ 0 ] + parentX , currentExtent [ 0 ] [ 1 ] + parentY ] ,
153
157
[ currentExtent [ 1 ] [ 0 ] + parentX , currentExtent [ 1 ] [ 1 ] + parentY ] ,
154
158
]
155
- } else if ( currentExtent ?. range && Array . isArray ( currentExtent . range ) ) {
159
+ } else if ( currentExtent !== 'parent' && currentExtent ?. range && Array . isArray ( currentExtent . range ) ) {
156
160
const [ top , right , bottom , left ] = getExtentPadding ( currentExtent . padding )
157
161
158
162
const parentX = parent ?. computedPosition . x || 0
@@ -164,7 +168,14 @@ export function getExtent<T extends NodeDragItem | GraphNode>(
164
168
]
165
169
}
166
170
167
- return currentExtent as CoordinateExtent
171
+ return (
172
+ currentExtent === 'parent'
173
+ ? [
174
+ [ Number . NEGATIVE_INFINITY , Number . NEGATIVE_INFINITY ] ,
175
+ [ Number . POSITIVE_INFINITY , Number . POSITIVE_INFINITY ] ,
176
+ ]
177
+ : currentExtent
178
+ ) as CoordinateExtent
168
179
}
169
180
170
181
function clampNodeExtent ( { width, height } : Dimensions , extent : CoordinateExtent ) : CoordinateExtent {
0 commit comments