mesh css simplification

This commit is contained in:
Stewart Allen 2021-12-26 22:00:31 -05:00
commit 44933dd1b4
9 changed files with 115 additions and 141 deletions

13
app.js
View file

@ -228,10 +228,10 @@ const script = {
"ext/three-svg",
"ext/jszip",
"add/license",
"ext/clip2", // work.test
"ext/clip2",
"ext/tween",
"ext/fsave",
"ext/earcut", // work.test
"ext/earcut",
"ext/base64",
"add/array",
"add/three",
@ -258,7 +258,7 @@ const script = {
"moto/load-url",
"moto/load-file",
"moto/broker",
"moto/db",
"moto/idb",
"kiri/ui",
"kiri/do",
"kiri/lang",
@ -421,7 +421,7 @@ const script = {
"moto/space",
"moto/load-obj",
"moto/load-stl",
"moto/db",
"moto/idb",
"moto/ui",
"kiri/catalog",
"main/meta"
@ -437,7 +437,6 @@ const script = {
"ext/fsave",
"add/array",
"add/three",
"geo/mesh",
"moto/ctrl",
"moto/space",
"moto/load-3mf",
@ -447,7 +446,7 @@ const script = {
"moto/load-url",
"moto/load-file",
"moto/broker",
"moto/db"
"moto/idb"
],
mesh_work : [
"moto/worker",
@ -468,6 +467,8 @@ const script = {
"geo/polygon",
"geo/polygons",
"geo/mesh",
"moto/broker",
"moto/idb"
]
};

View file

@ -4,7 +4,7 @@
(function() {
let MOTO = self.moto = self.moto || {},
let moto = self.moto = self.moto || {},
time = function() { return new Date().getTime() },
restarting = false,
running = {},
@ -12,8 +12,10 @@ let MOTO = self.moto = self.moto || {},
worker = null,
seqid = 1;
if (moto.client) return;
/**
* @param {Function} fn name of function in MOTO.worker
* @param {Function} fn name of function in moto.worker
* @param {Object} data to send to server
* @param {Function} onreply function to call on reply messages
* @param {Object[]} zerocopy array of objects to pass using zerocopy
@ -39,7 +41,7 @@ function send(fn, data, onreply, zerocopy) {
}
// code is running in the browser / client context
let CLIENT = MOTO.client = {
let client = moto.client = {
send: send,
// factory can be overridden
@ -69,7 +71,7 @@ let CLIENT = MOTO.client = {
// same as restart
start: function(url) {
CLIENT.restart(url);
client.restart(url);
},
restart: function(url) {
@ -78,7 +80,7 @@ let CLIENT = MOTO.client = {
return;
}
CLIENT.stop();
client.stop();
restarting = true;
@ -90,15 +92,20 @@ let CLIENT = MOTO.client = {
}
running = {};
worker = CLIENT.newWorker(url);
worker = client.newWorker(url);
// bind to CLIENT to enable synth injections
CLIENT.onmessage = worker.onmessage = function(e) {
// bind to client to enable synth injections
client.onmessage = worker.onmessage = function(e) {
let now = time(),
reply = e.data,
record = running[reply.seq],
onreply = record ? record.fn : undefined;
if (reply.register) {
// console.log({register: reply.register});
return;
}
if (reply.done) {
delete running[reply.seq];
}

View file

@ -4,10 +4,10 @@
(function() {
if (!self.moto) self.moto = {};
if (self.moto.Storage) return;
let moto = self.moto = self.moto || {};
if (moto.IDB) return;
self.moto.Storage = Storage;
moto.IDB = moto.Storage = Storage;
// https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API

View file

@ -4,14 +4,9 @@
(function() {
if (!self.moto) self.moto = {};
if (self.moto.KV) return;
let moto = self.moto = self.moto = {};
if (moto.KV) return;
/**
* @param {String} dbname
* @param {number} [version]
* @constructor
*/
function KV() {
this.__data__ = {};
this.__mem__ = true;
@ -33,22 +28,18 @@
};
KP.clear = function() {
var d = this.__data__, key;
for (key in d) {
if (d.hasOwnProperty(key)) {
delete d[key];
delete this[key];
}
}
this.__data__ = {};
};
try {
self.moto.KV = self.localStorage;
self.moto.KV.setItem('__test', 1);
self.moto.KV.getItem('__test');
let KV = moto.KV = self.localStorage,
testkey = '__test';
KV.setItem(testkey, 1);
KV.getItem(testkey);
KV.removeItem(testkey);
} catch (e) {
self.moto.KV = new KV();
let msg = "in private or restricted browsing mode. local storage blocked. application may not function.";
moto.KV = new KV();
let msg = "in private or restricted browsing mode. local storage blocked. application may not function properly.";
console.log(msg);
alert(msg);
}

View file

@ -4,29 +4,48 @@
(function() {
let MOTO = self.moto = self.moto || {},
let moto = self.moto = self.moto || {},
time = Date.now;
if (moto.worker) return;
// allow license to inject module
self.gapp = self.gapp || MOTO;
self.gapp = self.gapp || moto;
let isinit = false;
let endpoints = {};
// code is running in the worker / server context
const dispatch = MOTO.worker = {
const dispatch = moto.worker = {
register: (name, fn) => {
endpoints[name] = fn;
sync(name);
},
send: (msg) => {
self.postMessage(msg);
},
sync: (name) => {
if (name) {
if (isinit) dispatch.send({register: [name]});
} else {
dispatch.send({register: Object.keys(endpoints)});
}
},
onmessage: (e) => {
if (e.data === '--init--') {
console.log('worker got init');
isinit = true;
dispatch.sync();
return;
}
let time_recv = time(),
msg = e.data || {},
run = dispatch[msg.task],
run = endpoints[msg.task],
send = {
data : function(data,direct) {
dispatch.send({

View file

@ -9,7 +9,7 @@
}
@font-face {
font-family: 'Russo One';
src: url('ext/russo-one.ttf');
src: url('/moto/russo-one.ttf');
}
a, a:hover, a:visited {
border: none;

View file

@ -10,7 +10,7 @@
@font-face {
font-family: 'Russo One';
src: url('/kiri/ext/russo-one.ttf');
src: url('/moto/russo-one.ttf');
}
a, a:hover, a:visited {
@ -19,7 +19,7 @@ a, a:hover, a:visited {
text-decoration: none;
}
div {
body, div {
position: relative;
display: flex;
padding: 0;
@ -30,20 +30,24 @@ div {
#app {
position: fixed;
overflow: hidden;
font-weight: normal;
flex-direction: column;
font-family: sans-serif;
font-weight: normal;
font-size: larger;
top: 0;
left: 0;
right: 0;
bottom: 0;
right: 0;
left: 0;
top: 0;
}
#app-info {
z-index: 50;
top: 50%;
left: 50%;
transform: translateX(-50%) translateY(-50%);
z-index: 50;
cursor: pointer;
flex-direction: column;
align-items: center;
}
#app-info:hover #app-vers {
@ -67,24 +71,58 @@ div {
background-color: white;
}
#app-info {
cursor: pointer;
#app-body {
flex-grow: 1;
}
#app-body > div {
z-index: 2;
}
#curtain {
z-index: 50000;
top: 0;
left: 0;
right: 0;
bottom: 0;
position: fixed;
background-color: #fff;
font-family: 'Russo One', sans-serif;
justify-content: center;
align-items: center;
}
#container {
z-index: 1;
position: fixed;
width: 100%;
height: 100%;
}
#container canvas {
width: 100%;
height: 100%;
overflow: hidden;
}
#top {
z-index: 2;
padding: 3px;
flex-direction: row;
font-family: 'Russo One', sans-serif;
background-color: rgba(255,255,255,0.75);
}
#top > div {
margin: 0 5px 0 5px;
}
#top-sep {
z-index: 14;
z-index: 2;
height: 1px;
background-image: var(--gradbar);
}
#loading {
width: 40px;
height: 40px;
padding-right: 15px;
position: fixed;
display: none;
}
.noselect {
-khtml-user-select: none;
-moz-user-select: none;
@ -92,52 +130,6 @@ div {
user-select: none;
}
.hide {
display: none !important;
}
.noshow {
display: none;
}
.grid {
display: grid;
}
.f-row {
flex-direction: row;
}
.f-col {
flex-direction: column;
}
.grow {
flex-grow: 1;
}
.a-start {
align-items: flex-start;
}
.a-center {
align-items: center;
}
.a-end {
align-items: flex-end;
}
.a-stretch {
align-items: stretch;
}
.j-start {
justify-content: flex-start;
}
.j-center {
justify-content: center;
}
.j-end {
justify-content: flex-end;
}
.center {
text-align: center;
}
.russo {
font-family: 'Russo One', sans-serif;
}
:-moz-any() {
overflow-x: hidden !important;
overflow-y: hidden !important;
@ -148,38 +140,3 @@ div {
margin-right: -14px !important;
margin-bottom: -14px !important;
}
#curtain {
top: 0;
left: 0;
right: 0;
bottom: 0;
position: fixed;
background-color: #fff;
font-family: 'Russo One', sans-serif;
z-index: 50000;
}
#container {
position: fixed;
z-index: -1;
width: 100%;
height: 100%;
}
#container canvas {
width: 100%;
height: 100%;
overflow: hidden;
}
#top {
font-family: 'Russo One', sans-serif;
background-color: rgba(255,255,255,0.75);
padding: 3px;
z-index: 15;
}
#top > div {
margin: 0 5px 0 5px;
}

View file

@ -6,29 +6,28 @@
<meta name="keywords" content="3d,mesh,editor,stl,obj,3mf" />
<meta name="copyright" content="stewart allen [sa@grid.space]">
<meta name="description" content="Browser-based 3D Mesh Editor">
<meta property="og:description" content="Mesh:Tool is browser-based 3D Mesh Editor">
<meta property="og:title" content="Browser-based 3D Mesh Editor">
<meta property="og:description" content="Mesh:Tool is a browser-based 3D Mesh Editor">
<meta property="og:title" content="Browser-based Mesh Editor">
<meta property="og:type" content="website">
<meta property="og:url" content="https://grid.space/mesh/">
<meta property="og:image" content="https://static.grid.space/img/logo_km_og.png">
<title>Mesh:Tool</title>
<link rel="icon" href="/kiri/favicon.ico">
<link rel="apple-touch-icon" href="/kiri/favicon-mobile.png">
<link rel="icon" href="/mesh/favicon.ico">
<link rel="stylesheet" type="text/css" href="/mesh/index.css?{{version}}">
<link href="/font/css/all.min.css" rel="stylesheet">
<script src="/font/js/all.min.js" crossorigin="anonymous"></script>
<script src="/code/mesh.js?{{version}}"></script>
</head>
<body>
<div id="app" class="f-col">
<div id="curtain" class="j-center a-center"><img id="loading"/>loading...</div>
<div id="app">
<div id="curtain"><img id="loading"/>loading...</div>
<div id="container"></div>
<div id="top" class="f-row">
<div id="app-info" class="f-col a-center">
<div><div id="app-name"></div><div id="app-vers">version</div></div>
<div id="top">
<div id="app-info">
<div id="app-name"></div><div id="app-vers">version</div>
</div>
</div>
<div id="top-sep"></div>
<div id="app-body"></div>
</div>
</body>
</html>