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;
|
startSaveCallback(title: string, visibility: string, callbackAction: string): void;
|
||||||
initCAS(): void;
|
initCAS(): void;
|
||||||
setErrorDialogsActive(flag: boolean): 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;
|
reset(): void;
|
||||||
refreshViews(): void;
|
refreshViews(): void;
|
||||||
setVisible(objName: string, visible: boolean): void;
|
setVisible(objName: string, visible: boolean): void;
|
||||||
@ -249,32 +257,32 @@ export interface AppletObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type AxisConfiguration = {
|
export type AxisConfiguration = {
|
||||||
label: string | null,
|
label: string | null;
|
||||||
unitLabel: string | null,
|
unitLabel: string | null;
|
||||||
positiveAxis: boolean,
|
positiveAxis: boolean;
|
||||||
showNumbers: boolean,
|
showNumbers: boolean;
|
||||||
tickStyle: number,
|
tickStyle: number;
|
||||||
visible: boolean
|
visible: boolean;
|
||||||
}
|
};
|
||||||
|
|
||||||
export type AxesConfiguration = {
|
export type AxesConfiguration = {
|
||||||
x: AxisConfiguration,
|
x: AxisConfiguration;
|
||||||
y: AxisConfiguration,
|
y: AxisConfiguration;
|
||||||
z: AxisConfiguration
|
z: AxisConfiguration;
|
||||||
}
|
};
|
||||||
|
|
||||||
export type GraphicsOptions = {
|
export type GraphicsOptions = {
|
||||||
axesColor: string,
|
axesColor: string;
|
||||||
bgColor: string,
|
bgColor: string;
|
||||||
gridColor: string,
|
gridColor: string;
|
||||||
axes: AxesConfiguration,
|
axes: AxesConfiguration;
|
||||||
grid: boolean,
|
grid: boolean;
|
||||||
gridDistance: {x: number | null, y: number | null},
|
gridDistance: { x: number | null; y: number | null };
|
||||||
gridType: number,
|
gridType: number;
|
||||||
pointCapturing: number,
|
pointCapturing: number;
|
||||||
rightAngleStyle: number,
|
rightAngleStyle: number;
|
||||||
rulerType: number
|
rulerType: number;
|
||||||
}
|
};
|
||||||
|
|
||||||
type RecursivePartial<T> = {
|
type RecursivePartial<T> = {
|
||||||
[P in keyof T]?: RecursivePartial<T[P]>;
|
[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 ' '
|
certainlyHandled := '.x3d .gltf .glb .obj .stl .ply'.split ' '
|
||||||
canvas := X3D.createBrowser()
|
canvas := X3D.createBrowser()
|
||||||
|
browser := X3D.getBrowser canvas
|
||||||
|
browser.setBrowserOption 'StraightenHorizon', false
|
||||||
site := $('a[href^="http"]')
|
site := $('a[href^="http"]')
|
||||||
url := site.attr('href') ?? ''
|
url := site.attr('href') ?? ''
|
||||||
|
|
||||||
if certainlyHandled.some((ext) => url.includes ext)
|
if certainlyHandled.some((ext) => url.includes ext)
|
||||||
canvas.setAttribute 'src', url
|
canvas.setAttribute 'src', url
|
||||||
else if url.includes '.wrl'
|
else if url.includes '.wrl'
|
||||||
@ -14,7 +17,7 @@ else if url.includes '.wrl'
|
|||||||
text .= await response.text()
|
text .= await response.text()
|
||||||
if /#\s*VRML\s*V?1./i.test(text)
|
if /#\s*VRML\s*V?1./i.test(text)
|
||||||
text = convert(text)
|
text = convert(text)
|
||||||
browser := X3D.getBrowser canvas
|
|
||||||
scene := await browser.createX3DFromString text
|
scene := await browser.createX3DFromString text
|
||||||
browser.replaceWorld(scene)
|
browser.replaceWorld(scene)
|
||||||
|
|
||||||
site.after(canvas)
|
site.after(canvas)
|
||||||
|
Loading…
Reference in New Issue
Block a user