Open micahscopes opened 2 years ago
It would be nice to rename class Element extends generator
in Ganja so it doesn't clash with HTML5 Element
anymore, but what would be a better name?
@kungfooman I'm nto sure if this covers what you're doing but I was able to work around my issues by just avoiding using this
in the inline function body:
const cga = Algebra(4, 1);
const graphElements = cga.inline(() => {
let p1 = // ...
// ...
return [
0x00ff0000, p1, "p1", p2, "p2", p3, "p3", p4, "p4", // points
0xe0008800, p, "p", // plane
0xe00000ff, s, "s", // sphere
];
})();
const graph = cga.graph(graphElements, {
conformal: true,
gl: true,
grid: true,
alpha: true,
});
graph.setAttribute("id", "graph");
document.body.appendChild(graph);
I'm using vite to run some examples. Somehow the
Element
object is getting assigned to_Element
in functions generated from theinline
evaluator, so that the code in the generated functions references the existingwindow.Element
used to make DOM elements.I found a workaround that's working fine for me, which is to put
const Element = this
at the very beginning of the inline block.