message: Cleanup of cond. statements by leveraging d3.drag.filter for handleSelector in useDrag
diff: @@ -71,16 +71,11 @@ function useDrag({
  if (nodeRef?.current) {
  const selection = select(nodeRef.current);
  - let isDragAllowedBySelector = true;
  if (disabled) {
  selection.on('.drag', null);
  } else {
  const dragHandler = drag()
  .on('start', (event: UseDragEvent) => {
  - if (handleSelector) {
  - isDragAllowedBySelector = selectorExistsTargetToNode(event.sourceEvent.target, handleSelector, nodeRef);
  - }
  - if (isDragAllowedBySelector) {
  const { transform, nodeInternals } = store.getState();
  const offset = getOffset(event, nodeRef);
  parentPos.current = getParentNodePosition(nodeInternals, nodeId);
  @@ -91,10 +86,8 @@ function useDrag({
  };
  onStart(event);
  - }
  })
  .on('drag', (event: UseDragEvent) => {
  - if (isDragAllowedBySelector) {
  const { transform, snapGrid, snapToGrid } = store.getState();
  const pos = pointToRendererPoint(
  {
  @@ -117,16 +110,18 @@ function useDrag({
  dx: pos.x,
  dy: pos.y,
  });
  - }
  event.on('end', (event) => {
  - if (isDragAllowedBySelector) {
  onStop(event);
  - }
  });
  }
  })
  - .filter((event: any) => !event.ctrlKey && !event.button && !event.target.className.includes(noDragClassName));
  + .filter((event: any) => {
  + const filter = !event.ctrlKey && !event.button && !event.target.className.includes(noDragClassName);
  + return handleSelector
  + ? selectorExistsTargetToNode(event.target, handleSelector, nodeRef) && filter
  + : filter;
  + });
  selection.call(dragHandler);
  