From 2dcb08e2b9f13660eb6c49ab1cbc396a698aaa68 Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Fri, 31 May 2024 13:42:24 -0400 Subject: [PATCH] improve workspace export --- src/kiri/init.js | 52 +++++++++++++++++++++++----------------------- web/kiri/index.css | 14 ++++++++++++- 2 files changed, 39 insertions(+), 27 deletions(-) diff --git a/src/kiri/init.js b/src/kiri/init.js index e5546df0..568d62f5 100644 --- a/src/kiri/init.js +++ b/src/kiri/init.js @@ -618,34 +618,34 @@ gapp.register("kiri.init", [], (root, exports) => { }); } - function profileExport(workspace) { - let checked = workspace ? ' checked' : ''; + function profileExport() { const opt = {pre: [ - "
", - `

${workspace ? "Workspace" : "Profile"} Export

`, - " ", - workspace ? - " " : - "
", - `
`, - `  include workspace`, - "
", + "
", + "

Workspace Export

", + " ", + " ", + "  Exclude meshes", "
" ]}; - uc.confirm("Export Filename", {ok:true, cancel: false}, "workspace", opt).then(name => { - if (name) { - let work = $('incwork').checked; - let json = api.conf.export({work, clear:true}); + let suggestion = "workspace"; + let file = api.widgets.all()[0]?.meta.file || ''; + if (file) { + suggestion = `${suggestion}_${file.split('.')[0]}`.replaceAll(' ','_'); + }; + uc.confirm("Filename", {ok:true, cancel: false}, suggestion, opt).then(name => { + if (!name) return; - kiri.client.zip([ - {name:"workspace.json", data:JSON.stringify(json)} - ], progress => { - api.show.progress(progress.percent/100, "compressing workspace"); - }, output => { - api.show.progress(0); - api.util.download(output, `${name}.kmz`); - }); - } + let work = !$('excwork').checked; + let json = api.conf.export({work, clear:true}); + + kiri.client.zip([ + {name:"workspace.json", data:JSON.stringify(json)} + ], progress => { + api.show.progress(progress.percent/100, "compressing workspace"); + }, output => { + api.show.progress(0); + api.util.download(output, `${name}.kmz`); + }); }); } @@ -2907,9 +2907,9 @@ gapp.register("kiri.init", [], (root, exports) => { { let { event } = api; let next = 0; - let list = ['rotate','scale','mesh','select']; + let list = ['rotate','scale','mesh']; event.on("tool.next", () => { - event.emit("tool.show", list[next++ % 4]); + event.emit("tool.show", list[next++ % list.length]); }); event.on("tool.show", tictac => { if (typeof(tictac) === 'string') { diff --git a/web/kiri/index.css b/web/kiri/index.css index 1b04ff84..39da4b94 100644 --- a/web/kiri/index.css +++ b/web/kiri/index.css @@ -418,6 +418,12 @@ th, tr, td, label { .gap3 { gap: 3px; } +.gap4 { + gap: 4px; +} +.gap5 { + gap: 5px; +} .grid { display: grid; } @@ -492,6 +498,12 @@ th, tr, td, label { .mh85 { max-height: 85%; } +.mlr10 { + margin: 0 10px 0 10px; +} +.mt10 { + margin-top: 5px; +} :-moz-any() { overflow-x: hidden !important; @@ -787,7 +799,7 @@ th, tr, td, label { #float-tools { position: absolute; margin: 0 0 0 5px; - top: 35px; + top: 50px; left: 50%; transform: translateX(-50%); z-index: 16;