(target: HTMLElement)
| 318 | }; |
| 319 | |
| 320 | let startDragging = (target: HTMLElement) => { |
| 321 | if (typeof state.options.onDragStart === 'function') { |
| 322 | let rect = target.getBoundingClientRect(); |
| 323 | state.options.onDragStart({ |
| 324 | type: 'dragstart', |
| 325 | x: rect.x + rect.width / 2, |
| 326 | y: rect.y + rect.height / 2 |
| 327 | }); |
| 328 | } |
| 329 | |
| 330 | DragManager.beginDragging( |
| 331 | { |
| 332 | element: target, |
| 333 | items: state.options.getItems(), |
| 334 | allowedDropOperations: |
| 335 | typeof state.options.getAllowedDropOperations === 'function' |
| 336 | ? state.options.getAllowedDropOperations() |
| 337 | : ['move', 'copy', 'link'], |
| 338 | onDragEnd(e) { |
| 339 | setDragging(null); |
| 340 | if (typeof state.options.onDragEnd === 'function') { |
| 341 | state.options.onDragEnd(e); |
| 342 | } |
| 343 | } |
| 344 | }, |
| 345 | stringFormatter |
| 346 | ); |
| 347 | |
| 348 | setDragging(target); |
| 349 | }; |
| 350 | |
| 351 | let modality = useDragModality(); |
| 352 | let message = !isDragging ? MESSAGES[modality].start : MESSAGES[modality].end; |
no test coverage detected