add welcome dialog
This commit is contained in:
parent
094d4ba7c9
commit
87c36e1949
6 changed files with 72 additions and 8 deletions
|
|
@ -30,6 +30,6 @@
|
||||||
|
|
||||||
* `C` add preferences for normal length and color
|
* `C` add preferences for normal length and color
|
||||||
* `-` add preferences for face selection and matching
|
* `-` add preferences for face selection and matching
|
||||||
* `-` svg and image import conversion (share code with Kiri:Moto)
|
* `-` add svg and image import conversion (share code with Kiri:Moto)
|
||||||
* `-` add version chooser
|
* `C` add version chooser
|
||||||
* `-` welcome help menu
|
* `-` add welcome menu
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ gapp.register("kiri.main", [], (root, exports) => {
|
||||||
on(t,l) { return EVENT.on(t,l) },
|
on(t,l) { return EVENT.on(t,l) },
|
||||||
emit(t,m,o) { return EVENT.publish(t,m,o) },
|
emit(t,m,o) { return EVENT.publish(t,m,o) },
|
||||||
bind(t,m,o) { return EVENT.bind(t,m,o) },
|
bind(t,m,o) { return EVENT.bind(t,m,o) },
|
||||||
alerts() { api.alerts.update() },
|
alerts(clr) { api.alerts.update(clr) },
|
||||||
import: loadFile,
|
import: loadFile,
|
||||||
settings: triggerSettingsEvent
|
settings: triggerSettingsEvent
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ const { broker } = gapp;
|
||||||
const { moto } = root;
|
const { moto } = root;
|
||||||
const { space } = moto;
|
const { space } = moto;
|
||||||
|
|
||||||
|
const version = '1.0.0';
|
||||||
const call = broker.send;
|
const call = broker.send;
|
||||||
const dbindex = [ "admin", "space" ];
|
const dbindex = [ "admin", "space" ];
|
||||||
|
|
||||||
|
|
@ -144,6 +145,9 @@ function restore_space() {
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
// hide loading curtain
|
// hide loading curtain
|
||||||
$d('curtain','none');
|
$d('curtain','none');
|
||||||
|
if (api.prefs.map.info.welcome !== false) {
|
||||||
|
api.welcome(version);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -273,7 +277,7 @@ function space_init(data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (evt.key === '?') {
|
if (evt.key === '?') {
|
||||||
return api.help();
|
return api.welcome(version);
|
||||||
}
|
}
|
||||||
let { shiftKey, metaKey, ctrlKey, code } = evt;
|
let { shiftKey, metaKey, ctrlKey, code } = evt;
|
||||||
switch (code) {
|
switch (code) {
|
||||||
|
|
@ -532,7 +536,6 @@ function set_normals_length(length) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_normals_color(color) {
|
function set_normals_color(color) {
|
||||||
console.log({color});
|
|
||||||
let { prefs } = mesh.api;
|
let { prefs } = mesh.api;
|
||||||
let { map } = prefs;
|
let { map } = prefs;
|
||||||
if (map.space.dark) {
|
if (map.space.dark) {
|
||||||
|
|
|
||||||
|
|
@ -176,6 +176,37 @@ const log = api.log = {
|
||||||
// bind endpoint for worker to log in the ui
|
// bind endpoint for worker to log in the ui
|
||||||
gapp.broker.subscribe("mesh.log", log.emit);
|
gapp.broker.subscribe("mesh.log", log.emit);
|
||||||
|
|
||||||
|
// welcome dialog
|
||||||
|
api.welcome = function(version = "unknown") {
|
||||||
|
const { prefs } = api;
|
||||||
|
const { map } = prefs;
|
||||||
|
modal.show('About Mesh:Tool', h.div({ class:"welcome" }, [
|
||||||
|
h.a({
|
||||||
|
target: "docs",
|
||||||
|
_: "Guide & Documentation",
|
||||||
|
href: "https://docs.grid.space/projects/mesh-tool"
|
||||||
|
}),
|
||||||
|
h.a({
|
||||||
|
target: "docs",
|
||||||
|
_: "Grid.Space",
|
||||||
|
href: "https://grid.space/"
|
||||||
|
}),
|
||||||
|
h.div(`Version: ${version}`),
|
||||||
|
h.hr({ width: "100%" }),
|
||||||
|
h.div({ class: "choice" }, [
|
||||||
|
h.input({
|
||||||
|
type: "checkbox",
|
||||||
|
[ map.info.welcome !== false ? 'checked' : 'unchecked' ] : 1,
|
||||||
|
onchange: (ev) => {
|
||||||
|
map.info.welcome = ev.target.checked;
|
||||||
|
prefs.save();
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
h.div("show at startup")
|
||||||
|
]),
|
||||||
|
]));
|
||||||
|
};
|
||||||
|
|
||||||
// bind settings endpoint to api
|
// bind settings endpoint to api
|
||||||
api.settings = function() {
|
api.settings = function() {
|
||||||
const { util } = mesh;
|
const { util } = mesh;
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ gapp.overlay(root, {
|
||||||
});
|
});
|
||||||
|
|
||||||
// add common element types
|
// add common element types
|
||||||
["a", "i", "div", "span", "label", "input", "button", "svg"].forEach(type => {
|
["a", "i", "hr", "div", "span", "label", "input", "button", "svg"].forEach(type => {
|
||||||
h[type] = (attr, innr) => {
|
h[type] = (attr, innr) => {
|
||||||
return h.el(type, attr, innr);
|
return h.el(type, attr, innr);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,12 @@ body, div {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
background-color: #eee;
|
||||||
|
border-radius: 3px;
|
||||||
|
border: 1px solid black;
|
||||||
|
}
|
||||||
|
|
||||||
#app {
|
#app {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
@ -230,7 +236,7 @@ button:hover {
|
||||||
|
|
||||||
#modal_frame {
|
#modal_frame {
|
||||||
border-radius: 4px !important;
|
border-radius: 4px !important;
|
||||||
background-color: rgba(255,255,255,0.9) !important;
|
background-color: #fff !important;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
padding: 0 !important; /* override common below */
|
padding: 0 !important; /* override common below */
|
||||||
z-index: 51;
|
z-index: 51;
|
||||||
|
|
@ -264,6 +270,30 @@ button:hover {
|
||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** welcome dialog **/
|
||||||
|
|
||||||
|
.welcome {
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
padding: 5px;
|
||||||
|
gap: 5px;
|
||||||
|
font-size: smaller;
|
||||||
|
}
|
||||||
|
|
||||||
|
.welcome a {
|
||||||
|
color: #038;
|
||||||
|
border-radius: 3px;
|
||||||
|
padding: 0 10px 0 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.welcome a:hover {
|
||||||
|
background-color: #ddd;
|
||||||
|
}
|
||||||
|
|
||||||
|
.welcome .choice {
|
||||||
|
gap: 5px
|
||||||
|
}
|
||||||
|
|
||||||
/** settings dialog **/
|
/** settings dialog **/
|
||||||
|
|
||||||
.settings {
|
.settings {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue