@flowgram.ai/minimap-plugin 0.1.0-alpha.2
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 +583 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/index.d.mts +128 -0
- package/dist/index.d.ts +128 -0
- package/dist/index.js +623 -0
- package/dist/index.js.map +1 -0
- package/package.json +62 -0
|
@@ -0,0 +1,583 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
4
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
5
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
|
+
if (decorator = decorators[i])
|
|
7
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
+
if (kind && result) __defProp(target, key, result);
|
|
9
|
+
return result;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// src/component.tsx
|
|
13
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
14
|
+
|
|
15
|
+
// src/constant.ts
|
|
16
|
+
var MinimapDefaultCanvasStyle = {
|
|
17
|
+
canvasWidth: 250,
|
|
18
|
+
canvasHeight: 250,
|
|
19
|
+
canvasPadding: 50,
|
|
20
|
+
canvasBackground: "rgba(242, 243, 245, 1)",
|
|
21
|
+
canvasBorderRadius: 10,
|
|
22
|
+
viewportBackground: "rgba(255, 255, 255, 1)",
|
|
23
|
+
viewportBorderRadius: 4,
|
|
24
|
+
viewportBorderColor: "rgba(6, 7, 9, 0.10)",
|
|
25
|
+
viewportBorderWidth: 1,
|
|
26
|
+
viewportBorderDashLength: void 0,
|
|
27
|
+
nodeColor: "rgba(0, 0, 0, 0.10)",
|
|
28
|
+
nodeBorderRadius: 2,
|
|
29
|
+
nodeBorderWidth: 0.145,
|
|
30
|
+
nodeBorderColor: "rgba(6, 7, 9, 0.10)",
|
|
31
|
+
overlayColor: "rgba(255, 255, 255, 0.55)"
|
|
32
|
+
};
|
|
33
|
+
var MinimapDefaultInactiveStyle = {
|
|
34
|
+
scale: 0.7,
|
|
35
|
+
opacity: 1,
|
|
36
|
+
translateX: 15,
|
|
37
|
+
translateY: 15
|
|
38
|
+
};
|
|
39
|
+
var MinimapDefaultOptions = {
|
|
40
|
+
canvasStyle: MinimapDefaultCanvasStyle,
|
|
41
|
+
canvasClassName: "gedit-minimap-canvas",
|
|
42
|
+
enableActiveDebounce: false,
|
|
43
|
+
enableInactiveDebounce: true,
|
|
44
|
+
enableDisplayAllNodes: false,
|
|
45
|
+
activeDebounceTime: 0,
|
|
46
|
+
inactiveDebounceTime: 5
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// src/component.tsx
|
|
50
|
+
var MinimapRender = (props) => {
|
|
51
|
+
const {
|
|
52
|
+
service,
|
|
53
|
+
panelStyles = {},
|
|
54
|
+
containerStyles = {},
|
|
55
|
+
inactiveStyle: customInactiveStyle = {}
|
|
56
|
+
} = props;
|
|
57
|
+
const inactiveStyle = {
|
|
58
|
+
...MinimapDefaultInactiveStyle,
|
|
59
|
+
...customInactiveStyle
|
|
60
|
+
};
|
|
61
|
+
const panelRef = useRef(null);
|
|
62
|
+
const [activated, setActivated] = useState(false);
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
const canvasContainer = panelRef.current;
|
|
65
|
+
if (canvasContainer && service.canvas) {
|
|
66
|
+
canvasContainer.appendChild(service.canvas);
|
|
67
|
+
}
|
|
68
|
+
const disposer = service.onActive((activate) => {
|
|
69
|
+
setActivated(activate);
|
|
70
|
+
});
|
|
71
|
+
return () => {
|
|
72
|
+
disposer.dispose();
|
|
73
|
+
};
|
|
74
|
+
}, []);
|
|
75
|
+
const scale = activated ? 1 : inactiveStyle.scale;
|
|
76
|
+
const opacity = activated ? 1 : inactiveStyle.opacity;
|
|
77
|
+
const translateX = activated ? 0 : inactiveStyle.translateX;
|
|
78
|
+
const translateY = activated ? 0 : inactiveStyle.translateY;
|
|
79
|
+
return /* @__PURE__ */ React.createElement(
|
|
80
|
+
"div",
|
|
81
|
+
{
|
|
82
|
+
className: "minimap-container",
|
|
83
|
+
style: {
|
|
84
|
+
position: "fixed",
|
|
85
|
+
right: 30,
|
|
86
|
+
bottom: 70,
|
|
87
|
+
transition: "all 0.3s ease",
|
|
88
|
+
// 添加过渡效果
|
|
89
|
+
transform: `scale(${scale}) translate(${translateX}px, ${translateY}px)`,
|
|
90
|
+
opacity,
|
|
91
|
+
transformOrigin: "bottom right",
|
|
92
|
+
// 设置变换的原点
|
|
93
|
+
...containerStyles
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
/* @__PURE__ */ React.createElement(
|
|
97
|
+
"div",
|
|
98
|
+
{
|
|
99
|
+
className: "minimap-panel",
|
|
100
|
+
style: {
|
|
101
|
+
display: "flex",
|
|
102
|
+
width: "100%",
|
|
103
|
+
height: "100%",
|
|
104
|
+
borderRadius: "10px",
|
|
105
|
+
backgroundColor: "rgba(255, 255, 255, 1)",
|
|
106
|
+
border: "0.572px solid rgba(6, 7, 9, 0.10)",
|
|
107
|
+
overflow: "hidden",
|
|
108
|
+
boxShadow: "0px 2.289px 6.867px 0px rgba(0, 0, 0, 0.08), 0px 4.578px 13.733px 0px rgba(0, 0, 0, 0.04)",
|
|
109
|
+
padding: 8,
|
|
110
|
+
...panelStyles
|
|
111
|
+
},
|
|
112
|
+
"data-flow-editor-selectable": "false",
|
|
113
|
+
ref: panelRef,
|
|
114
|
+
onMouseEnter: () => {
|
|
115
|
+
service.setActivate(true);
|
|
116
|
+
},
|
|
117
|
+
onMouseLeave: () => {
|
|
118
|
+
service.setActivate(false);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
)
|
|
122
|
+
);
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
// src/create-plugin.ts
|
|
126
|
+
import { definePluginCreator } from "@flowgram.ai/core";
|
|
127
|
+
|
|
128
|
+
// src/service.ts
|
|
129
|
+
import { debounce } from "lodash";
|
|
130
|
+
import { inject, injectable } from "inversify";
|
|
131
|
+
import { DisposableCollection, Rectangle } from "@flowgram.ai/utils";
|
|
132
|
+
import { FlowNodeTransformData } from "@flowgram.ai/document";
|
|
133
|
+
import { FlowNodeBaseType } from "@flowgram.ai/document";
|
|
134
|
+
import { FlowDocument } from "@flowgram.ai/document";
|
|
135
|
+
import { EntityManager, PlaygroundConfigEntity } from "@flowgram.ai/core";
|
|
136
|
+
|
|
137
|
+
// src/draw.ts
|
|
138
|
+
var MinimapDraw;
|
|
139
|
+
((MinimapDraw2) => {
|
|
140
|
+
MinimapDraw2.clear = (params) => {
|
|
141
|
+
const { canvas, context } = params;
|
|
142
|
+
context.clearRect(0, 0, canvas.width, canvas.height);
|
|
143
|
+
};
|
|
144
|
+
MinimapDraw2.backgroundColor = (params) => {
|
|
145
|
+
const { canvas, context, color } = params;
|
|
146
|
+
context.fillStyle = color;
|
|
147
|
+
context.fillRect(0, 0, canvas.width, canvas.height);
|
|
148
|
+
};
|
|
149
|
+
MinimapDraw2.rectangle = (params) => {
|
|
150
|
+
const { context, rect, color } = params;
|
|
151
|
+
context.fillStyle = color;
|
|
152
|
+
context.fillRect(rect.x, rect.y, rect.width, rect.height);
|
|
153
|
+
};
|
|
154
|
+
MinimapDraw2.roundRectangle = (params) => {
|
|
155
|
+
const { context, rect, color, radius, borderColor, borderDashLength, borderWidth = 0 } = params;
|
|
156
|
+
const { x, y, width, height } = rect;
|
|
157
|
+
context.beginPath();
|
|
158
|
+
const drawRoundedRectPath = () => {
|
|
159
|
+
context.moveTo(x + radius, y);
|
|
160
|
+
context.lineTo(x + width - radius, y);
|
|
161
|
+
context.quadraticCurveTo(x + width, y, x + width, y + radius);
|
|
162
|
+
context.lineTo(x + width, y + height - radius);
|
|
163
|
+
context.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);
|
|
164
|
+
context.lineTo(x + radius, y + height);
|
|
165
|
+
context.quadraticCurveTo(x, y + height, x, y + height - radius);
|
|
166
|
+
context.lineTo(x, y + radius);
|
|
167
|
+
context.quadraticCurveTo(x, y, x + radius, y);
|
|
168
|
+
context.closePath();
|
|
169
|
+
};
|
|
170
|
+
drawRoundedRectPath();
|
|
171
|
+
context.fillStyle = color;
|
|
172
|
+
context.fill();
|
|
173
|
+
if (borderColor && borderWidth > 0) {
|
|
174
|
+
context.strokeStyle = borderColor;
|
|
175
|
+
context.lineWidth = borderWidth;
|
|
176
|
+
if (borderDashLength) {
|
|
177
|
+
context.setLineDash([borderDashLength, borderDashLength]);
|
|
178
|
+
} else {
|
|
179
|
+
context.setLineDash([]);
|
|
180
|
+
}
|
|
181
|
+
context.stroke();
|
|
182
|
+
context.setLineDash([]);
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
MinimapDraw2.overlay = (params) => {
|
|
186
|
+
const { canvas, context, offset, scale, rect, color } = params;
|
|
187
|
+
context.fillStyle = color;
|
|
188
|
+
context.fillRect(0, 0, canvas.width, (rect.y + offset.y) * scale);
|
|
189
|
+
context.fillRect(
|
|
190
|
+
0,
|
|
191
|
+
(rect.y + rect.height + offset.y) * scale,
|
|
192
|
+
canvas.width,
|
|
193
|
+
canvas.height - (rect.y + rect.height + offset.y) * scale
|
|
194
|
+
);
|
|
195
|
+
context.fillRect(
|
|
196
|
+
0,
|
|
197
|
+
(rect.y + offset.y) * scale,
|
|
198
|
+
(rect.x + offset.x) * scale,
|
|
199
|
+
rect.height * scale
|
|
200
|
+
);
|
|
201
|
+
context.fillRect(
|
|
202
|
+
(rect.x + rect.width + offset.x) * scale,
|
|
203
|
+
(rect.y + offset.y) * scale,
|
|
204
|
+
canvas.width - (rect.x + rect.width + offset.x) * scale,
|
|
205
|
+
rect.height * scale
|
|
206
|
+
);
|
|
207
|
+
};
|
|
208
|
+
})(MinimapDraw || (MinimapDraw = {}));
|
|
209
|
+
|
|
210
|
+
// src/service.ts
|
|
211
|
+
var FlowMinimapService = class {
|
|
212
|
+
constructor() {
|
|
213
|
+
this.onActive = (callback) => {
|
|
214
|
+
this.onActiveCallbacks.add(callback);
|
|
215
|
+
return {
|
|
216
|
+
dispose: () => {
|
|
217
|
+
this.onActiveCallbacks.delete(callback);
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
/**
|
|
222
|
+
* 触发渲染
|
|
223
|
+
*/
|
|
224
|
+
this.render = this._render;
|
|
225
|
+
this.handleWheel = (event) => {
|
|
226
|
+
};
|
|
227
|
+
this.handleStartDrag = (event) => {
|
|
228
|
+
event.preventDefault();
|
|
229
|
+
event.stopPropagation();
|
|
230
|
+
const renderContext = this.createRenderContext();
|
|
231
|
+
const { viewRect, scale, offset } = renderContext;
|
|
232
|
+
const canvasRect = this.canvas.getBoundingClientRect();
|
|
233
|
+
const mousePoint = {
|
|
234
|
+
x: event.clientX - canvasRect.left,
|
|
235
|
+
y: event.clientY - canvasRect.top
|
|
236
|
+
};
|
|
237
|
+
const viewRectOnCanvas = this.rectOnCanvas({
|
|
238
|
+
rect: viewRect,
|
|
239
|
+
scale,
|
|
240
|
+
offset
|
|
241
|
+
});
|
|
242
|
+
if (!this.isPointInRect({ point: mousePoint, rect: viewRectOnCanvas })) {
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
this.isDragging = true;
|
|
246
|
+
this.dragStart = mousePoint;
|
|
247
|
+
document.addEventListener("mousemove", this.handleDragging);
|
|
248
|
+
document.addEventListener("mouseup", this.handleEndDrag);
|
|
249
|
+
};
|
|
250
|
+
this.handleDragging = (event) => {
|
|
251
|
+
if (!this.isDragging || !this.dragStart) return;
|
|
252
|
+
event.preventDefault();
|
|
253
|
+
event.stopPropagation();
|
|
254
|
+
const renderContext = this.createRenderContext();
|
|
255
|
+
const { scale } = renderContext;
|
|
256
|
+
const canvasRect = this.canvas.getBoundingClientRect();
|
|
257
|
+
const mouseX = event.clientX - canvasRect.left;
|
|
258
|
+
const mouseY = event.clientY - canvasRect.top;
|
|
259
|
+
const deltaX = (mouseX - this.dragStart.x) / scale;
|
|
260
|
+
const deltaY = (mouseY - this.dragStart.y) / scale;
|
|
261
|
+
this.updateScrollPosition(deltaX, deltaY);
|
|
262
|
+
this.dragStart = { x: mouseX, y: mouseY };
|
|
263
|
+
this.render();
|
|
264
|
+
};
|
|
265
|
+
this.handleEndDrag = (event) => {
|
|
266
|
+
event.preventDefault();
|
|
267
|
+
event.stopPropagation();
|
|
268
|
+
document.removeEventListener("mousemove", this.handleDragging);
|
|
269
|
+
document.removeEventListener("mouseup", this.handleEndDrag);
|
|
270
|
+
this.isDragging = false;
|
|
271
|
+
this.dragStart = void 0;
|
|
272
|
+
this.setActivate(this.isMouseInCanvas(event));
|
|
273
|
+
};
|
|
274
|
+
this.handleCursor = (event) => {
|
|
275
|
+
if (!this.activated) return;
|
|
276
|
+
const renderContext = this.createRenderContext();
|
|
277
|
+
const { viewRect, scale, offset } = renderContext;
|
|
278
|
+
const canvasRect = this.canvas.getBoundingClientRect();
|
|
279
|
+
const mousePoint = {
|
|
280
|
+
x: event.clientX - canvasRect.left,
|
|
281
|
+
y: event.clientY - canvasRect.top
|
|
282
|
+
};
|
|
283
|
+
const viewRectOnCanvas = this.rectOnCanvas({
|
|
284
|
+
rect: viewRect,
|
|
285
|
+
scale,
|
|
286
|
+
offset
|
|
287
|
+
});
|
|
288
|
+
if (this.isPointInRect({ point: mousePoint, rect: viewRectOnCanvas })) {
|
|
289
|
+
this.canvas.style.cursor = "grab";
|
|
290
|
+
} else {
|
|
291
|
+
this.canvas.style.cursor = "default";
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
this.canvas = document.createElement("canvas");
|
|
295
|
+
this.context2D = this.canvas.getContext("2d");
|
|
296
|
+
this.initialized = !!this.context2D;
|
|
297
|
+
this.onActiveCallbacks = /* @__PURE__ */ new Set();
|
|
298
|
+
this.toDispose = new DisposableCollection();
|
|
299
|
+
this.render = this._render;
|
|
300
|
+
this.activated = false;
|
|
301
|
+
this.isDragging = false;
|
|
302
|
+
}
|
|
303
|
+
init(options) {
|
|
304
|
+
this.options = MinimapDefaultOptions;
|
|
305
|
+
Object.assign(this.options, options);
|
|
306
|
+
this.setDebounce({
|
|
307
|
+
enableDebounce: this.options.enableInactiveDebounce,
|
|
308
|
+
debounceTime: this.options.inactiveDebounceTime
|
|
309
|
+
});
|
|
310
|
+
this.initStyle();
|
|
311
|
+
this.mountListener();
|
|
312
|
+
}
|
|
313
|
+
dispose() {
|
|
314
|
+
this.toDispose.dispose();
|
|
315
|
+
this.initialized = false;
|
|
316
|
+
this.activated = false;
|
|
317
|
+
this.removeEventListeners();
|
|
318
|
+
}
|
|
319
|
+
setActivate(activate) {
|
|
320
|
+
if (activate === this.activated) {
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
if (!activate && this.isDragging) {
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
this.activated = activate;
|
|
327
|
+
if (activate) {
|
|
328
|
+
this.setDebounce({
|
|
329
|
+
enableDebounce: this.options.enableActiveDebounce,
|
|
330
|
+
debounceTime: this.options.activeDebounceTime
|
|
331
|
+
});
|
|
332
|
+
this.addEventListeners();
|
|
333
|
+
} else {
|
|
334
|
+
this.setDebounce({
|
|
335
|
+
enableDebounce: this.options.enableInactiveDebounce,
|
|
336
|
+
debounceTime: this.options.inactiveDebounceTime
|
|
337
|
+
});
|
|
338
|
+
this.removeEventListeners();
|
|
339
|
+
}
|
|
340
|
+
this.render();
|
|
341
|
+
this.onActiveCallbacks.forEach((callback) => callback(activate));
|
|
342
|
+
}
|
|
343
|
+
initStyle() {
|
|
344
|
+
if (!this.initialized) {
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
const { canvasClassName, canvasStyle } = this.options;
|
|
348
|
+
this.canvas.className = canvasClassName;
|
|
349
|
+
this.style = {
|
|
350
|
+
...MinimapDefaultCanvasStyle,
|
|
351
|
+
...canvasStyle
|
|
352
|
+
};
|
|
353
|
+
this.canvas.width = this.style.canvasWidth;
|
|
354
|
+
this.canvas.height = this.style.canvasHeight;
|
|
355
|
+
this.canvas.style.borderRadius = this.style.canvasBorderRadius ? `${this.style.canvasBorderRadius}px` : "unset";
|
|
356
|
+
}
|
|
357
|
+
setDebounce(params) {
|
|
358
|
+
const { enableDebounce, debounceTime } = params;
|
|
359
|
+
if (enableDebounce) {
|
|
360
|
+
this.render = debounce(this._render, debounceTime);
|
|
361
|
+
} else {
|
|
362
|
+
this.render = this._render;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
_render() {
|
|
366
|
+
if (!this.initialized) {
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
const renderContext = this.createRenderContext();
|
|
370
|
+
this.renderCanvas(renderContext);
|
|
371
|
+
}
|
|
372
|
+
createRenderContext() {
|
|
373
|
+
const { canvas, context2D, nodes } = this;
|
|
374
|
+
const nodeTransforms = this.nodeTransforms(nodes);
|
|
375
|
+
const nodeRects = nodeTransforms.map((transform) => transform.bounds);
|
|
376
|
+
const viewRect = this.viewRect();
|
|
377
|
+
const renderRect = this.renderRect(nodeRects).withPadding({
|
|
378
|
+
top: this.style.canvasPadding,
|
|
379
|
+
bottom: this.style.canvasPadding,
|
|
380
|
+
left: this.style.canvasPadding,
|
|
381
|
+
right: this.style.canvasPadding
|
|
382
|
+
});
|
|
383
|
+
const canvasRect = Rectangle.enlarge([viewRect, renderRect]);
|
|
384
|
+
const { scale, offset } = this.calculateScaleAndOffset({ canvasRect });
|
|
385
|
+
return {
|
|
386
|
+
canvas,
|
|
387
|
+
context2D,
|
|
388
|
+
nodeRects,
|
|
389
|
+
canvasRect,
|
|
390
|
+
viewRect,
|
|
391
|
+
renderRect,
|
|
392
|
+
scale,
|
|
393
|
+
offset
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
renderCanvas(renderContext) {
|
|
397
|
+
const { canvas, context2D, nodeRects, viewRect, scale, offset } = renderContext;
|
|
398
|
+
MinimapDraw.clear({ canvas, context: context2D });
|
|
399
|
+
MinimapDraw.backgroundColor({
|
|
400
|
+
canvas,
|
|
401
|
+
context: context2D,
|
|
402
|
+
color: this.style.canvasBackground
|
|
403
|
+
});
|
|
404
|
+
MinimapDraw.roundRectangle({
|
|
405
|
+
context: context2D,
|
|
406
|
+
rect: this.rectOnCanvas({ rect: viewRect, scale, offset }),
|
|
407
|
+
color: this.style.viewportBackground,
|
|
408
|
+
radius: this.style.viewportBorderRadius
|
|
409
|
+
});
|
|
410
|
+
nodeRects.forEach((nodeRect) => {
|
|
411
|
+
MinimapDraw.roundRectangle({
|
|
412
|
+
context: context2D,
|
|
413
|
+
rect: this.rectOnCanvas({ rect: nodeRect, scale, offset }),
|
|
414
|
+
color: this.style.nodeColor,
|
|
415
|
+
radius: this.style.nodeBorderRadius,
|
|
416
|
+
borderWidth: this.style.nodeBorderWidth,
|
|
417
|
+
borderColor: this.style.nodeBorderColor
|
|
418
|
+
});
|
|
419
|
+
});
|
|
420
|
+
MinimapDraw.roundRectangle({
|
|
421
|
+
context: context2D,
|
|
422
|
+
rect: this.rectOnCanvas({ rect: viewRect, scale, offset }),
|
|
423
|
+
color: "rgba(255, 255, 255, 0)",
|
|
424
|
+
radius: this.style.viewportBorderRadius,
|
|
425
|
+
borderColor: this.style.viewportBorderColor,
|
|
426
|
+
borderWidth: this.style.viewportBorderWidth,
|
|
427
|
+
borderDashLength: this.style.viewportBorderDashLength
|
|
428
|
+
});
|
|
429
|
+
MinimapDraw.overlay({
|
|
430
|
+
canvas,
|
|
431
|
+
context: context2D,
|
|
432
|
+
offset,
|
|
433
|
+
scale,
|
|
434
|
+
rect: viewRect,
|
|
435
|
+
color: this.style.overlayColor
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
calculateScaleAndOffset(params) {
|
|
439
|
+
const { canvasRect } = params;
|
|
440
|
+
const { width: canvasWidth, height: canvasHeight } = this.canvas;
|
|
441
|
+
const scaleX = canvasWidth / canvasRect.width;
|
|
442
|
+
const scaleY = canvasHeight / canvasRect.height;
|
|
443
|
+
const scale = Math.min(scaleX, scaleY);
|
|
444
|
+
const scaledWidth = canvasRect.width * scale;
|
|
445
|
+
const scaledHeight = canvasRect.height * scale;
|
|
446
|
+
const centerOffsetX = (canvasWidth - scaledWidth) / 2;
|
|
447
|
+
const centerOffsetY = (canvasHeight - scaledHeight) / 2;
|
|
448
|
+
const offset = {
|
|
449
|
+
x: centerOffsetX / scale - canvasRect.x,
|
|
450
|
+
y: centerOffsetY / scale - canvasRect.y
|
|
451
|
+
};
|
|
452
|
+
return { scale, offset };
|
|
453
|
+
}
|
|
454
|
+
get nodes() {
|
|
455
|
+
return this.document.getAllNodes().filter((node) => {
|
|
456
|
+
if (node.hidden) return false;
|
|
457
|
+
if (node.flowNodeType === FlowNodeBaseType.ROOT) return;
|
|
458
|
+
if (!this.options.enableDisplayAllNodes && node.parent && node.parent.flowNodeType !== FlowNodeBaseType.ROOT)
|
|
459
|
+
return;
|
|
460
|
+
return true;
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
nodeTransforms(nodes) {
|
|
464
|
+
return nodes.map((node) => node.getData(FlowNodeTransformData)).filter(Boolean);
|
|
465
|
+
}
|
|
466
|
+
renderRect(rects) {
|
|
467
|
+
return Rectangle.enlarge(rects);
|
|
468
|
+
}
|
|
469
|
+
viewRect() {
|
|
470
|
+
const { width, height, scrollX, scrollY, zoom } = this.playgroundConfig.config;
|
|
471
|
+
return new Rectangle(scrollX / zoom, scrollY / zoom, width / zoom, height / zoom);
|
|
472
|
+
}
|
|
473
|
+
mountListener() {
|
|
474
|
+
const entityManagerDisposer = this.entityManager.onEntityChange(() => this.render());
|
|
475
|
+
this.toDispose.push(entityManagerDisposer);
|
|
476
|
+
}
|
|
477
|
+
/** 计算画布坐标系下的矩形 */
|
|
478
|
+
rectOnCanvas(params) {
|
|
479
|
+
const { rect, scale, offset } = params;
|
|
480
|
+
return new Rectangle(
|
|
481
|
+
(rect.x + offset.x) * scale,
|
|
482
|
+
(rect.y + offset.y) * scale,
|
|
483
|
+
rect.width * scale,
|
|
484
|
+
rect.height * scale
|
|
485
|
+
);
|
|
486
|
+
}
|
|
487
|
+
isPointInRect(params) {
|
|
488
|
+
const { point, rect } = params;
|
|
489
|
+
return point.x >= rect.x && point.x <= rect.x + rect.width && point.y >= rect.y && point.y <= rect.y + rect.height;
|
|
490
|
+
}
|
|
491
|
+
addEventListeners() {
|
|
492
|
+
this.canvas.addEventListener("wheel", this.handleWheel);
|
|
493
|
+
this.canvas.addEventListener("mousedown", this.handleStartDrag);
|
|
494
|
+
this.canvas.addEventListener("mousemove", this.handleCursor);
|
|
495
|
+
}
|
|
496
|
+
removeEventListeners() {
|
|
497
|
+
this.canvas.removeEventListener("wheel", this.handleWheel);
|
|
498
|
+
this.canvas.removeEventListener("mousedown", this.handleStartDrag);
|
|
499
|
+
this.canvas.removeEventListener("mousemove", this.handleCursor);
|
|
500
|
+
}
|
|
501
|
+
isMouseInCanvas(event) {
|
|
502
|
+
const canvasRect = this.canvas.getBoundingClientRect();
|
|
503
|
+
return event.clientX >= canvasRect.left && event.clientX <= canvasRect.right && event.clientY >= canvasRect.top && event.clientY <= canvasRect.bottom;
|
|
504
|
+
}
|
|
505
|
+
updateScrollPosition(deltaX, deltaY) {
|
|
506
|
+
const { scrollX, scrollY, zoom } = this.playgroundConfig.config;
|
|
507
|
+
this.playgroundConfig.updateConfig({
|
|
508
|
+
scrollX: scrollX + deltaX * zoom,
|
|
509
|
+
scrollY: scrollY + deltaY * zoom
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
};
|
|
513
|
+
__decorateClass([
|
|
514
|
+
inject(FlowDocument)
|
|
515
|
+
], FlowMinimapService.prototype, "document", 2);
|
|
516
|
+
__decorateClass([
|
|
517
|
+
inject(EntityManager)
|
|
518
|
+
], FlowMinimapService.prototype, "entityManager", 2);
|
|
519
|
+
__decorateClass([
|
|
520
|
+
inject(PlaygroundConfigEntity)
|
|
521
|
+
], FlowMinimapService.prototype, "playgroundConfig", 2);
|
|
522
|
+
FlowMinimapService = __decorateClass([
|
|
523
|
+
injectable()
|
|
524
|
+
], FlowMinimapService);
|
|
525
|
+
|
|
526
|
+
// src/layer.tsx
|
|
527
|
+
import React2 from "react";
|
|
528
|
+
import { inject as inject2, injectable as injectable2 } from "inversify";
|
|
529
|
+
import { Layer } from "@flowgram.ai/core";
|
|
530
|
+
import { domUtils } from "@flowgram.ai/utils";
|
|
531
|
+
var FlowMinimapLayer = class extends Layer {
|
|
532
|
+
constructor() {
|
|
533
|
+
super();
|
|
534
|
+
this.className = "gedit-minimap-layer gedit-playground-layer";
|
|
535
|
+
this.node = domUtils.createDivWithClass(this.className);
|
|
536
|
+
this.node.style.zIndex = "9999";
|
|
537
|
+
}
|
|
538
|
+
render() {
|
|
539
|
+
if (this.options.disableLayer) {
|
|
540
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null);
|
|
541
|
+
}
|
|
542
|
+
return /* @__PURE__ */ React2.createElement(
|
|
543
|
+
MinimapRender,
|
|
544
|
+
{
|
|
545
|
+
service: this.service,
|
|
546
|
+
panelStyles: this.options.panelStyles,
|
|
547
|
+
containerStyles: this.options.containerStyles,
|
|
548
|
+
inactiveStyle: this.options.inactiveStyle
|
|
549
|
+
}
|
|
550
|
+
);
|
|
551
|
+
}
|
|
552
|
+
};
|
|
553
|
+
FlowMinimapLayer.type = "FlowMinimapLayer";
|
|
554
|
+
__decorateClass([
|
|
555
|
+
inject2(FlowMinimapService)
|
|
556
|
+
], FlowMinimapLayer.prototype, "service", 2);
|
|
557
|
+
FlowMinimapLayer = __decorateClass([
|
|
558
|
+
injectable2()
|
|
559
|
+
], FlowMinimapLayer);
|
|
560
|
+
|
|
561
|
+
// src/create-plugin.ts
|
|
562
|
+
var createMinimapPlugin = definePluginCreator({
|
|
563
|
+
onBind: ({ bind }) => {
|
|
564
|
+
bind(FlowMinimapService).toSelf().inSingletonScope();
|
|
565
|
+
},
|
|
566
|
+
onInit: (ctx, opts) => {
|
|
567
|
+
ctx.playground.registerLayer(FlowMinimapLayer, opts);
|
|
568
|
+
ctx.get(FlowMinimapService).init(opts);
|
|
569
|
+
},
|
|
570
|
+
onDispose: (ctx) => {
|
|
571
|
+
ctx.get(FlowMinimapService).dispose();
|
|
572
|
+
}
|
|
573
|
+
});
|
|
574
|
+
export {
|
|
575
|
+
FlowMinimapLayer,
|
|
576
|
+
FlowMinimapService,
|
|
577
|
+
MinimapDefaultCanvasStyle,
|
|
578
|
+
MinimapDefaultInactiveStyle,
|
|
579
|
+
MinimapDefaultOptions,
|
|
580
|
+
MinimapRender,
|
|
581
|
+
createMinimapPlugin
|
|
582
|
+
};
|
|
583
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/component.tsx","../../src/constant.ts","../../src/create-plugin.ts","../../src/service.ts","../../src/draw.ts","../../src/layer.tsx"],"sourcesContent":["import React, { CSSProperties, FC, useEffect, useRef, useState } from 'react';\n\nimport { MinimapInactiveStyle } from './type';\nimport { FlowMinimapService } from './service';\nimport { MinimapDefaultInactiveStyle } from './constant';\n\ninterface MinimapProps {\n service: FlowMinimapService;\n panelStyles?: CSSProperties;\n containerStyles?: CSSProperties;\n inactiveStyle?: Partial<MinimapInactiveStyle>;\n}\n\nexport const MinimapRender: FC<MinimapProps> = props => {\n const {\n service,\n panelStyles = {},\n containerStyles = {},\n inactiveStyle: customInactiveStyle = {},\n } = props;\n const inactiveStyle = {\n ...MinimapDefaultInactiveStyle,\n ...customInactiveStyle,\n };\n const panelRef = useRef<HTMLDivElement>(null);\n const [activated, setActivated] = useState<boolean>(false);\n\n useEffect(() => {\n const canvasContainer: HTMLDivElement | null = panelRef.current;\n if (canvasContainer && service.canvas) {\n canvasContainer.appendChild(service.canvas);\n }\n const disposer = service.onActive((activate: boolean) => {\n setActivated(activate);\n });\n return () => {\n disposer.dispose();\n };\n }, []);\n\n // 计算缩放比例和透明度\n const scale: number = activated ? 1 : inactiveStyle.scale;\n const opacity: number = activated ? 1 : inactiveStyle.opacity;\n\n // 计算偏移量\n const translateX: number = activated ? 0 : inactiveStyle.translateX; // 向右偏移的像素\n const translateY: number = activated ? 0 : inactiveStyle.translateY; // 向下偏移的像素\n\n return (\n <div\n className=\"minimap-container\"\n style={{\n position: 'fixed',\n right: 30,\n bottom: 70,\n transition: 'all 0.3s ease', // 添加过渡效果\n transform: `scale(${scale}) translate(${translateX}px, ${translateY}px)`,\n opacity: opacity,\n transformOrigin: 'bottom right', // 设置变换的原点\n ...containerStyles,\n }}\n >\n <div\n className=\"minimap-panel\"\n style={{\n display: 'flex',\n width: '100%',\n height: '100%',\n borderRadius: '10px',\n backgroundColor: 'rgba(255, 255, 255, 1)',\n border: '0.572px solid rgba(6, 7, 9, 0.10)',\n overflow: 'hidden',\n boxShadow:\n '0px 2.289px 6.867px 0px rgba(0, 0, 0, 0.08), 0px 4.578px 13.733px 0px rgba(0, 0, 0, 0.04)',\n padding: 8,\n ...panelStyles,\n }}\n data-flow-editor-selectable=\"false\"\n ref={panelRef}\n onMouseEnter={() => {\n service.setActivate(true);\n }}\n onMouseLeave={() => {\n service.setActivate(false);\n }}\n ></div>\n </div>\n );\n};\n","import type { MinimapCanvasStyle, MinimapInactiveStyle, MinimapServiceOptions } from './type';\n\nexport const MinimapDefaultCanvasStyle: MinimapCanvasStyle = {\n canvasWidth: 250,\n canvasHeight: 250,\n canvasPadding: 50,\n canvasBackground: 'rgba(242, 243, 245, 1)',\n canvasBorderRadius: 10,\n viewportBackground: 'rgba(255, 255, 255, 1)',\n viewportBorderRadius: 4,\n viewportBorderColor: 'rgba(6, 7, 9, 0.10)',\n viewportBorderWidth: 1,\n viewportBorderDashLength: undefined,\n nodeColor: 'rgba(0, 0, 0, 0.10)',\n nodeBorderRadius: 2,\n nodeBorderWidth: 0.145,\n nodeBorderColor: 'rgba(6, 7, 9, 0.10)',\n overlayColor: 'rgba(255, 255, 255, 0.55)',\n};\n\nexport const MinimapDefaultInactiveStyle: MinimapInactiveStyle = {\n scale: 0.7,\n opacity: 1,\n translateX: 15,\n translateY: 15,\n};\n\nexport const MinimapDefaultOptions: MinimapServiceOptions = {\n canvasStyle: MinimapDefaultCanvasStyle,\n canvasClassName: 'gedit-minimap-canvas',\n enableActiveDebounce: false,\n enableInactiveDebounce: true,\n enableDisplayAllNodes: false,\n activeDebounceTime: 0,\n inactiveDebounceTime: 5,\n};\n","import { definePluginCreator, PluginContext } from '@flowgram.ai/core';\n\nimport { CreateMinimapPluginOptions } from './type';\nimport { FlowMinimapService } from './service';\nimport { FlowMinimapLayer } from './layer';\n\nexport const createMinimapPlugin = definePluginCreator<CreateMinimapPluginOptions>({\n onBind: ({ bind }) => {\n bind(FlowMinimapService).toSelf().inSingletonScope();\n },\n onInit: (ctx: PluginContext, opts: CreateMinimapPluginOptions) => {\n ctx.playground.registerLayer(FlowMinimapLayer, opts);\n ctx.get(FlowMinimapService).init(opts);\n },\n onDispose: (ctx: PluginContext) => {\n ctx.get(FlowMinimapService).dispose();\n },\n});\n","import { debounce } from 'lodash';\nimport { inject, injectable } from 'inversify';\nimport { Disposable, DisposableCollection, IPoint, Rectangle } from '@flowgram.ai/utils';\nimport { FlowNodeEntity, FlowNodeTransformData } from '@flowgram.ai/document';\nimport { FlowNodeBaseType } from '@flowgram.ai/document';\nimport { FlowDocument } from '@flowgram.ai/document';\nimport { EntityManager, PlaygroundConfigEntity } from '@flowgram.ai/core';\n\nimport type { MinimapRenderContext, MinimapServiceOptions, MinimapCanvasStyle } from './type';\nimport { MinimapDraw } from './draw';\nimport { MinimapDefaultCanvasStyle, MinimapDefaultOptions } from './constant';\n\n@injectable()\nexport class FlowMinimapService {\n @inject(FlowDocument) private readonly document: FlowDocument;\n\n @inject(EntityManager) private readonly entityManager: EntityManager;\n\n @inject(PlaygroundConfigEntity)\n private readonly playgroundConfig: PlaygroundConfigEntity;\n\n public readonly canvas: HTMLCanvasElement;\n\n public readonly context2D: CanvasRenderingContext2D;\n\n public activated;\n\n private onActiveCallbacks: Set<(activated: boolean) => void>;\n\n private options: MinimapServiceOptions;\n\n private toDispose: DisposableCollection;\n\n private initialized;\n\n private isDragging;\n\n private style: MinimapCanvasStyle;\n\n private dragStart?: IPoint;\n\n constructor() {\n this.canvas = document.createElement('canvas');\n this.context2D = this.canvas.getContext('2d')!;\n this.initialized = !!this.context2D;\n this.onActiveCallbacks = new Set();\n this.toDispose = new DisposableCollection();\n this.render = this._render;\n this.activated = false;\n this.isDragging = false;\n }\n\n public init(options?: Partial<MinimapServiceOptions>) {\n this.options = MinimapDefaultOptions;\n Object.assign(this.options, options);\n this.setDebounce({\n enableDebounce: this.options.enableInactiveDebounce,\n debounceTime: this.options.inactiveDebounceTime,\n });\n this.initStyle();\n this.mountListener();\n }\n\n public dispose(): void {\n this.toDispose.dispose();\n this.initialized = false;\n this.activated = false;\n this.removeEventListeners();\n }\n\n public setActivate(activate: boolean): void {\n if (activate === this.activated) {\n return;\n }\n if (!activate && this.isDragging) {\n // 拖拽时持续激活\n return;\n }\n this.activated = activate;\n if (activate) {\n this.setDebounce({\n enableDebounce: this.options.enableActiveDebounce,\n debounceTime: this.options.activeDebounceTime,\n });\n this.addEventListeners();\n } else {\n this.setDebounce({\n enableDebounce: this.options.enableInactiveDebounce,\n debounceTime: this.options.inactiveDebounceTime,\n });\n this.removeEventListeners();\n }\n this.render();\n this.onActiveCallbacks.forEach((callback) => callback(activate));\n }\n\n public onActive = (callback: (activated: boolean) => void): Disposable => {\n this.onActiveCallbacks.add(callback);\n return {\n dispose: () => {\n this.onActiveCallbacks.delete(callback);\n },\n };\n };\n\n private initStyle() {\n if (!this.initialized) {\n return;\n }\n const { canvasClassName, canvasStyle } = this.options;\n this.canvas.className = canvasClassName;\n this.style = {\n ...MinimapDefaultCanvasStyle,\n ...canvasStyle,\n };\n this.canvas.width = this.style.canvasWidth;\n this.canvas.height = this.style.canvasHeight;\n this.canvas.style.borderRadius = this.style.canvasBorderRadius\n ? `${this.style.canvasBorderRadius}px`\n : 'unset';\n }\n\n private setDebounce(params: { enableDebounce: boolean; debounceTime: number }) {\n const { enableDebounce, debounceTime } = params;\n if (enableDebounce) {\n this.render = debounce(this._render, debounceTime);\n } else {\n this.render = this._render;\n }\n }\n\n /**\n * 触发渲染\n */\n private render: () => void = this._render;\n\n private _render(): void {\n if (!this.initialized) {\n return;\n }\n const renderContext = this.createRenderContext();\n this.renderCanvas(renderContext);\n }\n\n private createRenderContext(): MinimapRenderContext {\n const { canvas, context2D, nodes } = this;\n const nodeTransforms: FlowNodeTransformData[] = this.nodeTransforms(nodes);\n const nodeRects: Rectangle[] = nodeTransforms.map((transform) => transform.bounds);\n const viewRect: Rectangle = this.viewRect();\n const renderRect: Rectangle = this.renderRect(nodeRects).withPadding({\n top: this.style.canvasPadding,\n bottom: this.style.canvasPadding,\n left: this.style.canvasPadding,\n right: this.style.canvasPadding,\n });\n const canvasRect: Rectangle = Rectangle.enlarge([viewRect, renderRect]);\n\n const { scale, offset } = this.calculateScaleAndOffset({ canvasRect });\n\n return {\n canvas,\n context2D,\n nodeRects,\n canvasRect,\n viewRect,\n renderRect,\n scale,\n offset,\n };\n }\n\n private renderCanvas(renderContext: MinimapRenderContext) {\n const { canvas, context2D, nodeRects, viewRect, scale, offset } = renderContext;\n\n // 清空画布\n MinimapDraw.clear({ canvas, context: context2D });\n\n // 设置背景色\n MinimapDraw.backgroundColor({\n canvas,\n context: context2D,\n color: this.style.canvasBackground,\n });\n\n // 绘制视窗\n MinimapDraw.roundRectangle({\n context: context2D,\n rect: this.rectOnCanvas({ rect: viewRect, scale, offset }),\n color: this.style.viewportBackground,\n radius: this.style.viewportBorderRadius as number,\n });\n\n // 绘制节点\n nodeRects.forEach((nodeRect: Rectangle) => {\n MinimapDraw.roundRectangle({\n context: context2D,\n rect: this.rectOnCanvas({ rect: nodeRect, scale, offset }),\n color: this.style.nodeColor as string,\n radius: this.style.nodeBorderRadius as number,\n borderWidth: this.style.nodeBorderWidth as number,\n borderColor: this.style.nodeBorderColor as string,\n });\n });\n\n // 绘制视窗边框\n MinimapDraw.roundRectangle({\n context: context2D,\n rect: this.rectOnCanvas({ rect: viewRect, scale, offset }),\n color: 'rgba(255, 255, 255, 0)' as string,\n radius: this.style.viewportBorderRadius as number,\n borderColor: this.style.viewportBorderColor as string,\n borderWidth: this.style.viewportBorderWidth as number,\n borderDashLength: this.style.viewportBorderDashLength as number,\n });\n\n // 绘制视窗外的蒙层\n MinimapDraw.overlay({\n canvas,\n context: context2D,\n offset,\n scale,\n rect: viewRect,\n color: this.style.overlayColor as string,\n });\n }\n\n private calculateScaleAndOffset(params: { canvasRect: Rectangle }): {\n scale: number;\n offset: IPoint;\n } {\n const { canvasRect } = params;\n const { width: canvasWidth, height: canvasHeight } = this.canvas;\n\n // 计算缩放比例\n const scaleX = canvasWidth / canvasRect.width;\n const scaleY = canvasHeight / canvasRect.height;\n const scale = Math.min(scaleX, scaleY);\n\n // 计算缩放后的渲染区域尺寸\n const scaledWidth = canvasRect.width * scale;\n const scaledHeight = canvasRect.height * scale;\n\n // 计算居中偏移量\n const centerOffsetX = (canvasWidth - scaledWidth) / 2;\n const centerOffsetY = (canvasHeight - scaledHeight) / 2;\n\n // 计算最终偏移量\n const offset = {\n x: centerOffsetX / scale - canvasRect.x,\n y: centerOffsetY / scale - canvasRect.y,\n };\n\n return { scale, offset };\n }\n\n private get nodes(): FlowNodeEntity[] {\n return this.document.getAllNodes().filter((node) => {\n // 去除不可见节点\n if (node.hidden) return false;\n // 去除根节点\n if (node.flowNodeType === FlowNodeBaseType.ROOT) return;\n // 去除非一级节点\n if (\n !this.options.enableDisplayAllNodes &&\n node.parent &&\n node.parent.flowNodeType !== FlowNodeBaseType.ROOT\n )\n return;\n return true;\n });\n }\n\n private nodeTransforms(nodes: FlowNodeEntity[]): FlowNodeTransformData[] {\n return nodes.map((node) => node.getData(FlowNodeTransformData)).filter(Boolean);\n }\n\n private renderRect(rects: Rectangle[]): Rectangle {\n return Rectangle.enlarge(rects);\n }\n\n private viewRect(): Rectangle {\n const { width, height, scrollX, scrollY, zoom } = this.playgroundConfig.config;\n return new Rectangle(scrollX / zoom, scrollY / zoom, width / zoom, height / zoom);\n }\n\n private mountListener(): void {\n const entityManagerDisposer = this.entityManager.onEntityChange(() => this.render());\n this.toDispose.push(entityManagerDisposer);\n }\n\n /** 计算画布坐标系下的矩形 */\n private rectOnCanvas(params: { rect: Rectangle; scale: number; offset: IPoint }): Rectangle {\n const { rect, scale, offset } = params;\n return new Rectangle(\n (rect.x + offset.x) * scale,\n (rect.y + offset.y) * scale,\n rect.width * scale,\n rect.height * scale\n );\n }\n\n private isPointInRect(params: { point: IPoint; rect: Rectangle }): boolean {\n const { point, rect } = params;\n return (\n point.x >= rect.x &&\n point.x <= rect.x + rect.width &&\n point.y >= rect.y &&\n point.y <= rect.y + rect.height\n );\n }\n\n private addEventListeners(): void {\n this.canvas.addEventListener('wheel', this.handleWheel);\n this.canvas.addEventListener('mousedown', this.handleStartDrag);\n this.canvas.addEventListener('mousemove', this.handleCursor);\n }\n\n private removeEventListeners(): void {\n this.canvas.removeEventListener('wheel', this.handleWheel);\n this.canvas.removeEventListener('mousedown', this.handleStartDrag);\n this.canvas.removeEventListener('mousemove', this.handleCursor);\n }\n\n private handleWheel = (event: WheelEvent): void => {};\n\n private handleStartDrag = (event: MouseEvent): void => {\n event.preventDefault();\n event.stopPropagation();\n const renderContext = this.createRenderContext();\n const { viewRect, scale, offset } = renderContext;\n const canvasRect = this.canvas.getBoundingClientRect();\n const mousePoint: IPoint = {\n x: event.clientX - canvasRect.left,\n y: event.clientY - canvasRect.top,\n };\n\n const viewRectOnCanvas = this.rectOnCanvas({\n rect: viewRect,\n scale,\n offset,\n });\n if (!this.isPointInRect({ point: mousePoint, rect: viewRectOnCanvas })) {\n return;\n }\n this.isDragging = true;\n this.dragStart = mousePoint;\n document.addEventListener('mousemove', this.handleDragging);\n document.addEventListener('mouseup', this.handleEndDrag);\n };\n\n private handleDragging = (event: MouseEvent): void => {\n if (!this.isDragging || !this.dragStart) return;\n event.preventDefault();\n event.stopPropagation();\n\n const renderContext = this.createRenderContext();\n const { scale } = renderContext;\n const canvasRect = this.canvas.getBoundingClientRect();\n const mouseX = event.clientX - canvasRect.left;\n const mouseY = event.clientY - canvasRect.top;\n\n const deltaX = (mouseX - this.dragStart.x) / scale;\n const deltaY = (mouseY - this.dragStart.y) / scale;\n\n this.updateScrollPosition(deltaX, deltaY);\n\n this.dragStart = { x: mouseX, y: mouseY };\n this.render();\n };\n\n private handleEndDrag = (event: MouseEvent): void => {\n event.preventDefault();\n event.stopPropagation();\n document.removeEventListener('mousemove', this.handleDragging);\n document.removeEventListener('mouseup', this.handleEndDrag);\n this.isDragging = false;\n this.dragStart = undefined;\n this.setActivate(this.isMouseInCanvas(event));\n };\n\n private handleCursor = (event: MouseEvent): void => {\n if (!this.activated) return;\n\n const renderContext = this.createRenderContext();\n const { viewRect, scale, offset } = renderContext;\n const canvasRect = this.canvas.getBoundingClientRect();\n const mousePoint: IPoint = {\n x: event.clientX - canvasRect.left,\n y: event.clientY - canvasRect.top,\n };\n\n const viewRectOnCanvas = this.rectOnCanvas({\n rect: viewRect,\n scale,\n offset,\n });\n\n if (this.isPointInRect({ point: mousePoint, rect: viewRectOnCanvas })) {\n // 鼠标在视窗框内\n this.canvas.style.cursor = 'grab';\n } else {\n // 鼠标在视窗框外但在画布内\n this.canvas.style.cursor = 'default';\n }\n };\n\n private isMouseInCanvas(event: MouseEvent): boolean {\n const canvasRect = this.canvas.getBoundingClientRect();\n return (\n event.clientX >= canvasRect.left &&\n event.clientX <= canvasRect.right &&\n event.clientY >= canvasRect.top &&\n event.clientY <= canvasRect.bottom\n );\n }\n\n private updateScrollPosition(deltaX: number, deltaY: number): void {\n const { scrollX, scrollY, zoom } = this.playgroundConfig.config;\n this.playgroundConfig.updateConfig({\n scrollX: scrollX + deltaX * zoom,\n scrollY: scrollY + deltaY * zoom,\n });\n }\n}\n","import type { IPoint, Rectangle } from '@flowgram.ai/utils';\n\nexport namespace MinimapDraw {\n /** 清空画布 */\n export const clear = (params: {\n canvas: HTMLCanvasElement;\n context: CanvasRenderingContext2D;\n }) => {\n const { canvas, context } = params;\n context.clearRect(0, 0, canvas.width, canvas.height);\n };\n\n /** 设置背景色 */\n export const backgroundColor = (params: {\n canvas: HTMLCanvasElement;\n context: CanvasRenderingContext2D;\n color: string;\n }) => {\n const { canvas, context, color } = params;\n context.fillStyle = color;\n context.fillRect(0, 0, canvas.width, canvas.height);\n };\n\n /** 绘制矩形 */\n export const rectangle = (params: {\n context: CanvasRenderingContext2D;\n rect: Rectangle;\n color: string;\n }) => {\n const { context, rect, color } = params;\n context.fillStyle = color;\n context.fillRect(rect.x, rect.y, rect.width, rect.height);\n };\n\n /** 绘制圆角矩形 */\n export const roundRectangle = (params: {\n context: CanvasRenderingContext2D;\n rect: Rectangle;\n color: string;\n radius: number;\n borderColor?: string;\n borderWidth?: number;\n borderDashLength?: number;\n }): void => {\n const { context, rect, color, radius, borderColor, borderDashLength, borderWidth = 0 } = params;\n const { x, y, width, height } = rect;\n\n // 开始新路径\n context.beginPath();\n\n // 绘制圆角矩形路径\n const drawRoundedRectPath = (): void => {\n context.moveTo(x + radius, y);\n context.lineTo(x + width - radius, y);\n context.quadraticCurveTo(x + width, y, x + width, y + radius);\n context.lineTo(x + width, y + height - radius);\n context.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);\n context.lineTo(x + radius, y + height);\n context.quadraticCurveTo(x, y + height, x, y + height - radius);\n context.lineTo(x, y + radius);\n context.quadraticCurveTo(x, y, x + radius, y);\n context.closePath();\n };\n\n drawRoundedRectPath();\n\n // 填充矩形\n context.fillStyle = color;\n context.fill();\n\n // 如果设置了边框,绘制边框\n if (borderColor && borderWidth > 0) {\n context.strokeStyle = borderColor;\n context.lineWidth = borderWidth;\n\n // 设置虚线样式\n if (borderDashLength) {\n context.setLineDash([borderDashLength, borderDashLength]);\n } else {\n context.setLineDash([]);\n }\n\n context.stroke();\n\n // 重置虚线样式\n context.setLineDash([]);\n }\n };\n\n /** 绘制矩形外的蒙层 */\n export const overlay = (params: {\n canvas: HTMLCanvasElement;\n context: CanvasRenderingContext2D;\n offset: IPoint;\n scale: number;\n rect: Rectangle;\n color: string;\n }) => {\n const { canvas, context, offset, scale, rect, color } = params;\n\n context.fillStyle = color;\n\n // 上方蒙层\n context.fillRect(0, 0, canvas.width, (rect.y + offset.y) * scale);\n\n // 下方蒙层\n context.fillRect(\n 0,\n (rect.y + rect.height + offset.y) * scale,\n canvas.width,\n canvas.height - (rect.y + rect.height + offset.y) * scale,\n );\n\n // 左侧蒙层\n context.fillRect(\n 0,\n (rect.y + offset.y) * scale,\n (rect.x + offset.x) * scale,\n rect.height * scale,\n );\n\n // 右侧蒙层\n context.fillRect(\n (rect.x + rect.width + offset.x) * scale,\n (rect.y + offset.y) * scale,\n canvas.width - (rect.x + rect.width + offset.x) * scale,\n rect.height * scale,\n );\n };\n}\n","import React from 'react';\n\nimport { inject, injectable } from 'inversify';\nimport { Layer } from '@flowgram.ai/core';\nimport { domUtils } from '@flowgram.ai/utils';\n\nimport { MinimapLayerOptions } from './type';\nimport { FlowMinimapService } from './service';\nimport { MinimapRender } from './component';\n\n@injectable()\nexport class FlowMinimapLayer extends Layer<MinimapLayerOptions> {\n public static type = 'FlowMinimapLayer';\n\n @inject(FlowMinimapService) private readonly service: FlowMinimapService;\n\n public readonly node: HTMLElement;\n\n private readonly className = 'gedit-minimap-layer gedit-playground-layer';\n\n constructor() {\n super();\n this.node = domUtils.createDivWithClass(this.className);\n this.node.style.zIndex = '9999';\n }\n\n public render(): JSX.Element {\n if (this.options.disableLayer) {\n return <></>;\n }\n return (\n <MinimapRender\n service={this.service}\n panelStyles={this.options.panelStyles}\n containerStyles={this.options.containerStyles}\n inactiveStyle={this.options.inactiveStyle}\n />\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;AAAA,OAAO,SAA4B,WAAW,QAAQ,gBAAgB;;;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