@mindexec/cli 0.2.0
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/README.md +275 -0
- package/codex-runtime.js +960 -0
- package/launch-bridge.cjs +162 -0
- package/package.json +61 -0
- package/port-guard.cjs +232 -0
- package/scripts/setup-tree-sitter-grammars.mjs +59 -0
- package/server.js +8422 -0
- package/start-bridge.bat +32 -0
- package/start-bridge.sh +81 -0
- package/tree-sitter-grammars/README.md +18 -0
- package/tree-sitter-grammars/tree-sitter-c_sharp.wasm +0 -0
- package/tree-sitter-grammars/tree-sitter-go.wasm +0 -0
- package/tree-sitter-grammars/tree-sitter-java.wasm +0 -0
- package/tree-sitter-grammars/tree-sitter-javascript.wasm +0 -0
- package/tree-sitter-grammars/tree-sitter-python.wasm +0 -0
- package/tree-sitter-grammars/tree-sitter-rust.wasm +0 -0
- package/tree-sitter-grammars/tree-sitter-tsx.wasm +0 -0
- package/tree-sitter-grammars/tree-sitter-typescript.wasm +0 -0
- package/wwwroot/MindExecution.Web.styles.css +3 -0
- package/wwwroot/_content/MindExecution.Plugins.Admin/css/admin-dashboard.css +546 -0
- package/wwwroot/_content/MindExecution.Plugins.Directory/MindExecution.Plugins.Directory.u7utcng611.bundle.scp.css +7 -0
- package/wwwroot/_content/MindExecution.Plugins.Directory/background.png +0 -0
- package/wwwroot/_content/MindExecution.Plugins.Directory/directory-manager.js +202 -0
- package/wwwroot/_content/MindExecution.Plugins.Directory/exampleJsInterop.js +6 -0
- package/wwwroot/_content/MindExecution.Plugins.YouTube/css/youtube-search.css +251 -0
- package/wwwroot/_content/MindExecution.Shared/MindExecution.Shared.wsano1j4wp.bundle.scp.css +4 -0
- package/wwwroot/_content/MindExecution.Shared/css/admin-dashboard.css +559 -0
- package/wwwroot/_content/MindExecution.Shared/css/app.css +1 -0
- package/wwwroot/_content/MindExecution.Shared/css/mind-map-overrides.css +2936 -0
- package/wwwroot/_content/MindExecution.Shared/fonts/NotoSansKR-Bold.ttf +0 -0
- package/wwwroot/_content/MindExecution.Shared/fonts/NotoSansKR-Regular.ttf +0 -0
- package/wwwroot/_content/MindExecution.Shared/js/agent-visualization.js +359 -0
- package/wwwroot/_content/MindExecution.Shared/js/background-themes.js +1721 -0
- package/wwwroot/_content/MindExecution.Shared/js/code-master.js +8316 -0
- package/wwwroot/_content/MindExecution.Shared/js/file-system-helper.js +639 -0
- package/wwwroot/_content/MindExecution.Shared/js/helpers/InfiniteGridHelper.js +109 -0
- package/wwwroot/_content/MindExecution.Shared/js/marked.min.js +69 -0
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-core.js +7982 -0
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-core.js.backup +1059 -0
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-css3d-manager.js +15803 -0
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-dev-guards.js +325 -0
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-dnd.js +1430 -0
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-dnd.js.bak +434 -0
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-glow-shader.js +260 -0
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-interactions.js +7640 -0
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-lod-plan-worker.js +160 -0
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-lod-renderer.js +9923 -0
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-logic-workers.js +977 -0
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-menu-manager.js +1431 -0
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-multi-select.js +1716 -0
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-node-search-worker.js +553 -0
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-nodes.js +4541 -0
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-object-manager.js +489 -0
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-object-manager.js.backup +372 -0
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-pipeline.js +2075 -0
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-text-lod-system.js +646 -0
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-text-overlay-v2.js +4323 -0
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-texture-factory.js +2260 -0
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-texture-factory.js.backup +1258 -0
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-visibility-worker.js +890 -0
- package/wwwroot/_content/MindExecution.Shared/js/mindmap-toolbar.js +594 -0
- package/wwwroot/_content/MindExecution.Shared/js/native-drop-handler.js +170 -0
- package/wwwroot/_content/MindExecution.Shared/js/plan-master.js +788 -0
- package/wwwroot/_content/MindExecution.Shared/js/renderers/CSS3DRenderer.js +50 -0
- package/wwwroot/_content/MindExecution.Shared/js/texture-worker-manager.js +188 -0
- package/wwwroot/_content/MindExecution.Shared/js/texture-worker.js +208 -0
- package/wwwroot/_content/MindExecution.Shared/js/three.min.js +6 -0
- package/wwwroot/_content/MindExecution.Shared/js/titlebar-handler.js +191 -0
- package/wwwroot/_content/MindExecution.Shared/js/token-manager.js +37 -0
- package/wwwroot/_content/MindExecution.Shared/js/token-worker.js +28 -0
- package/wwwroot/_content/MindExecution.Shared/js/troika-bundle.js +5626 -0
- package/wwwroot/_content/MindExecution.Shared/js/troika-bundle.js.map +7 -0
- package/wwwroot/_content/MindExecution.Shared/lib/font-awesome/css/all.min.css +9 -0
- package/wwwroot/_content/MindExecution.Shared/lib/font-awesome/webfonts/fa-brands-400.ttf +0 -0
- package/wwwroot/_content/MindExecution.Shared/lib/font-awesome/webfonts/fa-brands-400.woff2 +0 -0
- package/wwwroot/_content/MindExecution.Shared/lib/font-awesome/webfonts/fa-regular-400.ttf +0 -0
- package/wwwroot/_content/MindExecution.Shared/lib/font-awesome/webfonts/fa-regular-400.woff2 +0 -0
- package/wwwroot/_content/MindExecution.Shared/lib/font-awesome/webfonts/fa-solid-900.ttf +0 -0
- package/wwwroot/_content/MindExecution.Shared/lib/font-awesome/webfonts/fa-solid-900.woff2 +0 -0
- package/wwwroot/_content/MindExecution.Shared/models/all-MiniLM-L6-v2-quantized.onnx +0 -0
- package/wwwroot/_content/MindExecution.Shared/models/vocab.txt +30522 -0
- package/wwwroot/_framework/Google.Protobuf.9h59ukbel7.dll +0 -0
- package/wwwroot/_framework/Markdig.d1j7v41cl1.dll +0 -0
- package/wwwroot/_framework/MessagePack.Annotations.l6qv48kgpt.dll +0 -0
- package/wwwroot/_framework/MessagePack.eqoptzx9d5.dll +0 -0
- package/wwwroot/_framework/Microsoft.AspNetCore.Authorization.k7dsih5y5g.dll +0 -0
- package/wwwroot/_framework/Microsoft.AspNetCore.Components.6nyje9sa0g.dll +0 -0
- package/wwwroot/_framework/Microsoft.AspNetCore.Components.Authorization.iycd6unprw.dll +0 -0
- package/wwwroot/_framework/Microsoft.AspNetCore.Components.Web.487u3twia4.dll +0 -0
- package/wwwroot/_framework/Microsoft.AspNetCore.Components.WebAssembly.d0gcnmlxxz.dll +0 -0
- package/wwwroot/_framework/Microsoft.AspNetCore.Metadata.h4yevl9adi.dll +0 -0
- package/wwwroot/_framework/Microsoft.CSharp.qrvp77qmhs.dll +0 -0
- package/wwwroot/_framework/Microsoft.Data.Sqlite.jdlxgv2jtg.dll +0 -0
- package/wwwroot/_framework/Microsoft.EntityFrameworkCore.4gjazp7kjf.dll +0 -0
- package/wwwroot/_framework/Microsoft.EntityFrameworkCore.Abstractions.gocudnvz7b.dll +0 -0
- package/wwwroot/_framework/Microsoft.EntityFrameworkCore.Relational.lt4rsvinuo.dll +0 -0
- package/wwwroot/_framework/Microsoft.EntityFrameworkCore.Sqlite.69luj0fa9r.dll +0 -0
- package/wwwroot/_framework/Microsoft.Extensions.Caching.Abstractions.364t4jh3zz.dll +0 -0
- package/wwwroot/_framework/Microsoft.Extensions.Caching.Memory.izlxhpzosu.dll +0 -0
- package/wwwroot/_framework/Microsoft.Extensions.Configuration.8zq7hh41o7.dll +0 -0
- package/wwwroot/_framework/Microsoft.Extensions.Configuration.Abstractions.8if74zs6ea.dll +0 -0
- package/wwwroot/_framework/Microsoft.Extensions.Configuration.Json.duvlngw8i0.dll +0 -0
- package/wwwroot/_framework/Microsoft.Extensions.DependencyInjection.Abstractions.t2hh9kvx0o.dll +0 -0
- package/wwwroot/_framework/Microsoft.Extensions.DependencyInjection.n4tg99oy8l.dll +0 -0
- package/wwwroot/_framework/Microsoft.Extensions.DependencyModel.h0d06ixk3e.dll +0 -0
- package/wwwroot/_framework/Microsoft.Extensions.Logging.Abstractions.rl32bkx2sd.dll +0 -0
- package/wwwroot/_framework/Microsoft.Extensions.Logging.dlht1xei0t.dll +0 -0
- package/wwwroot/_framework/Microsoft.Extensions.Options.qeunebioml.dll +0 -0
- package/wwwroot/_framework/Microsoft.Extensions.Primitives.18cr6vnuuz.dll +0 -0
- package/wwwroot/_framework/Microsoft.IO.RecyclableMemoryStream.r915vovvw4.dll +0 -0
- package/wwwroot/_framework/Microsoft.IdentityModel.Abstractions.1ejljk3erv.dll +0 -0
- package/wwwroot/_framework/Microsoft.IdentityModel.JsonWebTokens.1596zr8gne.dll +0 -0
- package/wwwroot/_framework/Microsoft.IdentityModel.Logging.229uyvpgio.dll +0 -0
- package/wwwroot/_framework/Microsoft.IdentityModel.Tokens.9sibtajc9f.dll +0 -0
- package/wwwroot/_framework/Microsoft.JSInterop.17lq4j1j7g.dll +0 -0
- package/wwwroot/_framework/Microsoft.JSInterop.WebAssembly.ryia5gxiad.dll +0 -0
- package/wwwroot/_framework/Microsoft.ML.OnnxRuntime.w9deo1m5ss.dll +0 -0
- package/wwwroot/_framework/Microsoft.ML.Tokenizers.cm2vuv2z61.dll +0 -0
- package/wwwroot/_framework/Microsoft.NET.StringTools.3qbrf4v2ki.dll +0 -0
- package/wwwroot/_framework/MimeMapping.og9ys58ylm.dll +0 -0
- package/wwwroot/_framework/MindExecution.Core.1q1trifbuu.dll +0 -0
- package/wwwroot/_framework/MindExecution.Kernel.gwwc40sc45.dll +0 -0
- package/wwwroot/_framework/MindExecution.Plugins.Admin.0jgrn1sckv.dll +0 -0
- package/wwwroot/_framework/MindExecution.Plugins.Business.13mme2qcag.dll +0 -0
- package/wwwroot/_framework/MindExecution.Plugins.Concept.dfp2mdt45q.dll +0 -0
- package/wwwroot/_framework/MindExecution.Plugins.Directory.3w4t6n3se0.dll +0 -0
- package/wwwroot/_framework/MindExecution.Plugins.PlanMaster.s0qpntz420.dll +0 -0
- package/wwwroot/_framework/MindExecution.Plugins.YouTube.iu11fq8d16.dll +0 -0
- package/wwwroot/_framework/MindExecution.Shared.7j27dcqnrc.dll +0 -0
- package/wwwroot/_framework/MindExecution.Web.pq1ty8ov2v.dll +0 -0
- package/wwwroot/_framework/Newtonsoft.Json.a56zs13vug.dll +0 -0
- package/wwwroot/_framework/SQLitePCLRaw.batteries_v2.rrd1nzawpp.dll +0 -0
- package/wwwroot/_framework/SQLitePCLRaw.core.1dxloztpfz.dll +0 -0
- package/wwwroot/_framework/SQLitePCLRaw.provider.e_sqlite3.oekyzl53i1.dll +0 -0
- package/wwwroot/_framework/Supabase.Core.s1pkj4aj0l.dll +0 -0
- package/wwwroot/_framework/Supabase.Functions.qz4nu782sg.dll +0 -0
- package/wwwroot/_framework/Supabase.Gotrue.twah27pkik.dll +0 -0
- package/wwwroot/_framework/Supabase.Postgrest.gmuuv369ih.dll +0 -0
- package/wwwroot/_framework/Supabase.Realtime.ox3kchdy3w.dll +0 -0
- package/wwwroot/_framework/Supabase.Storage.fnjnepaowr.dll +0 -0
- package/wwwroot/_framework/Supabase.azmaw5pgcz.dll +0 -0
- package/wwwroot/_framework/System.Collections.Concurrent.y1zmvuyipi.dll +0 -0
- package/wwwroot/_framework/System.Collections.Immutable.ug3j698qms.dll +0 -0
- package/wwwroot/_framework/System.Collections.NonGeneric.h66hj3863h.dll +0 -0
- package/wwwroot/_framework/System.Collections.Specialized.umr3y27ntj.dll +0 -0
- package/wwwroot/_framework/System.Collections.x53e19vfsj.dll +0 -0
- package/wwwroot/_framework/System.ComponentModel.Annotations.tz6gnt4ebt.dll +0 -0
- package/wwwroot/_framework/System.ComponentModel.Primitives.j7tiphu4rg.dll +0 -0
- package/wwwroot/_framework/System.ComponentModel.TypeConverter.ujlztox1gx.dll +0 -0
- package/wwwroot/_framework/System.ComponentModel.x9xz0ojfb6.dll +0 -0
- package/wwwroot/_framework/System.Console.ijzpqmj7ne.dll +0 -0
- package/wwwroot/_framework/System.Data.Common.1r0sqffq1p.dll +0 -0
- package/wwwroot/_framework/System.Diagnostics.DiagnosticSource.9upoqwq09o.dll +0 -0
- package/wwwroot/_framework/System.Diagnostics.Process.m99azzntjm.dll +0 -0
- package/wwwroot/_framework/System.Diagnostics.TraceSource.pl7wv26myr.dll +0 -0
- package/wwwroot/_framework/System.Diagnostics.Tracing.crlhfx6tut.dll +0 -0
- package/wwwroot/_framework/System.Drawing.Primitives.22e4y9ikq9.dll +0 -0
- package/wwwroot/_framework/System.Drawing.mi7d8hwowb.dll +0 -0
- package/wwwroot/_framework/System.Formats.Asn1.jx23sjiqnn.dll +0 -0
- package/wwwroot/_framework/System.IO.Compression.6fyoii3uej.dll +0 -0
- package/wwwroot/_framework/System.IO.Pipelines.vg77t4cd4d.dll +0 -0
- package/wwwroot/_framework/System.IdentityModel.Tokens.Jwt.t67es60z5b.dll +0 -0
- package/wwwroot/_framework/System.Linq.1bkoxlqgmq.dll +0 -0
- package/wwwroot/_framework/System.Linq.Expressions.24xqiypwdt.dll +0 -0
- package/wwwroot/_framework/System.Linq.Queryable.hvd01d6rsa.dll +0 -0
- package/wwwroot/_framework/System.Memory.8dx3lwgym4.dll +0 -0
- package/wwwroot/_framework/System.Net.Http.Json.3mhdm9l1rf.dll +0 -0
- package/wwwroot/_framework/System.Net.Http.eitrz660my.dll +0 -0
- package/wwwroot/_framework/System.Net.NetworkInformation.3pkuofcv9r.dll +0 -0
- package/wwwroot/_framework/System.Net.Ping.8clj5pklrp.dll +0 -0
- package/wwwroot/_framework/System.Net.Primitives.qrp4wcjz1p.dll +0 -0
- package/wwwroot/_framework/System.Net.WebSockets.Client.2u6pv01g69.dll +0 -0
- package/wwwroot/_framework/System.Net.WebSockets.qp6u31zvm5.dll +0 -0
- package/wwwroot/_framework/System.Numerics.Tensors.0c7z4mt3on.dll +0 -0
- package/wwwroot/_framework/System.Numerics.Vectors.kc7ufp2j4l.dll +0 -0
- package/wwwroot/_framework/System.ObjectModel.qv82fot1ib.dll +0 -0
- package/wwwroot/_framework/System.Private.CoreLib.rkafq04oma.dll +0 -0
- package/wwwroot/_framework/System.Private.Uri.t9542hmr6j.dll +0 -0
- package/wwwroot/_framework/System.Private.Xml.Linq.n8n3ptrbwu.dll +0 -0
- package/wwwroot/_framework/System.Private.Xml.rxd3tytisn.dll +0 -0
- package/wwwroot/_framework/System.Reactive.t3fuon548l.dll +0 -0
- package/wwwroot/_framework/System.Reflection.Emit.9tjhp6y0j3.dll +0 -0
- package/wwwroot/_framework/System.Reflection.Emit.ILGeneration.stxyk8zoo1.dll +0 -0
- package/wwwroot/_framework/System.Reflection.Emit.Lightweight.6xrd5v8vg0.dll +0 -0
- package/wwwroot/_framework/System.Reflection.Primitives.wgn8fpwwvv.dll +0 -0
- package/wwwroot/_framework/System.Runtime.InteropServices.JavaScript.sliym526xh.dll +0 -0
- package/wwwroot/_framework/System.Runtime.InteropServices.RuntimeInformation.oji7zut14z.dll +0 -0
- package/wwwroot/_framework/System.Runtime.InteropServices.te07xr2we9.dll +0 -0
- package/wwwroot/_framework/System.Runtime.Intrinsics.507y4h8nzq.dll +0 -0
- package/wwwroot/_framework/System.Runtime.Loader.v7gk4bse0k.dll +0 -0
- package/wwwroot/_framework/System.Runtime.Numerics.eqy5xjv3nd.dll +0 -0
- package/wwwroot/_framework/System.Runtime.Serialization.Formatters.zpkrub8lab.dll +0 -0
- package/wwwroot/_framework/System.Runtime.Serialization.Primitives.vhkpnbxjip.dll +0 -0
- package/wwwroot/_framework/System.Runtime.jn319d5nyg.dll +0 -0
- package/wwwroot/_framework/System.Security.Claims.0ztig1q9vo.dll +0 -0
- package/wwwroot/_framework/System.Security.Cryptography.vttizqc9ho.dll +0 -0
- package/wwwroot/_framework/System.Text.Encoding.Extensions.utdd47ny8f.dll +0 -0
- package/wwwroot/_framework/System.Text.Encodings.Web.wah8r1zoe0.dll +0 -0
- package/wwwroot/_framework/System.Text.Json.kxlfxj0wrs.dll +0 -0
- package/wwwroot/_framework/System.Text.RegularExpressions.dbqn58klox.dll +0 -0
- package/wwwroot/_framework/System.Threading.42ao9vi047.dll +0 -0
- package/wwwroot/_framework/System.Threading.Channels.hfa7j0uv2w.dll +0 -0
- package/wwwroot/_framework/System.Threading.Thread.caul0pdqul.dll +0 -0
- package/wwwroot/_framework/System.Transactions.Local.fimi2hamzo.dll +0 -0
- package/wwwroot/_framework/System.Web.HttpUtility.gq8yz50p2e.dll +0 -0
- package/wwwroot/_framework/System.Xml.Linq.kitin4zjoj.dll +0 -0
- package/wwwroot/_framework/System.Xml.ReaderWriter.kzvw3qgxb0.dll +0 -0
- package/wwwroot/_framework/System.Xml.XDocument.c539ki6cuq.dll +0 -0
- package/wwwroot/_framework/System.m05i39uvk9.dll +0 -0
- package/wwwroot/_framework/Websocket.Client.vapounvmnl.dll +0 -0
- package/wwwroot/_framework/blazor.boot.json +305 -0
- package/wwwroot/_framework/blazor.webassembly.js +1 -0
- package/wwwroot/_framework/dotnet.js +4 -0
- package/wwwroot/_framework/dotnet.native.vz0adxojrz.wasm +0 -0
- package/wwwroot/_framework/dotnet.native.xsn1d6x2kd.js +16 -0
- package/wwwroot/_framework/dotnet.runtime.dstopyvqzi.js +4 -0
- package/wwwroot/_framework/icudt_CJK.tjcz0u77k5.dat +0 -0
- package/wwwroot/_framework/icudt_EFIGS.tptq2av103.dat +0 -0
- package/wwwroot/_framework/icudt_no_CJK.lfu7j35m59.dat +0 -0
- package/wwwroot/_framework/netstandard.0xet7jg7ky.dll +0 -0
- package/wwwroot/_headers +40 -0
- package/wwwroot/_redirects +1 -0
- package/wwwroot/appsettings.json +71 -0
- package/wwwroot/icon-192.png +0 -0
- package/wwwroot/icon-512.png +0 -0
- package/wwwroot/index.html +710 -0
- package/wwwroot/js/marketing-tool.js +180 -0
- package/wwwroot/manifest.webmanifest +22 -0
- package/wwwroot/robots.txt +4 -0
- package/wwwroot/service-worker-assets.js +857 -0
- package/wwwroot/service-worker.js +33 -0
- package/wwwroot/sitemap.xml +27 -0
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
// 파일 이름: mind-map-dnd.js
|
|
2
|
+
// MindMap 드래그 앤 드롭 처리 (플러그인 레지스트리 기반 + 브라우저 이미지 드래그 강화)
|
|
3
|
+
window.MindMapDnD = (function () {
|
|
4
|
+
|
|
5
|
+
if (!window.MindMapFileRegistry) {
|
|
6
|
+
window.MindMapFileRegistry = [];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function registerCoreHandlers() {
|
|
10
|
+
if (window.MindMapFileRegistry.some(h => h.name === 'CorePDF')) return;
|
|
11
|
+
|
|
12
|
+
window.MindMapFileRegistry.push({
|
|
13
|
+
name: 'CorePDF',
|
|
14
|
+
priority: 5,
|
|
15
|
+
check: (file) => file.type === 'application/pdf',
|
|
16
|
+
getType: () => 'pdf'
|
|
17
|
+
});
|
|
18
|
+
console.log('[MindMapDnD] Core file handlers registered');
|
|
19
|
+
}
|
|
20
|
+
registerCoreHandlers();
|
|
21
|
+
|
|
22
|
+
const eventHandlers = new WeakMap();
|
|
23
|
+
const GRID_SNAP = 10;
|
|
24
|
+
|
|
25
|
+
function getBoundHandlers(module) {
|
|
26
|
+
if (!eventHandlers.has(module)) {
|
|
27
|
+
eventHandlers.set(module, {
|
|
28
|
+
boundOnDragOver: onDragOver.bind(null, module),
|
|
29
|
+
boundOnDragLeave: onDragLeave.bind(null, module),
|
|
30
|
+
boundOnDrop: onDrop.bind(null, module)
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return eventHandlers.get(module);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function onDragOver(module, e) {
|
|
37
|
+
e.preventDefault();
|
|
38
|
+
e.stopPropagation();
|
|
39
|
+
e.dataTransfer.dropEffect = 'copy';
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async function handleBrowserImageDrop(module, e, imageUrl) {
|
|
44
|
+
const mouse = {
|
|
45
|
+
x: (e.clientX / module.container.clientWidth) * 2 - 1,
|
|
46
|
+
y: -(e.clientY / module.container.clientHeight) * 2 + 1
|
|
47
|
+
};
|
|
48
|
+
const vfov = (module.camera.fov * Math.PI) / 180;
|
|
49
|
+
const viewHeight = 2 * Math.tan(vfov / 2) * module.camera.position.z;
|
|
50
|
+
const viewWidth = viewHeight * module.camera.aspect;
|
|
51
|
+
const worldX = module.camera.position.x + (mouse.x * viewWidth) / 2;
|
|
52
|
+
const worldY = module.camera.position.y + (mouse.y * viewHeight) / 2;
|
|
53
|
+
|
|
54
|
+
const tempId = `temp_browser_${Date.now()}`;
|
|
55
|
+
const placeholderNode = {
|
|
56
|
+
TempId: tempId,
|
|
57
|
+
ContentType: 'image',
|
|
58
|
+
FileName: 'Web Image',
|
|
59
|
+
X: module.snapToGrid(worldX),
|
|
60
|
+
Y: module.snapToGrid(worldY),
|
|
61
|
+
Width: 300,
|
|
62
|
+
Height: 200,
|
|
63
|
+
IsLoading: true
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
try {
|
|
67
|
+
const actualNodeIdsMap = await module.dotNetHelper.invokeMethodAsync('AddFileNodesFromJs', [placeholderNode]);
|
|
68
|
+
const actualId = actualNodeIdsMap[tempId];
|
|
69
|
+
if (!actualId) return;
|
|
70
|
+
|
|
71
|
+
const finalUrl = await fetchImageAsBlobUrl(imageUrl);
|
|
72
|
+
|
|
73
|
+
const { width, height } = await new Promise((resolve) => {
|
|
74
|
+
const img = new Image();
|
|
75
|
+
img.crossOrigin = 'anonymous';
|
|
76
|
+
img.onload = () => {
|
|
77
|
+
const TARGET_WIDTH = 400;
|
|
78
|
+
const aspectRatio = (img.naturalHeight > 0 && img.naturalWidth > 0)
|
|
79
|
+
? img.naturalHeight / img.naturalWidth
|
|
80
|
+
: 0.75;
|
|
81
|
+
const targetHeight = TARGET_WIDTH * aspectRatio;
|
|
82
|
+
resolve({
|
|
83
|
+
width: Math.round(TARGET_WIDTH / GRID_SNAP) * GRID_SNAP,
|
|
84
|
+
height: Math.round(targetHeight / GRID_SNAP) * GRID_SNAP
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
img.onerror = () => {
|
|
88
|
+
console.warn('[MindMapDnD] Failed to measure browser image size.');
|
|
89
|
+
resolve({ width: 300, height: 200 });
|
|
90
|
+
};
|
|
91
|
+
img.src = finalUrl;
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
await module.dotNetHelper.invokeMethodAsync('UpdateMultipleFileNodeDetails', [{
|
|
95
|
+
NodeId: actualId,
|
|
96
|
+
FileUrl: finalUrl,
|
|
97
|
+
Width: width,
|
|
98
|
+
Height: height
|
|
99
|
+
}]);
|
|
100
|
+
|
|
101
|
+
console.log('[MindMapDnD] Browser image dropped and processed successfully.');
|
|
102
|
+
} catch (err) {
|
|
103
|
+
console.error('[MindMapDnD] Failed to process browser image drop:', err);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function onDragLeave(module, e) {
|
|
108
|
+
e.preventDefault();
|
|
109
|
+
e.stopPropagation();
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function extractImageUrl(dataTransfer) {
|
|
113
|
+
if (!dataTransfer) return null;
|
|
114
|
+
const html = dataTransfer.getData('text/html');
|
|
115
|
+
if (html) {
|
|
116
|
+
const parser = new DOMParser();
|
|
117
|
+
const doc = parser.parseFromString(html, 'text/html');
|
|
118
|
+
const img = doc.querySelector('img');
|
|
119
|
+
if (img && img.src) return img.src;
|
|
120
|
+
}
|
|
121
|
+
const uri = dataTransfer.getData('text/uri-list');
|
|
122
|
+
if (uri && /\.(jpg|jpeg|png|gif|webp)$/i.test(uri)) {
|
|
123
|
+
return uri;
|
|
124
|
+
}
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
async function fetchImageAsBlobUrl(url) {
|
|
129
|
+
try {
|
|
130
|
+
const response = await fetch(url, { mode: 'cors' });
|
|
131
|
+
if (!response.ok) throw new Error('Network response was not ok');
|
|
132
|
+
const blob = await response.blob();
|
|
133
|
+
return URL.createObjectURL(blob);
|
|
134
|
+
} catch (e) {
|
|
135
|
+
console.warn('[MindMapDnD] CORS fetch failed, using raw URL. (Canvas tainting may occur)', e);
|
|
136
|
+
return url;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
async function onDrop(module, e) {
|
|
141
|
+
e.preventDefault();
|
|
142
|
+
e.stopPropagation();
|
|
143
|
+
if (!module.dotNetHelper) return false;
|
|
144
|
+
|
|
145
|
+
const dataTransfer = e.dataTransfer;
|
|
146
|
+
if (!dataTransfer) return false;
|
|
147
|
+
|
|
148
|
+
dataTransfer.dropEffect = 'copy';
|
|
149
|
+
|
|
150
|
+
// ▼▼▼ [프로파일링] 전체 프로세스 시간 측정 시작 ▼▼▼
|
|
151
|
+
console.time('[DnD] Total Drop Process');
|
|
152
|
+
// ▲▲▲ [프로파일링] ▲▲▲
|
|
153
|
+
|
|
154
|
+
const files = e.dataTransfer?.files ? Array.from(e.dataTransfer.files) : [];
|
|
155
|
+
|
|
156
|
+
if (files.length === 0) {
|
|
157
|
+
const imageUrl = extractImageUrl(e.dataTransfer);
|
|
158
|
+
if (imageUrl) {
|
|
159
|
+
console.log(`[MindMapDnD] Detected browser image drop: ${imageUrl}`);
|
|
160
|
+
await handleBrowserImageDrop(module, e, imageUrl);
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// ▼▼▼ [수정] 레지스트리 기반 파일 필터링 ▼▼▼
|
|
166
|
+
const filesToProcess = [];
|
|
167
|
+
|
|
168
|
+
for (const file of files) {
|
|
169
|
+
let matchedType = null;
|
|
170
|
+
|
|
171
|
+
// 레지스트리 정렬 (priority 낮을수록 먼저)
|
|
172
|
+
const sortedRegistry = [...window.MindMapFileRegistry].sort((a, b) =>
|
|
173
|
+
(a.priority ?? 50) - (b.priority ?? 50)
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
// 등록된 핸들러들을 순회하며 매치되는 첫 번째 타입 사용
|
|
177
|
+
for (const handler of sortedRegistry) {
|
|
178
|
+
if (handler.check(file)) {
|
|
179
|
+
matchedType = handler.getType(file);
|
|
180
|
+
console.log(`[MindMapDnD] File '${file.name}' matched handler '${handler.name}' -> type: '${matchedType}'`);
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (matchedType) {
|
|
186
|
+
filesToProcess.push({ file, type: matchedType });
|
|
187
|
+
} else {
|
|
188
|
+
console.warn(`[MindMapDnD] File '${file.name}' - no handler found, skipping`);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (filesToProcess.length === 0) {
|
|
193
|
+
console.log('[MindMapDnD] No files matched any handler');
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
// ▲▲▲ [수정] ▲▲▲
|
|
197
|
+
|
|
198
|
+
// 드롭 위치의 월드 좌표 계산
|
|
199
|
+
const mouse = {
|
|
200
|
+
x: (e.clientX / module.container.clientWidth) * 2 - 1,
|
|
201
|
+
y: -(e.clientY / module.container.clientHeight) * 2 + 1
|
|
202
|
+
};
|
|
203
|
+
const vfov = (module.camera.fov * Math.PI) / 180;
|
|
204
|
+
const viewHeight = 2 * Math.tan(vfov / 2) * module.camera.position.z;
|
|
205
|
+
const viewWidth = viewHeight * module.camera.aspect;
|
|
206
|
+
const worldX = module.camera.position.x + (mouse.x * viewWidth) / 2;
|
|
207
|
+
const worldY = module.camera.position.y + (mouse.y * viewHeight) / 2;
|
|
208
|
+
|
|
209
|
+
// ▼▼▼ [수정] 플레이스홀더 생성 (타입별 크기) ▼▼▼
|
|
210
|
+
const placeholderNodes = filesToProcess.map(({ file, type }, index) => {
|
|
211
|
+
const tempId = `temp_${Date.now()}_${index}`;
|
|
212
|
+
|
|
213
|
+
// 타입별 기본 크기 설정
|
|
214
|
+
let nodeWidth, nodeHeight;
|
|
215
|
+
switch (type) {
|
|
216
|
+
case 'image':
|
|
217
|
+
nodeWidth = 300;
|
|
218
|
+
nodeHeight = 200;
|
|
219
|
+
break;
|
|
220
|
+
case 'pdf':
|
|
221
|
+
nodeWidth = 400;
|
|
222
|
+
nodeHeight = 56;
|
|
223
|
+
break;
|
|
224
|
+
case 'text':
|
|
225
|
+
nodeWidth = 500;
|
|
226
|
+
nodeHeight = 300;
|
|
227
|
+
break;
|
|
228
|
+
case 'directory':
|
|
229
|
+
nodeWidth = 400;
|
|
230
|
+
nodeHeight = 200;
|
|
231
|
+
break;
|
|
232
|
+
default:
|
|
233
|
+
nodeWidth = 400;
|
|
234
|
+
nodeHeight = 200;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
return {
|
|
238
|
+
TempId: tempId,
|
|
239
|
+
ContentType: type,
|
|
240
|
+
FileName: file.name,
|
|
241
|
+
X: module.snapToGrid(worldX + index * 20),
|
|
242
|
+
Y: module.snapToGrid(worldY - index * 20),
|
|
243
|
+
Width: nodeWidth,
|
|
244
|
+
Height: nodeHeight,
|
|
245
|
+
IsLoading: true
|
|
246
|
+
};
|
|
247
|
+
});
|
|
248
|
+
// ▲▲▲ [수정] ▲▲▲
|
|
249
|
+
|
|
250
|
+
// ▼▼▼ [프로파일링] C# AddFileNodesFromJs 시간 측정 ▼▼▼
|
|
251
|
+
console.time('[DnD] 1. C# AddFileNodesFromJs');
|
|
252
|
+
// ▲▲▲ [프로파일링] ▲▲▲
|
|
253
|
+
const actualNodeIdsMap = await module.dotNetHelper.invokeMethodAsync('AddFileNodesFromJs', placeholderNodes);
|
|
254
|
+
// ▼▼▼ [프로파일링] ▼▼▼
|
|
255
|
+
console.timeEnd('[DnD] 1. C# AddFileNodesFromJs');
|
|
256
|
+
// ▲▲▲ [프로파일링] ▲▲▲
|
|
257
|
+
|
|
258
|
+
(async () => {
|
|
259
|
+
// ▼▼▼ [프로파일링] 병렬 파일 처리 시간 측정 ▼▼▼
|
|
260
|
+
console.time('[DnD] 2. Parallel File Processing (All)');
|
|
261
|
+
// ▲▲▲ [프로파일링] ▲▲▲
|
|
262
|
+
|
|
263
|
+
// ▼▼▼ [수정] 타입별 파일 처리 로직 ▼▼▼
|
|
264
|
+
const processingPromises = filesToProcess.map(async ({ file, type }, i) => {
|
|
265
|
+
const placeholder = placeholderNodes[i];
|
|
266
|
+
const actualId = actualNodeIdsMap[placeholder.TempId];
|
|
267
|
+
if (!actualId) return null;
|
|
268
|
+
|
|
269
|
+
const objectUrl = URL.createObjectURL(file);
|
|
270
|
+
|
|
271
|
+
switch (type) {
|
|
272
|
+
case 'image': {
|
|
273
|
+
console.time(`[DnD] 2a. Get Image Size - ${placeholder.FileName}`);
|
|
274
|
+
try {
|
|
275
|
+
const { width, height } = await new Promise((resolve, reject) => {
|
|
276
|
+
const img = new Image();
|
|
277
|
+
img.onload = () => {
|
|
278
|
+
const TARGET_WIDTH = 400;
|
|
279
|
+
const aspectRatio = (img.naturalHeight > 0 && img.naturalWidth > 0)
|
|
280
|
+
? img.naturalHeight / img.naturalWidth
|
|
281
|
+
: 0.75;
|
|
282
|
+
const targetHeight = TARGET_WIDTH * aspectRatio;
|
|
283
|
+
resolve({
|
|
284
|
+
width: Math.round(TARGET_WIDTH / GRID_SNAP) * GRID_SNAP,
|
|
285
|
+
height: Math.round(targetHeight / GRID_SNAP) * GRID_SNAP
|
|
286
|
+
});
|
|
287
|
+
};
|
|
288
|
+
img.onerror = reject;
|
|
289
|
+
img.src = objectUrl;
|
|
290
|
+
});
|
|
291
|
+
console.timeEnd(`[DnD] 2a. Get Image Size - ${placeholder.FileName}`);
|
|
292
|
+
return {
|
|
293
|
+
NodeId: actualId,
|
|
294
|
+
FileUrl: objectUrl,
|
|
295
|
+
Width: width,
|
|
296
|
+
Height: height
|
|
297
|
+
};
|
|
298
|
+
} catch (err) {
|
|
299
|
+
console.timeEnd(`[DnD] 2a. Get Image Size - ${placeholder.FileName}`);
|
|
300
|
+
console.warn(`[DnD] Image load failed - ${placeholder.FileName}:`, err);
|
|
301
|
+
return {
|
|
302
|
+
NodeId: actualId,
|
|
303
|
+
FileUrl: '',
|
|
304
|
+
Width: 300,
|
|
305
|
+
Height: 200
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
case 'text': {
|
|
310
|
+
console.time(`[DnD] 2b. Read Text File - ${placeholder.FileName}`);
|
|
311
|
+
try {
|
|
312
|
+
// ▼▼▼ [디버깅] 파일 읽기 시작 ▼▼▼
|
|
313
|
+
console.log(`[DnD] Starting to read text file: ${placeholder.FileName}, actualId: ${actualId}`);
|
|
314
|
+
// ▲▲▲ [디버깅] ▲▲▲
|
|
315
|
+
|
|
316
|
+
const textContent = await file.text();
|
|
317
|
+
|
|
318
|
+
console.timeEnd(`[DnD] 2b. Read Text File - ${placeholder.FileName}`);
|
|
319
|
+
|
|
320
|
+
// ▼▼▼ [디버깅] 파일 읽기 성공 ▼▼▼
|
|
321
|
+
console.log(`[DnD] Successfully read ${textContent.length} chars from ${placeholder.FileName}`);
|
|
322
|
+
// ▲▲▲ [디버깅] ▲▲▲
|
|
323
|
+
|
|
324
|
+
// ▼▼▼ [디버깅] C# 메서드 호출 직전 ▼▼▼
|
|
325
|
+
console.log(`[DnD] About to call UpdateNodeContent with nodeId: ${actualId}, contentLength: ${textContent.length}`);
|
|
326
|
+
// ▲▲▲ [디버깅] ▲▲▲
|
|
327
|
+
|
|
328
|
+
// 텍스트는 별도로 업데이트 (URL 대신 내용 저장)
|
|
329
|
+
await module.dotNetHelper.invokeMethodAsync('UpdateNodeContent', actualId, textContent);
|
|
330
|
+
|
|
331
|
+
// ▼▼▼ [디버깅] C# 메서드 호출 성공 ▼▼▼
|
|
332
|
+
console.log(`[DnD] UpdateNodeContent completed for nodeId: ${actualId}`);
|
|
333
|
+
// ▲▲▲ [디버깅] ▲▲▲
|
|
334
|
+
|
|
335
|
+
// ▼▼▼ [핵심 수정] 화면 갱신 요청 추가 ▼▼▼
|
|
336
|
+
// 이 줄이 없어서 텍스처가 '로딩 중' 상태에서 멈춰 있었습니다.
|
|
337
|
+
if (window.mindMap) {
|
|
338
|
+
// 로컬 3D 뷰어에게 "이 노드 내용이 바뀌었으니 다시 그려라"고 명령
|
|
339
|
+
await window.mindMap.updateNodeContent(actualId, textContent);
|
|
340
|
+
console.log(`[DnD] Triggered local view update for node ${actualId}`);
|
|
341
|
+
}
|
|
342
|
+
// ▲▲▲ [핵심 수정] ▲▲▲
|
|
343
|
+
|
|
344
|
+
return null; // 배치 업데이트에서 제외
|
|
345
|
+
} catch (err) {
|
|
346
|
+
console.timeEnd(`[DnD] 2b. Read Text File - ${placeholder.FileName}`);
|
|
347
|
+
// ▼▼▼ [디버깅] 오류 상세 로그 ▼▼▼
|
|
348
|
+
console.error(`[DnD] Text processing FAILED for ${placeholder.FileName}:`, err);
|
|
349
|
+
console.error(`[DnD] Error Details:`, {
|
|
350
|
+
name: err.name,
|
|
351
|
+
message: err.message,
|
|
352
|
+
stack: err.stack
|
|
353
|
+
});
|
|
354
|
+
// ▲▲▲ [디버깅] ▲▲▲
|
|
355
|
+
return null;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
case 'pdf':
|
|
359
|
+
default: {
|
|
360
|
+
return {
|
|
361
|
+
NodeId: actualId,
|
|
362
|
+
FileUrl: objectUrl,
|
|
363
|
+
Width: 400,
|
|
364
|
+
Height: 56
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
});
|
|
369
|
+
// ▲▲▲ [수정] ▲▲▲
|
|
370
|
+
|
|
371
|
+
const results = await Promise.allSettled(processingPromises);
|
|
372
|
+
// ▼▼▼ [프로파일링] ▼▼▼
|
|
373
|
+
console.timeEnd('[DnD] 2. Parallel File Processing (All)');
|
|
374
|
+
// ▲▲▲ [프로파일링] ▲▲▲
|
|
375
|
+
|
|
376
|
+
const successfulUpdates = results
|
|
377
|
+
.filter(res => res.status === 'fulfilled' && res.value !== null)
|
|
378
|
+
.map(res => res.value);
|
|
379
|
+
|
|
380
|
+
const failedCount = results.filter(res => res.status === 'rejected' || res.value === null).length;
|
|
381
|
+
console.log(`[MindMapDnD] File processing completed: ${successfulUpdates.length} succeeded, ${failedCount} failed.`);
|
|
382
|
+
|
|
383
|
+
if (successfulUpdates.length > 0) {
|
|
384
|
+
// ▼▼▼ [프로파일링] C# 일괄 업데이트 시간 측정 ▼▼▼
|
|
385
|
+
console.time('[DnD] 3. C# UpdateMultipleFileNodeDetails');
|
|
386
|
+
// ▲▲▲ [프로파일링] ▲▲▲
|
|
387
|
+
try {
|
|
388
|
+
await module.dotNetHelper.invokeMethodAsync('UpdateMultipleFileNodeDetails', successfulUpdates);
|
|
389
|
+
// ▼▼▼ [프로파일링] ▼▼▼
|
|
390
|
+
console.timeEnd('[DnD] 3. C# UpdateMultipleFileNodeDetails');
|
|
391
|
+
console.log(`[MindMapDnD] Batch update sent to C#: ${successfulUpdates.length} nodes.`);
|
|
392
|
+
// ▲▲▲ [프로파일링] ▲▲▲
|
|
393
|
+
} catch (error) {
|
|
394
|
+
// ▼▼▼ [프로파일링] ▼▼▼
|
|
395
|
+
console.timeEnd('[DnD] 3. C# UpdateMultipleFileNodeDetails');
|
|
396
|
+
// ▲▲▲ [프로파일링] ▲▲▲
|
|
397
|
+
console.error('[MindMapDnD] Batch update failed:', error);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
})();
|
|
401
|
+
|
|
402
|
+
return false;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
return {
|
|
406
|
+
addEventListeners: function (moduleInstance) {
|
|
407
|
+
const handlers = getBoundHandlers(moduleInstance);
|
|
408
|
+
if (moduleInstance.cssRenderer && moduleInstance.cssRenderer.domElement) {
|
|
409
|
+
moduleInstance.cssRenderer.domElement.addEventListener('dragover', handlers.boundOnDragOver);
|
|
410
|
+
moduleInstance.cssRenderer.domElement.addEventListener('dragleave', handlers.boundOnDragLeave);
|
|
411
|
+
moduleInstance.cssRenderer.domElement.addEventListener('drop', handlers.boundOnDrop);
|
|
412
|
+
} else if (moduleInstance.renderer && moduleInstance.renderer.domElement) {
|
|
413
|
+
moduleInstance.renderer.domElement.addEventListener('dragover', handlers.boundOnDragOver);
|
|
414
|
+
moduleInstance.renderer.domElement.addEventListener('dragleave', handlers.boundOnDragLeave);
|
|
415
|
+
moduleInstance.renderer.domElement.addEventListener('drop', handlers.boundOnDrop);
|
|
416
|
+
}
|
|
417
|
+
},
|
|
418
|
+
removeEventListeners: function (moduleInstance) {
|
|
419
|
+
const handlers = getBoundHandlers(moduleInstance);
|
|
420
|
+
if (moduleInstance.cssRenderer && moduleInstance.cssRenderer.domElement) {
|
|
421
|
+
moduleInstance.cssRenderer.domElement.removeEventListener('dragover', handlers.boundOnDragOver);
|
|
422
|
+
moduleInstance.cssRenderer.domElement.removeEventListener('dragleave', handlers.boundOnDragLeave);
|
|
423
|
+
moduleInstance.cssRenderer.domElement.removeEventListener('drop', handlers.boundOnDrop);
|
|
424
|
+
} else if (moduleInstance.renderer && moduleInstance.renderer.domElement) {
|
|
425
|
+
moduleInstance.renderer.domElement.removeEventListener('dragover', handlers.boundOnDragOver);
|
|
426
|
+
moduleInstance.renderer.domElement.removeEventListener('dragleave', handlers.boundOnDragLeave);
|
|
427
|
+
moduleInstance.renderer.domElement.removeEventListener('drop', handlers.boundOnDrop);
|
|
428
|
+
}
|
|
429
|
+
eventHandlers.delete(moduleInstance);
|
|
430
|
+
}
|
|
431
|
+
};
|
|
432
|
+
})();
|
|
433
|
+
|
|
434
|
+
console.log('✓ mind-map-dnd.js loaded (Registry-based, plugin-extensible).');
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
// File: mind-map-glow-shader.js
|
|
2
|
+
// [New] SDF-based glow shader - NO TEXTURES, pure GPU math
|
|
3
|
+
// Memory usage: 0 MB (vs hundreds of MBs for per-node textures)
|
|
4
|
+
(function () {
|
|
5
|
+
'use strict';
|
|
6
|
+
|
|
7
|
+
// Shared across all glow materials to avoid per-node time uniform updates.
|
|
8
|
+
const SHARED_TIME_UNIFORM = { value: 0.0 };
|
|
9
|
+
|
|
10
|
+
// ▼▼▼ SDF Glow Shader (Aspect Ratio Corrected) ▼▼▼
|
|
11
|
+
// Uses pixel-based coordinates for uniform glow thickness
|
|
12
|
+
|
|
13
|
+
const GLOW_VERTEX_SHADER = `
|
|
14
|
+
varying vec2 vUv;
|
|
15
|
+
varying vec2 vScale; // Pass scale to fragment shader
|
|
16
|
+
|
|
17
|
+
uniform vec2 meshScale; // Actual mesh size in world units
|
|
18
|
+
|
|
19
|
+
void main() {
|
|
20
|
+
vUv = uv;
|
|
21
|
+
vScale = meshScale;
|
|
22
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
25
|
+
|
|
26
|
+
const GLOW_FRAGMENT_SHADER = `
|
|
27
|
+
precision highp float;
|
|
28
|
+
|
|
29
|
+
varying vec2 vUv;
|
|
30
|
+
varying vec2 vScale;
|
|
31
|
+
|
|
32
|
+
uniform vec3 color;
|
|
33
|
+
uniform float opacity;
|
|
34
|
+
uniform float glowPadding;
|
|
35
|
+
uniform float cornerRadius;
|
|
36
|
+
uniform float time; // ★ Animation time
|
|
37
|
+
|
|
38
|
+
// ★ Simplex noise helper functions
|
|
39
|
+
vec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
|
|
40
|
+
vec2 mod289(vec2 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
|
|
41
|
+
vec3 permute(vec3 x) { return mod289(((x*34.0)+1.0)*x); }
|
|
42
|
+
|
|
43
|
+
float snoise(vec2 v) {
|
|
44
|
+
const vec4 C = vec4(0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439);
|
|
45
|
+
vec2 i = floor(v + dot(v, C.yy));
|
|
46
|
+
vec2 x0 = v - i + dot(i, C.xx);
|
|
47
|
+
vec2 i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);
|
|
48
|
+
vec4 x12 = x0.xyxy + C.xxzz;
|
|
49
|
+
x12.xy -= i1;
|
|
50
|
+
i = mod289(i);
|
|
51
|
+
vec3 p = permute(permute(i.y + vec3(0.0, i1.y, 1.0)) + i.x + vec3(0.0, i1.x, 1.0));
|
|
52
|
+
vec3 m = max(0.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy), dot(x12.zw,x12.zw)), 0.0);
|
|
53
|
+
m = m*m; m = m*m;
|
|
54
|
+
vec3 x = 2.0 * fract(p * C.www) - 1.0;
|
|
55
|
+
vec3 h = abs(x) - 0.5;
|
|
56
|
+
vec3 ox = floor(x + 0.5);
|
|
57
|
+
vec3 a0 = x - ox;
|
|
58
|
+
m *= 1.79284291400159 - 0.85373472095314 * (a0*a0 + h*h);
|
|
59
|
+
vec3 g;
|
|
60
|
+
g.x = a0.x * x0.x + h.x * x0.y;
|
|
61
|
+
g.yz = a0.yz * x12.xz + h.yz * x12.yw;
|
|
62
|
+
return 130.0 * dot(m, g);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Signed Distance Function for rounded rectangle
|
|
66
|
+
float sdRoundedBox(vec2 p, vec2 b, float r) {
|
|
67
|
+
vec2 q = abs(p) - b + r;
|
|
68
|
+
return min(max(q.x, q.y), 0.0) + length(max(q, 0.0)) - r;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
void main() {
|
|
72
|
+
vec2 p = (vUv - 0.5) * vScale;
|
|
73
|
+
vec2 boxSize = (vScale * 0.5) - glowPadding;
|
|
74
|
+
float dist = sdRoundedBox(p, boxSize, cornerRadius);
|
|
75
|
+
|
|
76
|
+
// Keep glow organic, but modulate intensity instead of distorting the edge.
|
|
77
|
+
float noiseFreq = 0.65;
|
|
78
|
+
float noiseSpeed = 0.045;
|
|
79
|
+
float rawNoise = snoise(vUv * noiseFreq + time * noiseSpeed);
|
|
80
|
+
float noiseMod = 1.0 + (rawNoise * 0.08);
|
|
81
|
+
|
|
82
|
+
float aa = max(fwidth(dist), 0.9);
|
|
83
|
+
float outsideDist = max(dist, 0.0);
|
|
84
|
+
float outerFade = 1.0 - smoothstep(0.0, glowPadding + aa * 2.0, outsideDist);
|
|
85
|
+
float innerFade = smoothstep(-aa * 2.0, aa * 2.0, dist);
|
|
86
|
+
float coreBoost = 1.0 - smoothstep(glowPadding * 0.22, glowPadding * 0.78, outsideDist);
|
|
87
|
+
|
|
88
|
+
float alpha = outerFade * innerFade;
|
|
89
|
+
alpha *= mix(0.62, 1.0, coreBoost);
|
|
90
|
+
alpha *= noiseMod;
|
|
91
|
+
|
|
92
|
+
// Corner glow naturally looks heavier; taper it a bit for a softer envelope.
|
|
93
|
+
vec2 q = abs(p) - boxSize;
|
|
94
|
+
float cornerAmount = 0.0;
|
|
95
|
+
if (q.x > 0.0 && q.y > 0.0) {
|
|
96
|
+
cornerAmount = smoothstep(0.0, glowPadding * 0.65, min(q.x, q.y));
|
|
97
|
+
}
|
|
98
|
+
float cornerFactor = 1.0 - cornerAmount * 0.35;
|
|
99
|
+
alpha *= cornerFactor;
|
|
100
|
+
alpha = clamp(alpha, 0.0, 1.0);
|
|
101
|
+
|
|
102
|
+
gl_FragColor = vec4(color, alpha * opacity); // No inversion needed now
|
|
103
|
+
}
|
|
104
|
+
`;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Create SDF glow material with pixel-based uniforms
|
|
108
|
+
* @param {Object} options - Configuration
|
|
109
|
+
* @returns {THREE.ShaderMaterial}
|
|
110
|
+
*/
|
|
111
|
+
function createSDFGlowMaterial(options = {}) {
|
|
112
|
+
const defaultOptions = {
|
|
113
|
+
color: 0x000000,
|
|
114
|
+
opacity: 0.3,
|
|
115
|
+
meshScale: [100, 100], // [width, height] in world units
|
|
116
|
+
glowPadding: 10, // Padding in world units
|
|
117
|
+
cornerRadius: 12 // Corner radius in world units
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const config = { ...defaultOptions, ...options };
|
|
121
|
+
const colorValue = typeof config.color === 'number'
|
|
122
|
+
? new THREE.Color(config.color)
|
|
123
|
+
: config.color;
|
|
124
|
+
|
|
125
|
+
return new THREE.ShaderMaterial({
|
|
126
|
+
transparent: true,
|
|
127
|
+
depthWrite: false,
|
|
128
|
+
depthTest: true,
|
|
129
|
+
uniforms: {
|
|
130
|
+
color: { value: colorValue },
|
|
131
|
+
opacity: { value: config.opacity },
|
|
132
|
+
meshScale: { value: new THREE.Vector2(config.meshScale[0], config.meshScale[1]) },
|
|
133
|
+
glowPadding: { value: config.glowPadding },
|
|
134
|
+
cornerRadius: { value: config.cornerRadius },
|
|
135
|
+
time: SHARED_TIME_UNIFORM // ★ Shared animation time uniform
|
|
136
|
+
},
|
|
137
|
+
vertexShader: GLOW_VERTEX_SHADER,
|
|
138
|
+
fragmentShader: GLOW_FRAGMENT_SHADER
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Create or update glow mesh using SDF shader (pixel-based)
|
|
144
|
+
* @param {number} width - Node width (world units)
|
|
145
|
+
* @param {number} height - Node height (world units)
|
|
146
|
+
* @param {boolean} isSelected - Selection state
|
|
147
|
+
* @param {string} contentType - Node content type ('image' = sharp corners)
|
|
148
|
+
* @param {THREE.Mesh} [existingMesh] - Existing glow mesh to update
|
|
149
|
+
* @returns {THREE.Mesh}
|
|
150
|
+
*/
|
|
151
|
+
function createSDFGlowMesh(width, height, isSelected = false, contentType = 'text', existingMesh = null) {
|
|
152
|
+
const GLOW_PADDING = 12;
|
|
153
|
+
const GLOW_INSET = 4; // ★ Start glow 4px inside node edge to avoid border artifacts
|
|
154
|
+
const CORNER_RADIUS = 0; // No rounded corners
|
|
155
|
+
|
|
156
|
+
const glowWidth = width + GLOW_PADDING * 2 - GLOW_INSET * 2;
|
|
157
|
+
const glowHeight = height + GLOW_PADDING * 2 - GLOW_INSET * 2;
|
|
158
|
+
|
|
159
|
+
if (existingMesh) {
|
|
160
|
+
if (existingMesh.geometry) existingMesh.geometry.dispose();
|
|
161
|
+
existingMesh.geometry = new THREE.PlaneGeometry(glowWidth, glowHeight);
|
|
162
|
+
|
|
163
|
+
const uniforms = existingMesh.material.uniforms;
|
|
164
|
+
uniforms.color.value.setHex(isSelected ? 0x2563eb : 0xaaaaaa); // Blue or lighter gray
|
|
165
|
+
uniforms.opacity.value = isSelected ? 0.4 : 0.5; // Less intense selected glow
|
|
166
|
+
uniforms.meshScale.value.set(glowWidth, glowHeight);
|
|
167
|
+
uniforms.glowPadding.value = GLOW_PADDING - GLOW_INSET;
|
|
168
|
+
uniforms.cornerRadius.value = CORNER_RADIUS;
|
|
169
|
+
|
|
170
|
+
return existingMesh;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const geometry = new THREE.PlaneGeometry(glowWidth, glowHeight);
|
|
174
|
+
const material = createSDFGlowMaterial({
|
|
175
|
+
color: isSelected ? 0x2563eb : 0xaaaaaa, // Blue or lighter gray
|
|
176
|
+
opacity: isSelected ? 0.4 : 0.5, // Less intense selected glow
|
|
177
|
+
meshScale: [glowWidth, glowHeight],
|
|
178
|
+
glowPadding: GLOW_PADDING - GLOW_INSET,
|
|
179
|
+
cornerRadius: CORNER_RADIUS
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
const mesh = new THREE.Mesh(geometry, material);
|
|
183
|
+
mesh.name = 'glow';
|
|
184
|
+
mesh.raycast = () => { };
|
|
185
|
+
mesh.visible = false; // ★ 기본 숨김 - LOD 시스템이 카메라 거리에 따라 활성화
|
|
186
|
+
|
|
187
|
+
return mesh;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Update glow mesh for selection state change
|
|
192
|
+
* @param {THREE.Mesh} glowMesh - Existing glow mesh
|
|
193
|
+
* @param {boolean} isSelected - New selection state
|
|
194
|
+
*/
|
|
195
|
+
function updateGlowSelection(glowMesh, isSelected) {
|
|
196
|
+
if (!glowMesh || !glowMesh.material || !glowMesh.material.uniforms) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
const uniforms = glowMesh.material.uniforms;
|
|
201
|
+
uniforms.color.value.setHex(isSelected ? 0x2563eb : 0xaaaaaa); // Blue or lighter gray
|
|
202
|
+
uniforms.opacity.value = isSelected ? 0.4 : 0.5; // Less intense selected glow
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Update glow mesh size (for node resize)
|
|
207
|
+
* @param {THREE.Mesh} glowMesh - Existing glow mesh
|
|
208
|
+
* @param {number} nodeWidth - New node width
|
|
209
|
+
* @param {number} nodeHeight - New node height
|
|
210
|
+
* @param {string} contentType - Node content type ('image' = sharp corners)
|
|
211
|
+
*/
|
|
212
|
+
function updateGlowSize(glowMesh, nodeWidth, nodeHeight, contentType = 'text') {
|
|
213
|
+
if (!glowMesh) return;
|
|
214
|
+
|
|
215
|
+
const GLOW_PADDING = 12;
|
|
216
|
+
const GLOW_INSET = 4; // ★ Start glow 4px inside node edge
|
|
217
|
+
const CORNER_RADIUS = 0; // No rounded corners
|
|
218
|
+
const glowWidth = nodeWidth + GLOW_PADDING * 2 - GLOW_INSET * 2;
|
|
219
|
+
const glowHeight = nodeHeight + GLOW_PADDING * 2 - GLOW_INSET * 2;
|
|
220
|
+
|
|
221
|
+
if (glowMesh.geometry) glowMesh.geometry.dispose();
|
|
222
|
+
glowMesh.geometry = new THREE.PlaneGeometry(glowWidth, glowHeight);
|
|
223
|
+
|
|
224
|
+
if (glowMesh.material.uniforms) {
|
|
225
|
+
glowMesh.material.uniforms.meshScale.value.set(glowWidth, glowHeight);
|
|
226
|
+
glowMesh.material.uniforms.glowPadding.value = GLOW_PADDING - GLOW_INSET;
|
|
227
|
+
glowMesh.material.uniforms.cornerRadius.value = CORNER_RADIUS;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Update time uniform for glow animation
|
|
233
|
+
* Call this from the render loop
|
|
234
|
+
* @param {THREE.Mesh} glowMesh - Glow mesh to update
|
|
235
|
+
* @param {number} time - Current time in seconds
|
|
236
|
+
*/
|
|
237
|
+
function updateGlowTime(glowMesh, time) {
|
|
238
|
+
setTime(time);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Update shared time uniform for all glow meshes in O(1).
|
|
243
|
+
* @param {number} time - Current time in seconds
|
|
244
|
+
*/
|
|
245
|
+
function setTime(time) {
|
|
246
|
+
SHARED_TIME_UNIFORM.value = time;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// Expose API globally
|
|
250
|
+
window.MindMapGlowShader = {
|
|
251
|
+
createSDFGlowMaterial,
|
|
252
|
+
createSDFGlowMesh,
|
|
253
|
+
updateGlowSelection,
|
|
254
|
+
updateGlowSize,
|
|
255
|
+
updateGlowTime, // Backward compatibility
|
|
256
|
+
setTime
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
console.log('✅ mind-map-glow-shader.js loaded (SDF Glow - No Textures!)');
|
|
260
|
+
})();
|