diff --git a/README.md b/README.md index 8e53584..72be8f3 100644 --- a/README.md +++ b/README.md @@ -23,9 +23,9 @@ in a web browser. The [example](example) is a fully working project that shows how to use the viewer. You can play with the latest -demo [here](https://yeicor-3d.github.io/yet-another-cad-viewer/?preload=logo.glb&preload=logo_hl.glb&preload=fox.glb&preload=img.jpg.glb&preload=location.glb) +demo [here](https://yeicor-3d.github.io/yet-another-cad-viewer/?preload=logo.glb&preload=logo_hl.glb&preload=logo_hl_tex.glb&preload=fox.glb&preload=img.jpg.glb&preload=location.glb) (or -[without animation](https://yeicor-3d.github.io/yet-another-cad-viewer/?autoplay=false&preload=logo.glb&preload=logo_hl.glb&preload=fox.glb&preload=img.jpg.glb&preload=location.glb)). +[without animation](https://yeicor-3d.github.io/yet-another-cad-viewer/?autoplay=false&preload=logo.glb&preload=logo_hl.glb&preload=logo_hl_tex.glb&preload=fox.glb&preload=img.jpg.glb&preload=location.glb)). ![Demo](assets/screenshot.png) diff --git a/frontend/App.vue b/frontend/App.vue index 130522e..a2d560f 100644 --- a/frontend/App.vue +++ b/frontend/App.vue @@ -108,6 +108,23 @@ async function loadModelManual() { const modelUrl = prompt("For an improved experience in viewing CAD/GLTF models with automatic updates, it's recommended to use the official yacv_server Python package. This ensures seamless serving of models and automatic updates.\n\nOtherwise, enter the URL of the model to load:"); if (modelUrl) await networkMgr.load(modelUrl); } + +// Detect dropped .glb files and load them manually +document.body.addEventListener("dragover", e => { + e.preventDefault(); // Allow drop +}); + +document.body.addEventListener("drop", async e => { + e.preventDefault(); + const file = e.dataTransfer?.files?.[0]; + if (!file) return; + + const ext = file.name.split('.').pop()?.toLowerCase(); + if (ext === 'glb' || ext === 'gltf') { + await networkMgr.load(file); + } +}); +