({
clientX,
clientY,
element,
isExternal,
isMoveOnly,
isSplittable,
sourceTabsetId,
tabList,
tabPanels,
tabsetId
}: {
clientX: number;
clientY: number;
element: Element;
isExternal: boolean;
/** Tabsets kept when empty can be moved, but not merged into other tabsets (which would leave them behind, empty);
* those of other workspaces aren't moved at all (see isExternalDropDisabled) */
isMoveOnly: boolean;
isSplittable: boolean;
sourceTabsetId: string;
tabList: HTMLElement | null | undefined;
tabPanels: HTMLElement | null | undefined;
tabsetId: string;
})
| 319 | } |
| 320 | |
| 321 | function getTabsetDropTarget({ |
| 322 | clientX, |
| 323 | clientY, |
| 324 | element, |
| 325 | isExternal, |
| 326 | isMoveOnly, |
| 327 | isSplittable, |
| 328 | sourceTabsetId, |
| 329 | tabList, |
| 330 | tabPanels, |
| 331 | tabsetId |
| 332 | }: { |
| 333 | clientX: number; |
| 334 | clientY: number; |
| 335 | element: Element; |
| 336 | isExternal: boolean; |
| 337 | /** Tabsets kept when empty can be moved, but not merged into other tabsets (which would leave them behind, empty); |
| 338 | * those of other workspaces aren't moved at all (see isExternalDropDisabled) */ |
| 339 | isMoveOnly: boolean; |
| 340 | isSplittable: boolean; |
| 341 | sourceTabsetId: string; |
| 342 | tabList: HTMLElement | null | undefined; |
| 343 | tabPanels: HTMLElement | null | undefined; |
| 344 | tabsetId: string; |
| 345 | }): TabDropTarget | undefined { |
| 346 | // A tabset can't be dropped onto itself |
| 347 | if (!isExternal && tabsetId === sourceTabsetId) { |
| 348 | return undefined; |
| 349 | } |
| 350 | |
| 351 | if (tabList?.contains(element)) { |
| 352 | return isMoveOnly |
| 353 | ? undefined |
| 354 | : { index: getTabListIndex(tabList, clientX, clientY), tabsetId }; |
| 355 | } |
| 356 | |
| 357 | if (tabPanels?.contains(element)) { |
| 358 | const region = isSplittable |
| 359 | ? getDropRegion(tabPanels.getBoundingClientRect(), clientX, clientY) |
| 360 | : "center"; |
| 361 | |
| 362 | return region === "center" && isMoveOnly ? undefined : { region, tabsetId }; |
| 363 | } |
| 364 | |
| 365 | return undefined; |
| 366 | } |
no test coverage detected