@mindexec/cli 0.2.458 → 0.2.459
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/desktop-workspace-state.cjs +120 -0
- package/electron/main.cjs +17 -6
- package/electron/source-smoke.mjs +21 -0
- package/electron/windows-package-smoke.mjs +8 -2
- package/package.json +6 -5
- package/remote-fast/osx-arm64/mindexec-remote-fast.dll +0 -0
- package/remote-fast/osx-x64/mindexec-remote-fast.dll +0 -0
- package/remote-fast/win-x64/mindexec-remote-fast.dll +0 -0
- package/scripts/desktop-workspace-state-smoke.mjs +81 -0
- package/server.js +36 -16
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-animated-image-preview.js +270 -0
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-core.js +57 -53
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-interactions.js +30 -26
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-lod-renderer.js +94 -124
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-menu-manager.js +43 -21
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-nodes.js +45 -13
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-render-plan.js +117 -1
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-texture-factory.js +4 -1
- package/wwwroot/_framework/{MindExecution.Core.2ch68iyy8o.dll → MindExecution.Core.b973f5f64y.dll} +0 -0
- package/wwwroot/_framework/{MindExecution.Kernel.dh617xfv36.dll → MindExecution.Kernel.k4h9fvi9wb.dll} +0 -0
- package/wwwroot/_framework/{MindExecution.Plugins.Admin.0sm50hbae9.dll → MindExecution.Plugins.Admin.u2emae8cb5.dll} +0 -0
- package/wwwroot/_framework/{MindExecution.Plugins.Business.3wq01orrbu.dll → MindExecution.Plugins.Business.cysw4qtyke.dll} +0 -0
- package/wwwroot/_framework/{MindExecution.Plugins.Concept.z8yl28fa2a.dll → MindExecution.Plugins.Concept.8iehgvzjio.dll} +0 -0
- package/wwwroot/_framework/{MindExecution.Plugins.Directory.m7murp5oes.dll → MindExecution.Plugins.Directory.t621fsxq2i.dll} +0 -0
- package/wwwroot/_framework/{MindExecution.Plugins.PlanMaster.yuyrbpf0vh.dll → MindExecution.Plugins.PlanMaster.ft631uc7ki.dll} +0 -0
- package/wwwroot/_framework/{MindExecution.Plugins.YouTube.rwxvn00rm2.dll → MindExecution.Plugins.YouTube.arivgu92h1.dll} +0 -0
- package/wwwroot/_framework/{MindExecution.Shared.r9k48iyijb.dll → MindExecution.Shared.wm997st9eb.dll} +0 -0
- package/wwwroot/_framework/{MindExecution.Web.742aribkxm.dll → MindExecution.Web.osdbdrue4h.dll} +0 -0
- package/wwwroot/_framework/blazor.boot.json +21 -21
- package/wwwroot/app-icon-1024.png +0 -0
- package/wwwroot/apple-touch-icon.png +0 -0
- package/wwwroot/appsettings.json +81 -81
- package/wwwroot/favicon-32x32.png +0 -0
- package/wwwroot/favicon.ico +0 -0
- package/wwwroot/icon-192.png +0 -0
- package/wwwroot/icon-512.png +0 -0
- package/wwwroot/index.html +70 -46
- package/wwwroot/manifest.webmanifest +4 -4
- package/wwwroot/mindexec-favicon-v3.png +0 -0
- package/wwwroot/service-worker-assets.js +888 -880
- package/wwwroot/service-worker.js +1 -1
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
// Bounded resident previews for animation-capable image formats.
|
|
2
|
+
(function () {
|
|
3
|
+
'use strict';
|
|
4
|
+
|
|
5
|
+
function normalizeAssetUrl(url) {
|
|
6
|
+
if (typeof url !== 'string') return '';
|
|
7
|
+
return url.trim()
|
|
8
|
+
.replace(/^http:\/\/localhost(?=:\d+\/assets\/)/i, 'http://127.0.0.1')
|
|
9
|
+
.replace(/^http:\/\/\[::1\](?=:\d+\/assets\/)/i, 'http://127.0.0.1');
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function getContentType(model) {
|
|
13
|
+
return String(model?.contentType || model?.ContentType || '').trim().toLowerCase();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function getMetadata(model) {
|
|
17
|
+
return model?.metadata || model?.Metadata || {};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function getMetadataValue(metadata, ...keys) {
|
|
21
|
+
for (const key of keys) {
|
|
22
|
+
const direct = metadata?.[key];
|
|
23
|
+
if (direct !== undefined && direct !== null && String(direct).trim()) {
|
|
24
|
+
return String(direct).trim();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const wanted = new Set(keys.map(key => String(key).toLowerCase()));
|
|
29
|
+
for (const [key, value] of Object.entries(metadata || {})) {
|
|
30
|
+
if (wanted.has(String(key).toLowerCase()) && value !== undefined && value !== null && String(value).trim()) {
|
|
31
|
+
return String(value).trim();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return '';
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function hasExtension(url, extension) {
|
|
39
|
+
const pathname = normalizeAssetUrl(url).split(/[?#]/)[0].toLowerCase();
|
|
40
|
+
return !!pathname && pathname.endsWith(extension);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function getImageReferenceCandidates(model) {
|
|
44
|
+
const metadata = getMetadata(model);
|
|
45
|
+
return [
|
|
46
|
+
model?.response,
|
|
47
|
+
model?.Response,
|
|
48
|
+
metadata?.OriginalPath,
|
|
49
|
+
metadata?.OriginalUrl,
|
|
50
|
+
metadata?.originalUrl,
|
|
51
|
+
metadata?.ImageUrl,
|
|
52
|
+
metadata?.imageUrl
|
|
53
|
+
];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function isAnimatedGifImageModel(model) {
|
|
57
|
+
if (!model || getContentType(model) !== 'image') return false;
|
|
58
|
+
const metadata = getMetadata(model);
|
|
59
|
+
const mimeType = getMetadataValue(metadata, 'fileMime', 'FileMime', 'mimeType', 'MimeType').toLowerCase();
|
|
60
|
+
return mimeType === 'image/gif' || getImageReferenceCandidates(model).some(url => hasExtension(url, '.gif'));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function isWebpImageModel(model) {
|
|
64
|
+
if (!model || getContentType(model) !== 'image') return false;
|
|
65
|
+
const metadata = getMetadata(model);
|
|
66
|
+
const mimeType = getMetadataValue(metadata, 'fileMime', 'FileMime', 'mimeType', 'MimeType').toLowerCase();
|
|
67
|
+
return mimeType === 'image/webp' || getImageReferenceCandidates(model).some(url => hasExtension(url, '.webp'));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function isSafeResidentStaticPreviewUrl(url) {
|
|
71
|
+
const normalized = normalizeAssetUrl(url).toLowerCase();
|
|
72
|
+
return normalized.includes('/assets/thumbs/') &&
|
|
73
|
+
!hasExtension(normalized, '.gif') &&
|
|
74
|
+
!hasExtension(normalized, '.webp');
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function getCanonicalAssetKey(url) {
|
|
78
|
+
const normalized = normalizeAssetUrl(url);
|
|
79
|
+
if (!normalized) return '';
|
|
80
|
+
const withoutQuery = normalized.split(/[?#]/)[0];
|
|
81
|
+
const lower = withoutQuery.toLowerCase();
|
|
82
|
+
for (const marker of ['/assets/thumbs/', '/assets/']) {
|
|
83
|
+
if (!lower.includes(marker)) continue;
|
|
84
|
+
const assetName = withoutQuery.slice(lower.lastIndexOf(marker) + marker.length).split('/').pop() || '';
|
|
85
|
+
const dotIndex = assetName.lastIndexOf('.');
|
|
86
|
+
return (dotIndex > 0 ? assetName.slice(0, dotIndex) : assetName).toLowerCase();
|
|
87
|
+
}
|
|
88
|
+
return withoutQuery.toLowerCase();
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function areAssetUrlsEquivalent(leftUrl, rightUrl) {
|
|
92
|
+
const leftKey = getCanonicalAssetKey(leftUrl);
|
|
93
|
+
const rightKey = getCanonicalAssetKey(rightUrl);
|
|
94
|
+
return leftKey && rightKey
|
|
95
|
+
? leftKey === rightKey
|
|
96
|
+
: normalizeAssetUrl(leftUrl) === normalizeAssetUrl(rightUrl);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function getLocalWebpAssetFilename(...urls) {
|
|
100
|
+
for (const candidate of urls) {
|
|
101
|
+
const normalized = normalizeAssetUrl(candidate);
|
|
102
|
+
if (!normalized || !hasExtension(normalized, '.webp')) continue;
|
|
103
|
+
|
|
104
|
+
let pathname = normalized.split(/[?#]/)[0];
|
|
105
|
+
try {
|
|
106
|
+
pathname = new URL(normalized, window.location?.origin || 'http://127.0.0.1').pathname;
|
|
107
|
+
} catch { }
|
|
108
|
+
|
|
109
|
+
const normalizedPath = pathname.replace(/\\/g, '/');
|
|
110
|
+
if (!/(^|\/)assets\//i.test(normalizedPath)) continue;
|
|
111
|
+
|
|
112
|
+
const rawFilename = normalizedPath.split('/').pop() || '';
|
|
113
|
+
let filename = rawFilename;
|
|
114
|
+
try { filename = decodeURIComponent(rawFilename); } catch { }
|
|
115
|
+
if (/^[^/\\]+\.webp$/i.test(filename)) return filename;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return '';
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function getBridgeOrigin() {
|
|
122
|
+
const configuredOrigin = String(window.MindExecLocalBridge?.activeBridgeUrl || '').trim();
|
|
123
|
+
return (configuredOrigin || window.location?.origin || 'http://127.0.0.1:5147').replace(/\/$/, '');
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
async function getBridgeAuthHeaders(bridgeOrigin) {
|
|
127
|
+
if (window.__mindExecutionBridgeAuthPromise) {
|
|
128
|
+
try { return await window.__mindExecutionBridgeAuthPromise; } catch { }
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const authPromise = (async () => {
|
|
132
|
+
const nonce = `${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
133
|
+
const response = await fetch(`${bridgeOrigin}/api/status?cb=${encodeURIComponent(nonce)}`, {
|
|
134
|
+
cache: 'no-store',
|
|
135
|
+
targetAddressSpace: 'loopback'
|
|
136
|
+
});
|
|
137
|
+
if (!response.ok) return {};
|
|
138
|
+
const status = await response.json();
|
|
139
|
+
const token = String(status?.bridgeToken || '').trim();
|
|
140
|
+
const header = String(status?.bridgeTokenHeader || 'X-Bridge-Token').trim();
|
|
141
|
+
return token && header ? { [header]: token } : {};
|
|
142
|
+
})();
|
|
143
|
+
window.__mindExecutionBridgeAuthPromise = authPromise;
|
|
144
|
+
|
|
145
|
+
try {
|
|
146
|
+
return await authPromise;
|
|
147
|
+
} catch {
|
|
148
|
+
if (window.__mindExecutionBridgeAuthPromise === authPromise) {
|
|
149
|
+
window.__mindExecutionBridgeAuthPromise = null;
|
|
150
|
+
}
|
|
151
|
+
return {};
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
async function resolveLocalWebpResidentPreview(item, assetUrls) {
|
|
156
|
+
const sourceUrl = normalizeAssetUrl(
|
|
157
|
+
item?.originalUrl ||
|
|
158
|
+
assetUrls?.fullResUrl ||
|
|
159
|
+
assetUrls?.originalUrl ||
|
|
160
|
+
assetUrls?.originalPath ||
|
|
161
|
+
item?.previewUrl || ''
|
|
162
|
+
);
|
|
163
|
+
const filename = getLocalWebpAssetFilename(
|
|
164
|
+
sourceUrl,
|
|
165
|
+
assetUrls?.originalPath,
|
|
166
|
+
assetUrls?.originalUrl,
|
|
167
|
+
item?.previewUrl
|
|
168
|
+
);
|
|
169
|
+
if (!filename || typeof fetch !== 'function') {
|
|
170
|
+
return { sourceUrl, previewUrl: '' };
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const bridgeOrigin = getBridgeOrigin();
|
|
174
|
+
const headers = await getBridgeAuthHeaders(bridgeOrigin);
|
|
175
|
+
const endpoint = `${bridgeOrigin}/api/assets/generate-thumbnail/${encodeURIComponent(filename)}`;
|
|
176
|
+
const response = await fetch(endpoint, {
|
|
177
|
+
method: 'POST',
|
|
178
|
+
headers,
|
|
179
|
+
cache: 'no-store',
|
|
180
|
+
targetAddressSpace: 'loopback'
|
|
181
|
+
});
|
|
182
|
+
if (!response.ok) {
|
|
183
|
+
throw new Error(`resident-static-preview-http-${response.status}`);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const payload = await response.json();
|
|
187
|
+
const previewUrl = normalizeAssetUrl(payload?.thumbnailUrl || '');
|
|
188
|
+
if (!isSafeResidentStaticPreviewUrl(previewUrl)) {
|
|
189
|
+
throw new Error('resident-static-preview-invalid-url');
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
return { sourceUrl, previewUrl };
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
function getResidentStaticPreviewUrl(renderer, nodeId, model, assetUrls) {
|
|
196
|
+
const normalizedNodeId = String(nodeId || '').trim();
|
|
197
|
+
const previewUrl = normalizeAssetUrl(assetUrls?.previewUrl || '');
|
|
198
|
+
if (!isWebpImageModel(model)) return previewUrl;
|
|
199
|
+
|
|
200
|
+
const sourceUrl = normalizeAssetUrl(
|
|
201
|
+
assetUrls?.fullResUrl || assetUrls?.originalUrl || assetUrls?.originalPath || previewUrl
|
|
202
|
+
);
|
|
203
|
+
const record = normalizedNodeId ? renderer?._residentStaticPreviewUrls?.get(normalizedNodeId) : null;
|
|
204
|
+
if (record?.sourceUrl === sourceUrl && isSafeResidentStaticPreviewUrl(record.previewUrl)) {
|
|
205
|
+
return normalizeAssetUrl(record.previewUrl);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
if (normalizedNodeId && record) renderer._residentStaticPreviewUrls.delete(normalizedNodeId);
|
|
209
|
+
const existingThumbnailUrl = normalizeAssetUrl(assetUrls?.thumbnailUrl || '');
|
|
210
|
+
if (normalizedNodeId && sourceUrl && isSafeResidentStaticPreviewUrl(existingThumbnailUrl)) {
|
|
211
|
+
renderer._residentStaticPreviewUrls.set(normalizedNodeId, {
|
|
212
|
+
sourceUrl,
|
|
213
|
+
previewUrl: existingThumbnailUrl
|
|
214
|
+
});
|
|
215
|
+
return existingThumbnailUrl;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
return '';
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
async function resolveSafeResidentPreviewUrl(renderer, item, assetUrls, getCurrentAssetUrls, onReady) {
|
|
222
|
+
if (!isWebpImageModel(item?.model)) {
|
|
223
|
+
return normalizeAssetUrl(item?.previewUrl || assetUrls?.previewUrl || '');
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const nodeId = String(item?.nodeId || '').trim();
|
|
227
|
+
const existingPreviewUrl = getResidentStaticPreviewUrl(renderer, nodeId, item.model, {
|
|
228
|
+
...assetUrls,
|
|
229
|
+
thumbnailUrl: item?.thumbnailUrl || assetUrls?.thumbnailUrl || ''
|
|
230
|
+
});
|
|
231
|
+
if (existingPreviewUrl) return existingPreviewUrl;
|
|
232
|
+
|
|
233
|
+
const resolved = await resolveLocalWebpResidentPreview(item, assetUrls);
|
|
234
|
+
const sourceUrl = normalizeAssetUrl(resolved?.sourceUrl || '');
|
|
235
|
+
const previewUrl = normalizeAssetUrl(resolved?.previewUrl || '');
|
|
236
|
+
if (!isSafeResidentStaticPreviewUrl(previewUrl)) return '';
|
|
237
|
+
|
|
238
|
+
if (
|
|
239
|
+
renderer?._disposed === true ||
|
|
240
|
+
item?.previewEpoch !== renderer?._residentStaticPreviewEpoch ||
|
|
241
|
+
renderer?.isInLODMode !== true
|
|
242
|
+
) {
|
|
243
|
+
return '';
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
const currentEntry = renderer?._module?.nodeObjectsById?.get?.(nodeId) || null;
|
|
247
|
+
const currentAssetUrls = getCurrentAssetUrls?.(currentEntry?.model) || {};
|
|
248
|
+
const currentSourceUrl = normalizeAssetUrl(
|
|
249
|
+
currentAssetUrls?.fullResUrl ||
|
|
250
|
+
currentAssetUrls?.originalUrl ||
|
|
251
|
+
currentAssetUrls?.originalPath ||
|
|
252
|
+
currentAssetUrls?.previewUrl || ''
|
|
253
|
+
);
|
|
254
|
+
if (!currentEntry?.model || currentSourceUrl !== sourceUrl) return '';
|
|
255
|
+
|
|
256
|
+
renderer._residentStaticPreviewUrls.set(nodeId, { sourceUrl, previewUrl });
|
|
257
|
+
onReady?.({ nodeId, sourceKind: 'webp', previewUrl });
|
|
258
|
+
return previewUrl;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
window.MindMapAnimatedImagePreview = Object.freeze({
|
|
262
|
+
normalizeAssetUrl,
|
|
263
|
+
isAnimatedGifImageModel,
|
|
264
|
+
isWebpImageModel,
|
|
265
|
+
isSafeResidentStaticPreviewUrl,
|
|
266
|
+
areAssetUrlsEquivalent,
|
|
267
|
+
getResidentStaticPreviewUrl,
|
|
268
|
+
resolveSafeResidentPreviewUrl
|
|
269
|
+
});
|
|
270
|
+
})();
|
|
@@ -85,6 +85,8 @@
|
|
|
85
85
|
const PASSIVE_OVERLAY_IDLE_DELAY_MS = 500;
|
|
86
86
|
const PASSIVE_OVERLAY_PAN_IDLE_DELAY_MS = 500;
|
|
87
87
|
const CURSOR_DOM_BLINK_DURATION_MS = 1000;
|
|
88
|
+
const CURSOR_WORLD_SIZE = 20;
|
|
89
|
+
const CURSOR_WORLD_THICKNESS = 4;
|
|
88
90
|
const RENDER_DEBUG_METRICS_CACHE_MS = 250;
|
|
89
91
|
const ANIMATION_IDLE_LOW_FPS_DELAY_MS = 500;
|
|
90
92
|
const WHEEL_ZOOM_BURST_QUIET_FRAME_LIMIT = 12;
|
|
@@ -108,13 +110,13 @@
|
|
|
108
110
|
const LOCAL_SNAP_GRID_DIAMETER_PX = LOCAL_SNAP_GRID_RADIUS_PX * 2;
|
|
109
111
|
const LOCAL_SNAP_GRID_FADE_PX = 100;
|
|
110
112
|
const LOCAL_SNAP_GRID_SOLID_RADIUS_PX = LOCAL_SNAP_GRID_RADIUS_PX - LOCAL_SNAP_GRID_FADE_PX;
|
|
111
|
-
const
|
|
112
|
-
const
|
|
113
|
+
const LOCAL_SNAP_GRID_RASTER_MIN_STEP_PX = 0.5;
|
|
114
|
+
const LOCAL_SNAP_GRID_RASTER_MAX_PERIOD_PX = 2048;
|
|
113
115
|
const LOCAL_SNAP_GRID_OPACITY_BUCKET = 0.04;
|
|
114
|
-
const LOCAL_SNAP_GRID_DEFAULT_STEP_PX =
|
|
115
|
-
const LOCAL_SNAP_GRID_DEFAULT_MAJOR_STEP_PX =
|
|
116
|
-
const LOCAL_SNAP_GRID_DEFAULT_OPACITY = 0.
|
|
117
|
-
const LOCAL_SNAP_GRID_TILE_OVERSCAN_PX =
|
|
116
|
+
const LOCAL_SNAP_GRID_DEFAULT_STEP_PX = 10;
|
|
117
|
+
const LOCAL_SNAP_GRID_DEFAULT_MAJOR_STEP_PX = 100;
|
|
118
|
+
const LOCAL_SNAP_GRID_DEFAULT_OPACITY = 0.58;
|
|
119
|
+
const LOCAL_SNAP_GRID_TILE_OVERSCAN_PX = 560;
|
|
118
120
|
const LOCAL_SNAP_GRID_COMPOSITOR_SCALE_MIN = 0.8;
|
|
119
121
|
const LOCAL_SNAP_GRID_COMPOSITOR_SCALE_MAX = 1.5;
|
|
120
122
|
const CAMERA_STATIONARY_INTERACTION_FRAME_DELAY_MS = 48;
|
|
@@ -289,11 +291,11 @@
|
|
|
289
291
|
position: absolute;
|
|
290
292
|
left: 0;
|
|
291
293
|
top: 0;
|
|
292
|
-
width:
|
|
293
|
-
height:
|
|
294
|
+
width: ${CURSOR_WORLD_SIZE}px;
|
|
295
|
+
height: ${CURSOR_WORLD_SIZE}px;
|
|
294
296
|
box-sizing: border-box;
|
|
295
|
-
border-top:
|
|
296
|
-
border-left:
|
|
297
|
+
border-top: ${CURSOR_WORLD_THICKNESS}px solid #000;
|
|
298
|
+
border-left: ${CURSOR_WORLD_THICKNESS}px solid #000;
|
|
297
299
|
pointer-events: none;
|
|
298
300
|
z-index: 2147483000;
|
|
299
301
|
animation: mindMapCursorDomBlink ${CURSOR_DOM_BLINK_DURATION_MS}ms steps(1, end) infinite;
|
|
@@ -347,8 +349,11 @@
|
|
|
347
349
|
const ndcY = ((cursor.y - camera.position.y) * 2) / viewHeight;
|
|
348
350
|
const x = ((ndcX + 1) / 2) * width;
|
|
349
351
|
const y = ((1 - ndcY) / 2) * height;
|
|
352
|
+
const pxPerWorld = height / Math.max(1, viewHeight);
|
|
353
|
+
const cursorSizePx = Math.max(0.5, CURSOR_WORLD_SIZE * pxPerWorld);
|
|
354
|
+
const cursorThicknessPx = Math.max(0.5, CURSOR_WORLD_THICKNESS * pxPerWorld);
|
|
350
355
|
const visible = ndcX >= -1.1 && ndcX <= 1.1 && ndcY >= -1.1 && ndcY <= 1.1;
|
|
351
|
-
const positionKey = `${visible ? 1 : 0}|${Math.round(x)}|${Math.round(y)}|${width}|${height}`;
|
|
356
|
+
const positionKey = `${visible ? 1 : 0}|${Math.round(x)}|${Math.round(y)}|${cursorSizePx.toFixed(2)}|${cursorThicknessPx.toFixed(2)}|${width}|${height}`;
|
|
352
357
|
|
|
353
358
|
if (positionKey === module._lastCursorDomPositionKey) {
|
|
354
359
|
return false;
|
|
@@ -360,6 +365,10 @@
|
|
|
360
365
|
element.style.display = visible ? 'block' : 'none';
|
|
361
366
|
}
|
|
362
367
|
if (visible) {
|
|
368
|
+
element.style.width = `${cursorSizePx.toFixed(2)}px`;
|
|
369
|
+
element.style.height = `${cursorSizePx.toFixed(2)}px`;
|
|
370
|
+
element.style.borderTopWidth = `${cursorThicknessPx.toFixed(2)}px`;
|
|
371
|
+
element.style.borderLeftWidth = `${cursorThicknessPx.toFixed(2)}px`;
|
|
363
372
|
element.style.transform = `translate3d(${x.toFixed(2)}px, ${y.toFixed(2)}px, 0)`;
|
|
364
373
|
}
|
|
365
374
|
return true;
|
|
@@ -3669,23 +3678,8 @@ ${summaryLines.map(line => `<div>${escapeNodeFrameDebugHtml(line)}</div>`).join(
|
|
|
3669
3678
|
_resolveLocalSnapGridWorldStep(pxPerWorld) {
|
|
3670
3679
|
const safePxPerWorld = Math.max(Number.EPSILON, Number(pxPerWorld) || Number.EPSILON);
|
|
3671
3680
|
const baseWorldStep = Math.max(Number.EPSILON, Number(this.GRID_SIZE || 10));
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
Number(this._lastLocalSnapGridWorldStep || baseWorldStep)
|
|
3675
|
-
);
|
|
3676
|
-
let smallStepPx = worldStep * safePxPerWorld;
|
|
3677
|
-
let guard = 0;
|
|
3678
|
-
|
|
3679
|
-
while (smallStepPx < LOCAL_SNAP_GRID_MIN_STEP_PX && guard < 24) {
|
|
3680
|
-
worldStep *= 2;
|
|
3681
|
-
smallStepPx *= 2;
|
|
3682
|
-
guard += 1;
|
|
3683
|
-
}
|
|
3684
|
-
while (smallStepPx > LOCAL_SNAP_GRID_MAX_STEP_PX && guard < 48) {
|
|
3685
|
-
worldStep /= 2;
|
|
3686
|
-
smallStepPx /= 2;
|
|
3687
|
-
guard += 1;
|
|
3688
|
-
}
|
|
3681
|
+
const worldStep = baseWorldStep;
|
|
3682
|
+
const smallStepPx = worldStep * safePxPerWorld;
|
|
3689
3683
|
|
|
3690
3684
|
return {
|
|
3691
3685
|
worldStep,
|
|
@@ -3709,37 +3703,43 @@ ${summaryLines.map(line => `<div>${escapeNodeFrameDebugHtml(line)}</div>`).join(
|
|
|
3709
3703
|
return false;
|
|
3710
3704
|
}
|
|
3711
3705
|
|
|
3712
|
-
const smallStep = Math.max(
|
|
3706
|
+
const smallStep = Math.max(LOCAL_SNAP_GRID_RASTER_MIN_STEP_PX, Number(smallStepPx) || LOCAL_SNAP_GRID_DEFAULT_STEP_PX);
|
|
3713
3707
|
const majorStep = Math.max(
|
|
3714
3708
|
smallStep,
|
|
3715
3709
|
Math.min(
|
|
3716
|
-
|
|
3710
|
+
LOCAL_SNAP_GRID_RASTER_MAX_PERIOD_PX,
|
|
3717
3711
|
Number(majorStepPx) || LOCAL_SNAP_GRID_DEFAULT_MAJOR_STEP_PX
|
|
3718
3712
|
)
|
|
3719
3713
|
);
|
|
3720
|
-
const tileSize = Math.max(1,
|
|
3721
|
-
|
|
3722
|
-
|
|
3714
|
+
const tileSize = Math.max(1, majorStep);
|
|
3715
|
+
const viewportDpr = Math.max(1, Math.min(3, Number(this._lastViewportDpr || window.devicePixelRatio || 1)));
|
|
3716
|
+
const bitmapSize = Math.max(1, Math.ceil(tileSize * viewportDpr));
|
|
3717
|
+
if (canvas.width !== bitmapSize) {
|
|
3718
|
+
canvas.width = bitmapSize;
|
|
3723
3719
|
}
|
|
3724
|
-
if (canvas.height !==
|
|
3725
|
-
canvas.height =
|
|
3720
|
+
if (canvas.height !== bitmapSize) {
|
|
3721
|
+
canvas.height = bitmapSize;
|
|
3726
3722
|
}
|
|
3723
|
+
const rasterScale = bitmapSize / tileSize;
|
|
3724
|
+
ctx.setTransform(rasterScale, 0, 0, rasterScale, 0, 0);
|
|
3727
3725
|
ctx.clearRect(0, 0, tileSize, tileSize);
|
|
3728
3726
|
|
|
3729
3727
|
if (styleKind === 'dot') {
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
for (let
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3728
|
+
if (smallStep >= 2.25) {
|
|
3729
|
+
ctx.fillStyle = 'rgba(58, 69, 88, 0.68)';
|
|
3730
|
+
const dotRadius = 1.2;
|
|
3731
|
+
for (let y = 0; y < tileSize; y += smallStep) {
|
|
3732
|
+
for (let x = 0; x < tileSize; x += smallStep) {
|
|
3733
|
+
ctx.beginPath();
|
|
3734
|
+
ctx.arc(x, y, dotRadius, 0, Math.PI * 2);
|
|
3735
|
+
ctx.fill();
|
|
3736
|
+
}
|
|
3737
3737
|
}
|
|
3738
3738
|
}
|
|
3739
3739
|
|
|
3740
|
-
ctx.fillStyle = 'rgba(15, 23, 42, 0.
|
|
3740
|
+
ctx.fillStyle = 'rgba(15, 23, 42, 0.82)';
|
|
3741
3741
|
ctx.beginPath();
|
|
3742
|
-
ctx.arc(0, 0, 1.
|
|
3742
|
+
ctx.arc(0, 0, 1.9, 0, Math.PI * 2);
|
|
3743
3743
|
ctx.fill();
|
|
3744
3744
|
} else {
|
|
3745
3745
|
const drawLines = (step, color, width) => {
|
|
@@ -3779,17 +3779,17 @@ ${summaryLines.map(line => `<div>${escapeNodeFrameDebugHtml(line)}</div>`).join(
|
|
|
3779
3779
|
|
|
3780
3780
|
const safeStyleKind = styleKind === 'dot' ? 'dot' : 'line';
|
|
3781
3781
|
const safeSmallStep = Math.max(
|
|
3782
|
-
|
|
3783
|
-
|
|
3782
|
+
LOCAL_SNAP_GRID_RASTER_MIN_STEP_PX,
|
|
3783
|
+
Number(smallStepPx) || LOCAL_SNAP_GRID_DEFAULT_STEP_PX
|
|
3784
3784
|
);
|
|
3785
3785
|
const safeMajorStep = Math.max(
|
|
3786
3786
|
safeSmallStep,
|
|
3787
3787
|
Math.min(
|
|
3788
|
-
|
|
3788
|
+
LOCAL_SNAP_GRID_RASTER_MAX_PERIOD_PX,
|
|
3789
3789
|
Number(majorStepPx) || LOCAL_SNAP_GRID_DEFAULT_MAJOR_STEP_PX
|
|
3790
3790
|
)
|
|
3791
3791
|
);
|
|
3792
|
-
const safeOpacity = Math.max(0.
|
|
3792
|
+
const safeOpacity = Math.max(0.28, Math.min(0.68, Number(opacity) || LOCAL_SNAP_GRID_DEFAULT_OPACITY));
|
|
3793
3793
|
const localGridKey = [
|
|
3794
3794
|
keyPrefix,
|
|
3795
3795
|
safeStyleKind,
|
|
@@ -3955,10 +3955,10 @@ ${summaryLines.map(line => `<div>${escapeNodeFrameDebugHtml(line)}</div>`).join(
|
|
|
3955
3955
|
this._lastLocalSnapGridWorldStep = gridProjection.worldStep;
|
|
3956
3956
|
this._lastLocalSnapGridWorldPeriod = gridProjection.worldStep * 10;
|
|
3957
3957
|
const styleKind = this._getLocalSnapGridStyleKind();
|
|
3958
|
-
const rawOpacity = Math.max(0.
|
|
3958
|
+
const rawOpacity = Math.max(0.38, Math.min(0.64, cameraZ <= 1800 ? 0.60 : 0.60 - ((cameraZ - 1800) / 36000)));
|
|
3959
3959
|
const opacity = Math.max(
|
|
3960
|
-
0.
|
|
3961
|
-
Math.min(0.
|
|
3960
|
+
0.38,
|
|
3961
|
+
Math.min(0.64, Math.round(rawOpacity / LOCAL_SNAP_GRID_OPACITY_BUCKET) * LOCAL_SNAP_GRID_OPACITY_BUCKET)
|
|
3962
3962
|
);
|
|
3963
3963
|
const shouldDeferLocalGridStyleForZoom =
|
|
3964
3964
|
this.isZooming === true &&
|
|
@@ -7332,8 +7332,12 @@ ${summaryLines.map(line => `<div>${escapeNodeFrameDebugHtml(line)}</div>`).join(
|
|
|
7332
7332
|
!hasNonCameraNavigationForcedUpdate &&
|
|
7333
7333
|
!hasMotionBlockingOverlayFocus &&
|
|
7334
7334
|
!this.isWindowResizing;
|
|
7335
|
-
if (isMenuOverlayUiEnabled && window.MindMapMenuManager
|
|
7336
|
-
|
|
7335
|
+
if (isMenuOverlayUiEnabled && window.MindMapMenuManager) {
|
|
7336
|
+
if (shouldDeferFloatingUiDuringMotion === true) {
|
|
7337
|
+
window.MindMapMenuManager.updateForCameraMotion?.();
|
|
7338
|
+
} else {
|
|
7339
|
+
window.MindMapMenuManager.update();
|
|
7340
|
+
}
|
|
7337
7341
|
} else if (!isMenuOverlayUiEnabled && window.MindMapMenuManager?.hideMenu) {
|
|
7338
7342
|
window.MindMapMenuManager.hideMenu();
|
|
7339
7343
|
}
|
|
@@ -682,13 +682,32 @@ window.MindMapInteractions = (function () {
|
|
|
682
682
|
module._lastNativePasteEventAt = performance.now();
|
|
683
683
|
module._pendingClipboardPasteFallbackToken = null;
|
|
684
684
|
console.log('[MindMap] Ctrl+V fallback read clipboard text. Creating node through PasteTextFromClipboard.');
|
|
685
|
-
await module.dotNetHelper.invokeMethodAsync('PasteTextFromClipboard', text, cursorX, cursorY);
|
|
685
|
+
const createdNode = await module.dotNetHelper.invokeMethodAsync('PasteTextFromClipboard', text, cursorX, cursorY);
|
|
686
|
+
completePastedTextNode(module, createdNode);
|
|
686
687
|
} catch (error) {
|
|
687
688
|
console.warn('[MindMap] Ctrl+V fallback clipboard read failed:', error);
|
|
688
689
|
}
|
|
689
690
|
}, 120);
|
|
690
691
|
}
|
|
691
692
|
|
|
693
|
+
function completePastedTextNode(module, createdNode) {
|
|
694
|
+
const nodeId = String(createdNode?.nodeId ?? createdNode?.NodeId ?? '').trim();
|
|
695
|
+
const nodeEntry = nodeId ? module?.nodeObjectsById?.get?.(nodeId) : null;
|
|
696
|
+
if (!nodeEntry) return false;
|
|
697
|
+
|
|
698
|
+
finalizeSingleSelection(module, nodeId, { notifyBlazor: true, bringToFront: true, showMenu: true });
|
|
699
|
+
module.pendingSelectedActivationNodeIds?.clear?.();
|
|
700
|
+
module.pendingSelectedActivationNodeIds?.add?.(nodeId);
|
|
701
|
+
MindMapNodes.moveCursorAfterNodePlacement?.(
|
|
702
|
+
module,
|
|
703
|
+
nodeEntry.model,
|
|
704
|
+
nodeEntry.model?.width,
|
|
705
|
+
nodeEntry.model?.height,
|
|
706
|
+
{ moveCamera: false }
|
|
707
|
+
);
|
|
708
|
+
return true;
|
|
709
|
+
}
|
|
710
|
+
|
|
692
711
|
function copyTextMetricsFromElement(target, source) {
|
|
693
712
|
if (!target || !source || typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') {
|
|
694
713
|
return;
|
|
@@ -2791,30 +2810,14 @@ window.MindMapInteractions = (function () {
|
|
|
2791
2810
|
if (newNodeIds.length === 1) {
|
|
2792
2811
|
module.selectedNodeIdJs = newNodeIds[0];
|
|
2793
2812
|
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
let nextCursorX, nextCursorY;
|
|
2804
|
-
if (direction === 'vertical') {
|
|
2805
|
-
// Move down (node height + padding)
|
|
2806
|
-
nextCursorX = nodeX;
|
|
2807
|
-
nextCursorY = nodeY - height - PADDING;
|
|
2808
|
-
} else {
|
|
2809
|
-
// Move right (node width + padding)
|
|
2810
|
-
nextCursorX = nodeX + width + PADDING;
|
|
2811
|
-
nextCursorY = nodeY;
|
|
2812
|
-
}
|
|
2813
|
-
|
|
2814
|
-
if (typeof module.updateCursorPosition === 'function') {
|
|
2815
|
-
module.updateCursorPosition(nextCursorX, nextCursorY, false);
|
|
2816
|
-
console.log(`[MindMap] 📍 Cursor moved to (${nextCursorX.toFixed(0)}, ${nextCursorY.toFixed(0)}) after paste`);
|
|
2817
|
-
}
|
|
2813
|
+
const pastedEntry = module.nodeObjectsById?.get?.(newNodeIds[0]);
|
|
2814
|
+
MindMapNodes.moveCursorAfterNodePlacement?.(
|
|
2815
|
+
module,
|
|
2816
|
+
pastedEntry?.model || nodesToPaste[0],
|
|
2817
|
+
pastedEntry?.model?.width || nodesToPaste[0].Width,
|
|
2818
|
+
pastedEntry?.model?.height || nodesToPaste[0].Height,
|
|
2819
|
+
{ moveCamera: false }
|
|
2820
|
+
);
|
|
2818
2821
|
}
|
|
2819
2822
|
if (module.pendingSelectedActivationNodeIds instanceof Set) {
|
|
2820
2823
|
module.pendingSelectedActivationNodeIds.clear();
|
|
@@ -2857,7 +2860,8 @@ window.MindMapInteractions = (function () {
|
|
|
2857
2860
|
if (module.dotNetHelper) {
|
|
2858
2861
|
const cursorX = module.cursorPosition?.x ?? 0;
|
|
2859
2862
|
const cursorY = module.cursorPosition?.y ?? 0;
|
|
2860
|
-
module.dotNetHelper.invokeMethodAsync('PasteTextFromClipboard', finalText, cursorX, cursorY);
|
|
2863
|
+
const createdNode = await module.dotNetHelper.invokeMethodAsync('PasteTextFromClipboard', finalText, cursorX, cursorY);
|
|
2864
|
+
completePastedTextNode(module, createdNode);
|
|
2861
2865
|
}
|
|
2862
2866
|
}
|
|
2863
2867
|
}
|