chore: Check types and add draft full typing for x_ite. #18
@ -38,7 +38,15 @@ export interface AppletObject {
|
||||
startSaveCallback(title: string, visibility: string, callbackAction: string): void;
|
||||
initCAS(): void;
|
||||
setErrorDialogsActive(flag: boolean): void;
|
||||
setCoordSystem(xmin: number, xmax: number, ymin: number, ymax: number, zmin?: number, zmax?: number, yVertical?: boolean): void;
|
||||
setCoordSystem(
|
||||
xmin: number,
|
||||
xmax: number,
|
||||
ymin: number,
|
||||
ymax: number,
|
||||
zmin?: number,
|
||||
zmax?: number,
|
||||
yVertical?: boolean
|
||||
): void;
|
||||
reset(): void;
|
||||
refreshViews(): void;
|
||||
setVisible(objName: string, visible: boolean): void;
|
||||
@ -249,32 +257,32 @@ export interface AppletObject {
|
||||
}
|
||||
|
||||
export type AxisConfiguration = {
|
||||
label: string | null,
|
||||
unitLabel: string | null,
|
||||
positiveAxis: boolean,
|
||||
showNumbers: boolean,
|
||||
tickStyle: number,
|
||||
visible: boolean
|
||||
}
|
||||
label: string | null;
|
||||
unitLabel: string | null;
|
||||
positiveAxis: boolean;
|
||||
showNumbers: boolean;
|
||||
tickStyle: number;
|
||||
visible: boolean;
|
||||
};
|
||||
|
||||
export type AxesConfiguration = {
|
||||
x: AxisConfiguration,
|
||||
y: AxisConfiguration,
|
||||
z: AxisConfiguration
|
||||
}
|
||||
x: AxisConfiguration;
|
||||
y: AxisConfiguration;
|
||||
z: AxisConfiguration;
|
||||
};
|
||||
|
||||
export type GraphicsOptions = {
|
||||
axesColor: string,
|
||||
bgColor: string,
|
||||
gridColor: string,
|
||||
axes: AxesConfiguration,
|
||||
grid: boolean,
|
||||
gridDistance: {x: number | null, y: number | null},
|
||||
gridType: number,
|
||||
pointCapturing: number,
|
||||
rightAngleStyle: number,
|
||||
rulerType: number
|
||||
}
|
||||
axesColor: string;
|
||||
bgColor: string;
|
||||
gridColor: string;
|
||||
axes: AxesConfiguration;
|
||||
grid: boolean;
|
||||
gridDistance: { x: number | null; y: number | null };
|
||||
gridType: number;
|
||||
pointCapturing: number;
|
||||
rightAngleStyle: number;
|
||||
rulerType: number;
|
||||
};
|
||||
|
||||
type RecursivePartial<T> = {
|
||||
[P in keyof T]?: RecursivePartial<T[P]>;
|
||||
|
2037
etc/deps/x_ite.d.ts
vendored
2037
etc/deps/x_ite.d.ts
vendored
File diff suppressed because it is too large
Load Diff
@ -4,8 +4,11 @@ X3D from https://create3000.github.io/code/x_ite/latest/x_ite.mjs
|
||||
|
||||
certainlyHandled := '.x3d .gltf .glb .obj .stl .ply'.split ' '
|
||||
canvas := X3D.createBrowser()
|
||||
browser := X3D.getBrowser canvas
|
||||
browser.setBrowserOption 'StraightenHorizon', false
|
||||
site := $('a[href^="http"]')
|
||||
url := site.attr('href') ?? ''
|
||||
|
||||
if certainlyHandled.some((ext) => url.includes ext)
|
||||
canvas.setAttribute 'src', url
|
||||
else if url.includes '.wrl'
|
||||
@ -14,7 +17,7 @@ else if url.includes '.wrl'
|
||||
text .= await response.text()
|
||||
if /#\s*VRML\s*V?1./i.test(text)
|
||||
text = convert(text)
|
||||
browser := X3D.getBrowser canvas
|
||||
scene := await browser.createX3DFromString text
|
||||
browser.replaceWorld(scene)
|
||||
|
||||
site.after(canvas)
|
||||
|
Loading…
Reference in New Issue
Block a user