Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
endDrag: (props, monitor, component) => {
const { hideTimer } = monitor.getItem();
// If the hide call hasn't happened yet, cancel it
window.clearTimeout(hideTimer);
const { mosaicWindowActions, mosaicActions } = component.context;
const type = getPanelTypeFromMosiac(mosaicWindowActions, mosaicActions);
getGlobalHooks().onPanelDrag(type);
const ownPath = component.context.mosaicWindowActions.getPath();
const dropResult = monitor.getDropResult() || {};
const { position, path: destinationPath } = dropResult;
if (position != null && destinationPath != null && !_.isEqual(destinationPath, ownPath)) {
mosaicActions.updateTree(createDragToUpdates(mosaicActions.getRoot(), ownPath, destinationPath, position));
} else {
mosaicActions.updateTree([
{
path: _.dropRight(ownPath),
spec: {
splitPercentage: {
$set: null,
},
},
},
]);
}
},
};