km: improve dark mode / switching. mt: add worker log to ui
This commit is contained in:
parent
56454d7d24
commit
d0d9e99ede
5 changed files with 39 additions and 9 deletions
|
|
@ -1879,16 +1879,19 @@
|
|||
gridMinor = unitMM ? 5 : 25.4 / 10;
|
||||
if (updateDark) {
|
||||
if (ctrl.dark) {
|
||||
SPACE.platform.setGrid(gridMajor, gridMinor, 0x999999, 0x333333);
|
||||
SPACE.platform.opacity(0.8);
|
||||
SPACE.platform.setFont({rulerColor:'#888888'});
|
||||
SPACE.platform.setGrid(gridMajor, gridMinor, 0x666666, 0x333333);
|
||||
SPACE.platform.opacity(0.05);
|
||||
SPACE.sky.setColor(0);
|
||||
DOC.body.classList.add('dark');
|
||||
} else {
|
||||
SPACE.platform.setFont({rulerColor:'#333333'});
|
||||
SPACE.platform.setGrid(gridMajor, gridMinor, 0x999999, 0xcccccc);
|
||||
SPACE.platform.opacity(0.2);
|
||||
SPACE.sky.setColor(0xffffff);
|
||||
DOC.body.classList.remove('dark');
|
||||
}
|
||||
SPACE.platform.setSize();
|
||||
}
|
||||
SPACE.platform.setRulers(ruler, ruler, 1 / unitScale(), 'X', isBelt ? 'Z' : 'Y');
|
||||
// SPACE.platform.setGZOff(height/2 - 0.1);
|
||||
|
|
|
|||
|
|
@ -122,6 +122,9 @@ let log = mesh.api.log = {
|
|||
},
|
||||
};
|
||||
|
||||
// bind endpoint for worker to log in the ui
|
||||
gapp.broker.subscribe("mesh.log", log.emit);
|
||||
|
||||
// create html elements
|
||||
function ui_build() {
|
||||
// set app version
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ if (moto.client) return;
|
|||
|
||||
gapp.register('moto.client', [
|
||||
"add.array", // dep: add.array
|
||||
"moto.broker", // dep: moto.broker
|
||||
]);
|
||||
|
||||
function dispatch(topic, message) {
|
||||
|
|
@ -211,6 +212,12 @@ let client = moto.client = {
|
|||
return;
|
||||
}
|
||||
|
||||
// handle special case for broker publish
|
||||
if (reply.publish) {
|
||||
gapp.broker.publish(reply.publish, reply.message);
|
||||
return;
|
||||
}
|
||||
|
||||
if (worker.run === null) {
|
||||
console.log({client_unhandled: e});
|
||||
throw "message on idle worker";
|
||||
|
|
|
|||
|
|
@ -78,6 +78,9 @@
|
|||
yon: undefined,
|
||||
factor: undefined,
|
||||
view: undefined
|
||||
},
|
||||
psize = {
|
||||
|
||||
},
|
||||
timers = {},
|
||||
fontColor = '#333333',
|
||||
|
|
@ -253,11 +256,17 @@
|
|||
requestRefresh();
|
||||
}
|
||||
|
||||
function setPlatformSize(width, depth, height, maxz) {
|
||||
function setPlatformSize(
|
||||
width = psize.width || 300,
|
||||
depth = psize.depth || 300,
|
||||
height = psize.height || 2.5,
|
||||
maxz = psize.maxz
|
||||
) {
|
||||
psize = { width, depth, height, maxz };
|
||||
if (isRound) {
|
||||
platform.scale.set(width || 300, height || 5, depth || 175);
|
||||
platform.scale.set(width, height, depth);
|
||||
} else {
|
||||
platform.scale.set(width || 300, depth || 175, height || 5);
|
||||
platform.scale.set(width, depth, height);
|
||||
}
|
||||
viewControl.maxDistance = Math.max(width,depth) * 4;
|
||||
updatePlatformPosition();
|
||||
|
|
@ -291,7 +300,7 @@
|
|||
{x: width/2, z: depth/2, y: maxz},
|
||||
{x: -width/2, z: depth/2, y: maxz},
|
||||
];
|
||||
SCENE.add(volume = makeLinesFromPoints(points, 0xdddddd));
|
||||
SCENE.add(volume = makeLinesFromPoints(points, grid.colorMinor));
|
||||
showVolume(volumeOn);
|
||||
}
|
||||
}
|
||||
|
|
@ -437,7 +446,10 @@
|
|||
if (!unitMajor) {
|
||||
return;
|
||||
}
|
||||
if (unitMajor !== grid.unitMajor || unitMinor !== grid.unitMinor) {
|
||||
if (
|
||||
unitMajor !== grid.unitMajor || unitMinor !== grid.unitMinor ||
|
||||
colorMajor !== grid.colorMajor || colorMinor !== grid.colorMinor
|
||||
) {
|
||||
grid.unitMajor = unitMajor;
|
||||
grid.unitMinor = unitMinor;
|
||||
grid.colorMajor = colorMajor || grid.colorMajor;
|
||||
|
|
@ -1189,12 +1201,12 @@
|
|||
trackPlane.rotation.x = PI2;
|
||||
|
||||
let sky = new THREE.Mesh(
|
||||
new THREE.BoxGeometry(50000, 50000, 50000, 1, 1, 1),
|
||||
new THREE.BoxGeometry(3000, 3000, 3000, 1, 1, 1),
|
||||
skyMaterial =
|
||||
new THREE.MeshBasicMaterial({ color: skyColor, side: THREE.DoubleSide })
|
||||
),
|
||||
skygrid = new THREE.Mesh(
|
||||
new THREE.BoxGeometry(5000, 5000, 5000, 10, 10, 10),
|
||||
new THREE.BoxGeometry(3000, 3000, 3000, 10, 10, 10),
|
||||
skyGridMaterial =
|
||||
new THREE.MeshBasicMaterial({ color: skyGridColor, side: THREE.DoubleSide })
|
||||
);
|
||||
|
|
|
|||
|
|
@ -34,6 +34,11 @@ const dispatch = moto.worker = {
|
|||
}
|
||||
},
|
||||
|
||||
// allow workers to publish messages on the client side
|
||||
publish(topic, message) {
|
||||
dispatch.send({publish: topic, message});
|
||||
},
|
||||
|
||||
ready() {
|
||||
dispatch.send({ready: true});
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue