@flowgram.ai/free-layout-core 0.2.10 → 0.2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -52,7 +52,12 @@ import { useCallback, useEffect as useEffect2, useRef, useState, useContext, use
52
52
  import { useObserve } from "@flowgram.ai/reactive";
53
53
  import { getNodeForm } from "@flowgram.ai/node";
54
54
  import { FlowNodeRenderData as FlowNodeRenderData3 } from "@flowgram.ai/document";
55
- import { PlaygroundEntityContext, useListenEvents, useService } from "@flowgram.ai/core";
55
+ import {
56
+ MouseTouchEvent as MouseTouchEvent2,
57
+ PlaygroundEntityContext,
58
+ useListenEvents,
59
+ useService
60
+ } from "@flowgram.ai/core";
56
61
 
57
62
  // src/service/workflow-select-service.ts
58
63
  import { inject, injectable } from "inversify";
@@ -1048,7 +1053,9 @@ import { EntityManager } from "@flowgram.ai/core";
1048
1053
  var WorkflowHoverService = class {
1049
1054
  constructor() {
1050
1055
  this.onHoveredChangeEmitter = new Emitter2();
1056
+ this.onUpdateHoverPositionEmitter = new Emitter2();
1051
1057
  this.onHoveredChange = this.onHoveredChangeEmitter.event;
1058
+ this.onUpdateHoverPosition = this.onUpdateHoverPositionEmitter.event;
1052
1059
  // 当前鼠标 hover 位置
1053
1060
  this.hoveredPos = { x: 0, y: 0 };
1054
1061
  /**
@@ -1068,6 +1075,13 @@ var WorkflowHoverService = class {
1068
1075
  this.onHoveredChangeEmitter.fire(hoveredKey);
1069
1076
  }
1070
1077
  }
1078
+ updateHoverPosition(position, target) {
1079
+ this.hoveredPos = position;
1080
+ this.onUpdateHoverPositionEmitter.fire({
1081
+ position,
1082
+ target
1083
+ });
1084
+ }
1071
1085
  /**
1072
1086
  * 清空 hover 内容
1073
1087
  */
@@ -1117,6 +1131,7 @@ import {
1117
1131
  import { FlowNodeBaseType as FlowNodeBaseType2 } from "@flowgram.ai/document";
1118
1132
  import {
1119
1133
  CommandService,
1134
+ MouseTouchEvent,
1120
1135
  PlaygroundConfigEntity as PlaygroundConfigEntity5,
1121
1136
  PlaygroundDrag,
1122
1137
  TransformData as TransformData9
@@ -2392,7 +2407,8 @@ var WorkflowDragService = class {
2392
2407
  });
2393
2408
  }
2394
2409
  });
2395
- return dragger.start(triggerEvent.clientX, triggerEvent.clientY, this.playgroundConfig)?.then(() => dragSuccess);
2410
+ const { clientX, clientY } = MouseTouchEvent.getEventCoord(triggerEvent);
2411
+ return dragger.start(clientX, clientY, this.playgroundConfig)?.then(() => dragSuccess);
2396
2412
  }
2397
2413
  /**
2398
2414
  * 通过拖入卡片添加
@@ -2802,7 +2818,8 @@ var WorkflowDragService = class {
2802
2818
  }
2803
2819
  }
2804
2820
  });
2805
- await dragger.start(event.clientX, event.clientY, config);
2821
+ const { clientX, clientY } = MouseTouchEvent.getEventCoord(event);
2822
+ await dragger.start(clientX, clientY, config);
2806
2823
  return deferred.promise;
2807
2824
  }
2808
2825
  /**
@@ -3044,12 +3061,14 @@ function useNodeRender(nodeFromProps) {
3044
3061
  }, []);
3045
3062
  const startDrag = useCallback(
3046
3063
  (e) => {
3047
- e.preventDefault();
3064
+ MouseTouchEvent2.preventDefault(e);
3048
3065
  if (!selectionService.isSelected(node.id)) {
3049
3066
  selectNode(e);
3050
3067
  }
3051
- if (!checkTargetDraggable(e.target) || !checkTargetDraggable(document.activeElement)) {
3052
- return;
3068
+ if (!MouseTouchEvent2.isTouchEvent(e)) {
3069
+ if (!checkTargetDraggable(e.target) || !checkTargetDraggable(document.activeElement)) {
3070
+ return;
3071
+ }
3053
3072
  }
3054
3073
  isDragging.current = true;
3055
3074
  dragService.startDragSelectedNodes(e)?.finally(