fix: Use geonames for auxiliaries (#56)

Otherwise sometimes they will convert points into vectors (ugh!)
  Also adds debugging output.

Reviewed-on: #56
Co-authored-by: Glen Whitney <glen@studioinfinity.org>
Co-committed-by: Glen Whitney <glen@studioinfinity.org>
This commit is contained in:
Glen Whitney 2024-01-19 03:58:14 +00:00 committed by Glen Whitney
parent f8c95860b8
commit 9e69613425
1 changed files with 11 additions and 4 deletions

View File

@ -326,7 +326,9 @@ function jToG(
deep := ['circle', 'polygon', 'sector']
filling := deep.includes(klass) ? 0.7 : 0.2
for each face of parts[2]
console.log 'Coloring face', face, 'to', colors[3] if traceC
if traceC
console.log 'Coloring face', face, 'to',
colors[3], '=', faceRGB
api.setVisible face, true
api.setFilling face, filling
api.setColor face, ...faceRGB
@ -339,6 +341,8 @@ function jToG(
api.setVisible line, false
else
lineRGB := joyce2rgb(colors[2] or 'black', cdata.bg)
if traceC
console.log 'Need to color lines', parts[1], 'with', lineRGB
for each line of parts[1]
console.log 'Coloring line', line, 'to', colors[2] if traceC
api.setVisible line, true
@ -869,7 +873,7 @@ classHandler: Record<JoyceClass, ClassHandler> :=
return := freshCommander()
{commands, callbacks, parts, auxiliaries} := return.value
parts[2].push name
aux := name + 'aUx'
aux := geoname name + 'aUx', cdata.elements, 'point'
switch method
/equilateralTriangle|square|regularPolygon/
pt := args.subpoints
@ -933,8 +937,11 @@ classHandler: Record<JoyceClass, ClassHandler> :=
commands.push ''
parts[0].push ...pt
callbacks.push (api: AppletObject, moreParts: DimParts) =>
made := api.evalCommandGetLabels
`${name} = Polygon(${pt.join ','})`
command := `Polygon(${pt.join ','})`
made := api.evalCommandGetLabels `${name} = ${command}`
if adapParams.config?.commands
console.log 'Finished constructing', name, 'with', command,
'producing', made
if not made return
for each obj of made.split ','
if obj is name continue