Merge pull request #5 from stockholmux/filename-based-download

Filename based download
This commit is contained in:
Torsten Paul 2023-07-02 22:56:20 +02:00 • committed by GitHub
commit cda84d6eb6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -29,7 +29,6 @@ Licenses: see [LICENSES](./LICENSE).
- Rebuild w/ (and sync) ochafik@'s filtered kernel (https://github.com/openscad/openscad/pull/4160) to fix(ish) 2D operations
- Replace Makefile w/ something that reads the libs metadata
- Proper Preview rendering: have OpenSCAD export the preview scene to a rich format (e.g. glTF, with some parts being translucent when prefixed w/ % modifier) and display it using https://modelviewer.dev/ maybe)
- Better names for downloads (matching source)
- Model /home fs in shared state. have two clear paths: /libraries for builtins, and /home for user data. State pointing to /libraries paths needs not store the data except if there's overrides (flagged as modifications in the file picker)
- Drag and drop of files (SCAD, STL, etc) and Zip archives. For assets, auto insert the corresponding import.
- Fuller PWA support w/ link Sharing, File opening / association to *.scad files...

View file

@ -15,8 +15,9 @@ import { confirmDialog } from 'primereact/confirmdialog';
function downloadOutput(state: State) {
if (!state.output) return;
const fileName = state.output!.isPreview ? 'preview.stl' : 'render.stl';
const sourcePathParts = state.params.sourcePath.split('/');
const sourceFileName = sourcePathParts.slice(-1)[0];
const fileName = [sourceFileName, state.output!.isPreview ? 'preview.stl' : 'render.stl'].join('.');
const doDownload = () => {
const a = document.createElement('a')
a.href = state.output!.stlFileURL