Glen Whitney
277d9b0a8c
Implements the pivot parameter to the Geometry applet and numerous new construction methods. Resolves #36. Reviewed-on: #44 Co-authored-by: Glen Whitney <glen@studioinfinity.org> Co-committed-by: Glen Whitney <glen@studioinfinity.org>
33 lines
1001 B
Plaintext
33 lines
1001 B
Plaintext
export const flags = [
|
|
'color', 'commands', 'showall', 'showaux', 'algebra'] as const
|
|
export type FlagType = (typeof flags)[number]
|
|
export type ConfigType = Partial<Record<FlagType, boolean>>
|
|
|
|
export type AppletDescription
|
|
html: string
|
|
params: Record<string, string>
|
|
id: string
|
|
width: number
|
|
height: number
|
|
|
|
export type AdapParams
|
|
codebase?: string
|
|
loader?: string
|
|
config?: ConfigType
|
|
joyceApplets: AppletDescription[]
|
|
|
|
export function params(kids: HTMLCollection): Record<string, string>
|
|
return.value: Record<string, string> := {}
|
|
for each kid of kids
|
|
unless kid.tagName is 'PARAM' then continue
|
|
name := kid.getAttribute 'name'
|
|
value := kid.getAttribute 'value'
|
|
unless name and value then continue
|
|
return.value[name] = value
|
|
|
|
prim3d := /polyhedron|sphere|plane|face/
|
|
export function contains3d(params: Record<string, string>): boolean
|
|
for value of Object.values(params)
|
|
if prim3d.test(value) then return true
|
|
return false
|