add welcome dialog
This commit is contained in:
parent
094d4ba7c9
commit
87c36e1949
6 changed files with 72 additions and 8 deletions
|
|
@ -105,7 +105,7 @@ gapp.register("kiri.main", [], (root, exports) => {
|
|||
on(t,l) { return EVENT.on(t,l) },
|
||||
emit(t,m,o) { return EVENT.publish(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,
|
||||
settings: triggerSettingsEvent
|
||||
},
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ const { broker } = gapp;
|
|||
const { moto } = root;
|
||||
const { space } = moto;
|
||||
|
||||
const version = '1.0.0';
|
||||
const call = broker.send;
|
||||
const dbindex = [ "admin", "space" ];
|
||||
|
||||
|
|
@ -144,6 +145,9 @@ function restore_space() {
|
|||
}).finally(() => {
|
||||
// hide loading curtain
|
||||
$d('curtain','none');
|
||||
if (api.prefs.map.info.welcome !== false) {
|
||||
api.welcome(version);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -273,7 +277,7 @@ function space_init(data) {
|
|||
return;
|
||||
}
|
||||
if (evt.key === '?') {
|
||||
return api.help();
|
||||
return api.welcome(version);
|
||||
}
|
||||
let { shiftKey, metaKey, ctrlKey, code } = evt;
|
||||
switch (code) {
|
||||
|
|
@ -532,7 +536,6 @@ function set_normals_length(length) {
|
|||
}
|
||||
|
||||
function set_normals_color(color) {
|
||||
console.log({color});
|
||||
let { prefs } = mesh.api;
|
||||
let { map } = prefs;
|
||||
if (map.space.dark) {
|
||||
|
|
|
|||
|
|
@ -176,6 +176,37 @@ const log = api.log = {
|
|||
// bind endpoint for worker to log in the ui
|
||||
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
|
||||
api.settings = function() {
|
||||
const { util } = mesh;
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ gapp.overlay(root, {
|
|||
});
|
||||
|
||||
// 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) => {
|
||||
return h.el(type, attr, innr);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue