From f25daf4e34b3ca982aff7e31b5846c0b20543dc9 Mon Sep 17 00:00:00 2001 From: Ulrich Kortenkamp Date: Mon, 19 Jun 2023 11:30:43 +1000 Subject: [PATCH 1/2] small changes to Stellenwerttafel example --- examples/165_stellenwerttafel.html | 119 ++++++++++++----------------- 1 file changed, 49 insertions(+), 70 deletions(-) diff --git a/examples/165_stellenwerttafel.html b/examples/165_stellenwerttafel.html index 32719fe55..1cd31898d 100644 --- a/examples/165_stellenwerttafel.html +++ b/examples/165_stellenwerttafel.html @@ -3,7 +3,7 @@ - Stellenwerttafel-Tausendstel.cdy + Stellenwerttafel mit Tausendsteln (C)2011-2022 Ulrich Kortenkamp - - + + + + + +
+ + \ No newline at end of file diff --git a/src/js/libgeo/GeoRender.js b/src/js/libgeo/GeoRender.js index 3f2db1b61..71f4905fd 100644 --- a/src/js/libgeo/GeoRender.js +++ b/src/js/libgeo/GeoRender.js @@ -3,6 +3,7 @@ import { CSNumber } from "libcs/CSNumber"; import { List } from "libcs/List"; import { General } from "libcs/General"; import { eval_helper, evaluator, niceprint } from "libcs/Essentials"; +import { Accessor } from "libcs/Accessors"; import { textRendererHtml } from "libcs/OpDrawing"; import { Render2D } from "libcs/Render2D"; import { csport } from "libgeo/GeoState"; @@ -245,7 +246,7 @@ function drawgeotext(el) { let name, el2; try { name = JSON.parse(match.substring(2)); - el2 = csgeo.csnames[name]; + el2 = csgeo.csnames[name]; // this does not deliver the ctype of el2, as ctype is separate from elements. if (!el2) return "?"; } catch (err) { return "?"; @@ -253,9 +254,10 @@ function drawgeotext(el) { switch (match.charAt(1)) { case "$": return el2.printname || name; - case "#": - if (el2.kind !== "V") return "?"; - return niceprint(el2.value); + case "#": // I do not like this. I would prefer an oo-approach. + if (el2.kind === "P") return niceprint(Accessor.getField(el2, "xy")); + if (el2.kind == "V") return niceprint(el2.value); + return el2.value; } }); let htmlCallback = null;