rm dead code, workaround space+text3 inclusion in worker
This commit is contained in:
parent
c6dd4c304c
commit
f7edbad51d
2 changed files with 6 additions and 43 deletions
|
|
@ -407,56 +407,17 @@ function showVolume(bool) {
|
||||||
requestRefresh();
|
requestRefresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
function canvasInMesh(w, h, textAlign, textBaseline, color, size) {
|
|
||||||
let canvas = document.createElement('canvas'),
|
|
||||||
canvasTexture = new THREE.CanvasTexture(canvas),
|
|
||||||
plane = new THREE.PlaneGeometry(w, h),
|
|
||||||
context = canvas.getContext('2d'),
|
|
||||||
scale = 8;
|
|
||||||
|
|
||||||
canvas.width = w * scale;
|
|
||||||
canvas.height = h * scale;
|
|
||||||
|
|
||||||
canvas.addEventListener("webglcontextlost", event => {
|
|
||||||
console.log('WEB GL CONTEXT LOST');
|
|
||||||
event.preventDefault();
|
|
||||||
}, false);
|
|
||||||
|
|
||||||
canvas.addEventListener("webglcontextrestored", event => {
|
|
||||||
console.log('WEB GL CONTEXT RESTORED');
|
|
||||||
}, false);
|
|
||||||
|
|
||||||
try {
|
|
||||||
context.scale(scale, scale);
|
|
||||||
} catch (e) {
|
|
||||||
console.log('unable to create label canvas', e ? e.name : 'unknown');
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
context.fillStyle = color || fontColor;
|
|
||||||
context.font = `${size}px sans-serif`;
|
|
||||||
context.textAlign = textAlign;
|
|
||||||
context.textBaseline = textBaseline;
|
|
||||||
canvasTexture.minFilter = THREE.LinearFilter;
|
|
||||||
|
|
||||||
// set 'transparent' to false to debug mesh bounds
|
|
||||||
let material = new THREE.MeshBasicMaterial({transparent: true, map: canvasTexture});
|
|
||||||
let mesh = new THREE.Mesh(plane, material);
|
|
||||||
|
|
||||||
return { context, mesh };
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 3D text renderer for grid labels.
|
* 3D text renderer for grid labels.
|
||||||
* Uses bitmap font atlas with shared geometries for memory efficiency.
|
* Uses bitmap font atlas with shared geometries for memory efficiency.
|
||||||
*/
|
*/
|
||||||
let text3d = new Text3D({
|
let text3d = self.document ? new Text3D({
|
||||||
chars: '0123456789-XY',
|
chars: '0123456789-XY',
|
||||||
charSize: 64,
|
charSize: 64,
|
||||||
kerning: 0.6,
|
kerning: 0.6,
|
||||||
scaleX: 0.7,
|
scaleX: 0.7,
|
||||||
fontFamily: "'Russo One', sans-serif"
|
fontFamily: "'Russo One', sans-serif"
|
||||||
});
|
}) : undefined;
|
||||||
|
|
||||||
|
|
||||||
function setRulers(
|
function setRulers(
|
||||||
xon = ruler.xon,
|
xon = ruler.xon,
|
||||||
|
|
|
||||||
|
|
@ -420,6 +420,8 @@ details[open] summary::after {
|
||||||
}
|
}
|
||||||
.dark #rnfo {
|
.dark #rnfo {
|
||||||
color: #aaa;
|
color: #aaa;
|
||||||
|
border: 1px solid rgba(255,255,255,0.25);
|
||||||
|
background-color: rgba(0,0,0,0.75);
|
||||||
}
|
}
|
||||||
.dark #rnfo label {
|
.dark #rnfo label {
|
||||||
color: #ada;
|
color: #ada;
|
||||||
|
|
@ -2550,8 +2552,8 @@ details[open] summary::after {
|
||||||
bottom: 100%;
|
bottom: 100%;
|
||||||
gap: 3px;
|
gap: 3px;
|
||||||
right: 0;
|
right: 0;
|
||||||
background-color: rgba(255,255,255,0.05);
|
background-color: rgba(255,255,255,0.75);
|
||||||
border: 1px solid black;
|
border: 1px solid rgba(0,0,0,0.5);
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue