@gcode-viewer/plugins 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/README.md +26 -0
  2. package/dist/index.esm.js +288 -0
  3. package/dist/types/axis-gizmo/AxisGizmoPlugin.d.ts +25 -0
  4. package/dist/types/axis-gizmo/CoordinateAxes.d.ts +1 -0
  5. package/dist/types/axis-gizmo/index.d.ts +2 -0
  6. package/dist/types/bottom-bar/BottomBarPlugin.d.ts +36 -0
  7. package/dist/types/bottom-bar/index.d.ts +2 -0
  8. package/dist/types/context-menu/Constants.d.ts +34 -0
  9. package/dist/types/context-menu/ContextMenu.config.d.ts +2 -0
  10. package/dist/types/context-menu/ContextMenuPlugin.d.ts +23 -0
  11. package/dist/types/context-menu/Locale.d.ts +51 -0
  12. package/dist/types/context-menu/index.d.ts +4 -0
  13. package/dist/types/dat-gui/Viewer3dDatGui.d.ts +69 -0
  14. package/dist/types/dat-gui/index.d.ts +1 -0
  15. package/dist/types/explode/ExplodePlugin.d.ts +46 -0
  16. package/dist/types/explode/ObjectExploder.d.ts +48 -0
  17. package/dist/types/explode/index.d.ts +1 -0
  18. package/dist/types/export/ExportPlugin.d.ts +57 -0
  19. package/dist/types/export/Locale.d.ts +41 -0
  20. package/dist/types/export/gltf/GltfExporter.d.ts +32 -0
  21. package/dist/types/export/gltf/index.d.ts +1 -0
  22. package/dist/types/export/index.d.ts +2 -0
  23. package/dist/types/export/obj/ObjZipExporter.d.ts +14 -0
  24. package/dist/types/export/obj/index.d.ts +3 -0
  25. package/dist/types/export/obj/mtl.d.ts +9 -0
  26. package/dist/types/export/obj/textures.d.ts +15 -0
  27. package/dist/types/gcode-layer-bar/GCodeLayerBarPlugin.d.ts +66 -0
  28. package/dist/types/gcode-layer-bar/Locale.d.ts +13 -0
  29. package/dist/types/gcode-layer-bar/index.d.ts +2 -0
  30. package/dist/types/gcode-legend/GCodeLegendPlugin.d.ts +58 -0
  31. package/dist/types/gcode-legend/Locale.d.ts +83 -0
  32. package/dist/types/gcode-legend/NephogramLegend.d.ts +8 -0
  33. package/dist/types/gcode-legend/index.d.ts +2 -0
  34. package/dist/types/gcode-steps-bar/GCodeStepsBarPlugin.d.ts +46 -0
  35. package/dist/types/gcode-steps-bar/Locale.d.ts +11 -0
  36. package/dist/types/gcode-steps-bar/index.d.ts +2 -0
  37. package/dist/types/gcode-text-panel/GCodeTextPanelPlugin.d.ts +54 -0
  38. package/dist/types/gcode-text-panel/Locale.d.ts +11 -0
  39. package/dist/types/gcode-text-panel/index.d.ts +2 -0
  40. package/dist/types/ground-grid/GroundGridPlugin.d.ts +38 -0
  41. package/dist/types/ground-grid/index.d.ts +1 -0
  42. package/dist/types/ground-shaow/GroundShadowPlugin.d.ts +58 -0
  43. package/dist/types/ground-shaow/index.d.ts +1 -0
  44. package/dist/types/hotpoint/HotpointPlugin.d.ts +92 -0
  45. package/dist/types/hotpoint/index.d.ts +1 -0
  46. package/dist/types/index.d.ts +29 -0
  47. package/dist/types/local-model-uploader/IUploader.d.ts +55 -0
  48. package/dist/types/local-model-uploader/LocalModelUploader.d.ts +19 -0
  49. package/dist/types/local-model-uploader/index.d.ts +2 -0
  50. package/dist/types/measurements/AngleMeasureDrawable.d.ts +12 -0
  51. package/dist/types/measurements/AngleMeasurement.d.ts +13 -0
  52. package/dist/types/measurements/AreaMeasureDrawable.d.ts +14 -0
  53. package/dist/types/measurements/AreaMeasurement.d.ts +24 -0
  54. package/dist/types/measurements/BaseMeasureDrawable.d.ts +28 -0
  55. package/dist/types/measurements/BaseMeasurement.d.ts +123 -0
  56. package/dist/types/measurements/CoordinateMeasureDrawable.d.ts +10 -0
  57. package/dist/types/measurements/CoordinateMeasurement.d.ts +12 -0
  58. package/dist/types/measurements/DistanceMeasureDrawable.d.ts +13 -0
  59. package/dist/types/measurements/DistanceMeasurement.d.ts +21 -0
  60. package/dist/types/measurements/Locale.d.ts +13 -0
  61. package/dist/types/measurements/MeasurementPlugin.d.ts +102 -0
  62. package/dist/types/measurements/index.d.ts +3 -0
  63. package/dist/types/measurements/undo/AddMeasurementCommand.d.ts +10 -0
  64. package/dist/types/measurements/undo/RemoveMeasurementCommand.d.ts +10 -0
  65. package/dist/types/plate/PlatePlugin.d.ts +85 -0
  66. package/dist/types/plate/index.d.ts +1 -0
  67. package/dist/types/property/AnimationPanel.d.ts +3 -0
  68. package/dist/types/property/CameraEditor.d.ts +3 -0
  69. package/dist/types/property/EnvironmentPanel.d.ts +3 -0
  70. package/dist/types/property/LightEditor.d.ts +3 -0
  71. package/dist/types/property/Locale.d.ts +83 -0
  72. package/dist/types/property/MaterialEditor.d.ts +9 -0
  73. package/dist/types/property/PropertyPanelUi.d.ts +34 -0
  74. package/dist/types/property/PropertyPlugin.d.ts +95 -0
  75. package/dist/types/property/Utils.d.ts +19 -0
  76. package/dist/types/property/Vec3Field.d.ts +25 -0
  77. package/dist/types/property/index.d.ts +2 -0
  78. package/dist/types/rhino-3dm-loader/Rhino3dmLoaderPlugin.d.ts +17 -0
  79. package/dist/types/rhino-3dm-loader/Rhino3dmModelLoader.d.ts +25 -0
  80. package/dist/types/rhino-3dm-loader/index.d.ts +1 -0
  81. package/dist/types/scene-edit/SceneEditActions.d.ts +24 -0
  82. package/dist/types/scene-edit/SceneEditPlugin.d.ts +26 -0
  83. package/dist/types/scene-edit/SceneEditRecording.d.ts +11 -0
  84. package/dist/types/scene-edit/SceneMeshSnapshot.d.ts +23 -0
  85. package/dist/types/scene-edit/SceneMeshSnapshotUtils.d.ts +11 -0
  86. package/dist/types/scene-edit/SceneNodeSnapshot.d.ts +7 -0
  87. package/dist/types/scene-edit/SceneNodeSnapshotUtils.d.ts +11 -0
  88. package/dist/types/scene-edit/commands/GeometryEditCommand.d.ts +10 -0
  89. package/dist/types/scene-edit/commands/InsertSceneNodeCommand.d.ts +10 -0
  90. package/dist/types/scene-edit/commands/MaterialEditCommand.d.ts +10 -0
  91. package/dist/types/scene-edit/commands/MoveSceneNodeCommand.d.ts +10 -0
  92. package/dist/types/scene-edit/commands/RemoveSceneObjectCommand.d.ts +9 -0
  93. package/dist/types/scene-edit/commands/TransformSceneObjectCommand.d.ts +17 -0
  94. package/dist/types/scene-edit/index.d.ts +13 -0
  95. package/dist/types/screenshot/ScreenshotPlugin.d.ts +134 -0
  96. package/dist/types/screenshot/index.d.ts +1 -0
  97. package/dist/types/sections/AxisPlaneSection.d.ts +65 -0
  98. package/dist/types/sections/AxisSectionPopPanel.d.ts +18 -0
  99. package/dist/types/sections/BaseSection.d.ts +64 -0
  100. package/dist/types/sections/Locale.d.ts +21 -0
  101. package/dist/types/sections/ObjectsBoxSection.d.ts +29 -0
  102. package/dist/types/sections/PickPlaneSection.d.ts +48 -0
  103. package/dist/types/sections/PickSectionPopPanel.d.ts +18 -0
  104. package/dist/types/sections/Section.constants.d.ts +13 -0
  105. package/dist/types/sections/SectionGizmo.d.ts +22 -0
  106. package/dist/types/sections/SectionPlaneMesh.d.ts +23 -0
  107. package/dist/types/sections/SectionPlugin.d.ts +147 -0
  108. package/dist/types/sections/index.d.ts +6 -0
  109. package/dist/types/settings-3d/Locale.d.ts +61 -0
  110. package/dist/types/settings-3d/Settings3dPlugin.d.ts +46 -0
  111. package/dist/types/settings-3d/index.d.ts +2 -0
  112. package/dist/types/skybox/GradientColorSkybox.d.ts +9 -0
  113. package/dist/types/skybox/SkyboxPlugin.d.ts +48 -0
  114. package/dist/types/skybox/index.d.ts +1 -0
  115. package/dist/types/stats/StatsPlugin.d.ts +18 -0
  116. package/dist/types/stats/index.d.ts +2 -0
  117. package/dist/types/step-loader/OcctImportScriptLoader.d.ts +22 -0
  118. package/dist/types/step-loader/StepLoaderPlugin.d.ts +22 -0
  119. package/dist/types/step-loader/StepModelLoader.d.ts +39 -0
  120. package/dist/types/step-loader/index.d.ts +3 -0
  121. package/dist/types/step-loader/occtMeshBuilder.d.ts +35 -0
  122. package/dist/types/toolbars/Locale.d.ts +57 -0
  123. package/dist/types/toolbars/Toolbar.config.d.ts +5 -0
  124. package/dist/types/toolbars/Toolbar.constants.d.ts +71 -0
  125. package/dist/types/toolbars/Toolbar.d.ts +112 -0
  126. package/dist/types/toolbars/Viewer3dToolbarPlugin.d.ts +37 -0
  127. package/dist/types/toolbars/index.d.ts +5 -0
  128. package/dist/types/transform/Locale.d.ts +21 -0
  129. package/dist/types/transform/TransformPlugin.d.ts +38 -0
  130. package/dist/types/transform/index.d.ts +1 -0
  131. package/dist/types/tree-view/Locale.d.ts +29 -0
  132. package/dist/types/tree-view/TreeNodeTypeIcons.d.ts +15 -0
  133. package/dist/types/tree-view/TreeViewDragDrop.d.ts +17 -0
  134. package/dist/types/tree-view/TreeViewPlugin.d.ts +66 -0
  135. package/dist/types/tree-view/index.d.ts +2 -0
  136. package/dist/types/view-cube/Locale.d.ts +21 -0
  137. package/dist/types/view-cube/ViewCube.d.ts +86 -0
  138. package/dist/types/view-cube/ViewCubePlugin.d.ts +20 -0
  139. package/dist/types/view-cube/index.d.ts +2 -0
  140. package/package.json +73 -0
@@ -0,0 +1,58 @@
1
+ import { BaseViewer, Plugin, PluginConfig } from "@gcode-viewer/core";
2
+ export interface GCodeLegendPluginConfig extends Partial<PluginConfig> {
3
+ /**
4
+ * UI element id to contain the plugin. When omitted, the viewer widget container is used.
5
+ */
6
+ containerId?: string;
7
+ }
8
+ /**
9
+ * GCode preview legend (Color Scheme + line-type toggles), aligned with Bambu/Orca Preview.
10
+ */
11
+ export declare class GCodeLegendPlugin extends Plugin {
12
+ static readonly DEFAULT_ID = "GCodeLegendPlugin";
13
+ private readonly cfg;
14
+ private readonly gcodeViewer?;
15
+ private basePanel?;
16
+ private content?;
17
+ private scheme?;
18
+ private schemeLabel?;
19
+ private combo?;
20
+ private comboButton?;
21
+ private comboLabel?;
22
+ private comboMenu?;
23
+ private comboItems;
24
+ private nephogram?;
25
+ private extruderHost?;
26
+ private readonly groupRows;
27
+ private readonly typeRows;
28
+ private hasModel;
29
+ private comboOpen;
30
+ private colorMode;
31
+ constructor(viewer: BaseViewer, cfg?: GCodeLegendPluginConfig);
32
+ private init;
33
+ private hostContainer;
34
+ private buildDom;
35
+ private createCombo;
36
+ private createNephogramBlock;
37
+ private createExtruders;
38
+ private createRule;
39
+ private createGroupRow;
40
+ private createTypeRow;
41
+ private onModelsChanged;
42
+ private onLanguageChange;
43
+ private onVisibilityChanged;
44
+ private onColorModeChanged;
45
+ private onExtruderChanged;
46
+ private onToggleCombo;
47
+ private onDocumentPointerDown;
48
+ private setComboOpen;
49
+ private selectColorMode;
50
+ private refreshFromViewer;
51
+ private syncChrome;
52
+ private applyLocalizedCopy;
53
+ private toggleGroup;
54
+ private toggleType;
55
+ private render;
56
+ private renderExtruders;
57
+ destroy(): void;
58
+ }
@@ -0,0 +1,83 @@
1
+ import { i18n } from "@gcode-viewer/core";
2
+ export declare const en: {
3
+ title: string;
4
+ colorScheme: string;
5
+ lineType: string;
6
+ lineWidth: string;
7
+ layerHeight: string;
8
+ speed: string;
9
+ fanSpeed: string;
10
+ temperature: string;
11
+ layerTime: string;
12
+ flowRate: string;
13
+ extruderColor: string;
14
+ model: string;
15
+ outerWall: string;
16
+ innerWall: string;
17
+ infill: string;
18
+ skin: string;
19
+ bridge: string;
20
+ substructure: string;
21
+ supportInterface: string;
22
+ support: string;
23
+ skirtBrim: string;
24
+ raft: string;
25
+ primeTower: string;
26
+ option: string;
27
+ travel: string;
28
+ wipe: string;
29
+ starts: string;
30
+ unknown: string;
31
+ retraction: string;
32
+ unRetraction: string;
33
+ expand: string;
34
+ collapse: string;
35
+ show: string;
36
+ hide: string;
37
+ mixed: string;
38
+ extruder: string;
39
+ pickColor: string;
40
+ };
41
+ export declare const zh: {
42
+ title: string;
43
+ colorScheme: string;
44
+ lineType: string;
45
+ lineWidth: string;
46
+ layerHeight: string;
47
+ speed: string;
48
+ fanSpeed: string;
49
+ temperature: string;
50
+ layerTime: string;
51
+ flowRate: string;
52
+ extruderColor: string;
53
+ model: string;
54
+ outerWall: string;
55
+ innerWall: string;
56
+ infill: string;
57
+ skin: string;
58
+ bridge: string;
59
+ substructure: string;
60
+ supportInterface: string;
61
+ support: string;
62
+ skirtBrim: string;
63
+ raft: string;
64
+ primeTower: string;
65
+ option: string;
66
+ travel: string;
67
+ wipe: string;
68
+ starts: string;
69
+ unknown: string;
70
+ retraction: string;
71
+ unRetraction: string;
72
+ expand: string;
73
+ collapse: string;
74
+ show: string;
75
+ hide: string;
76
+ mixed: string;
77
+ extruder: string;
78
+ pickColor: string;
79
+ };
80
+ export declare const GCODE_LEGEND_I18N_NAMESPACE: "gcodeLegend";
81
+ export { i18n };
82
+ export type GCodeLegendTranslationKey = keyof typeof en;
83
+ export declare function t(key: GCodeLegendTranslationKey | string): string;
@@ -0,0 +1,8 @@
1
+ export declare function formatNephogramTicks(min: number, max: number, precision: number): string[];
2
+ /**
3
+ * Discrete color-scale legend for numeric Color Scheme modes (Speed, Width, …).
4
+ */
5
+ export declare function createNephogramLegend(): {
6
+ root: HTMLDivElement;
7
+ setRange: (min: number, max: number, precision: number) => void;
8
+ };
@@ -0,0 +1,2 @@
1
+ import "./gcode-legend.scss";
2
+ export * from "./GCodeLegendPlugin";
@@ -0,0 +1,46 @@
1
+ import { BaseViewer, Plugin, PluginConfig } from "@gcode-viewer/core";
2
+ export interface GCodeStepsBarPluginConfig extends Partial<PluginConfig> {
3
+ /**
4
+ * UI element id to contain the plugin. When omitted, the viewer widget container is used.
5
+ */
6
+ containerId?: string;
7
+ }
8
+ /**
9
+ * Horizontal GCode step bar: a single-handle playback slider for {@link GCodeViewer}.
10
+ */
11
+ export declare class GCodeStepsBarPlugin extends Plugin {
12
+ static readonly DEFAULT_ID = "GCodeStepsBarPlugin";
13
+ private readonly cfg;
14
+ private readonly gcodeViewer?;
15
+ private root?;
16
+ private hudInfo?;
17
+ private slider?;
18
+ private rail?;
19
+ private fill?;
20
+ private thumb?;
21
+ private valueEl?;
22
+ private minLine;
23
+ private maxLine;
24
+ private cursorLine;
25
+ private dragging;
26
+ constructor(viewer: BaseViewer, cfg?: GCodeStepsBarPluginConfig);
27
+ private init;
28
+ private hostContainer;
29
+ private buildDom;
30
+ private onModelsChanged;
31
+ private onLanguageChange;
32
+ private onLineWindowChanged;
33
+ private refreshFromViewer;
34
+ private applyWindow;
35
+ private setVisible;
36
+ private applyLocalizedCopy;
37
+ private onWheel;
38
+ private onSliderPointerDown;
39
+ private onSliderPointerMove;
40
+ private onSliderPointerUp;
41
+ private valueFromPointer;
42
+ private setHandle;
43
+ private percent;
44
+ private render;
45
+ destroy(): void;
46
+ }
@@ -0,0 +1,11 @@
1
+ import { i18n } from "@gcode-viewer/core";
2
+ export declare const en: {
3
+ currentLine: string;
4
+ };
5
+ export declare const zh: {
6
+ currentLine: string;
7
+ };
8
+ export declare const GCODE_STEPS_BAR_I18N_NAMESPACE: "gcodeStepsBar";
9
+ export { i18n };
10
+ export type GCodeStepsBarTranslationKey = keyof typeof en;
11
+ export declare function t(key: GCodeStepsBarTranslationKey | string): string;
@@ -0,0 +1,2 @@
1
+ import "./gcode-steps-bar.scss";
2
+ export * from "./GCodeStepsBarPlugin";
@@ -0,0 +1,54 @@
1
+ import { BaseViewer, Plugin, PluginConfig } from "@gcode-viewer/core";
2
+ export interface GCodeTextPanelPluginConfig extends Partial<PluginConfig> {
3
+ /**
4
+ * UI element id to contain the plugin. When omitted, the viewer widget container is used.
5
+ */
6
+ containerId?: string;
7
+ /**
8
+ * Show the panel when a GCode model is loaded. Default `true`.
9
+ * The panel starts collapsed; use the header chevron to expand. There is no close control.
10
+ */
11
+ visible?: boolean;
12
+ }
13
+ /**
14
+ * Right-side GCode source preview using {@link BasePanel} chrome
15
+ * (same shell as Settings / Export / Property floating panels).
16
+ */
17
+ export declare class GCodeTextPanelPlugin extends Plugin {
18
+ static readonly DEFAULT_ID = "GCodeTextPanelPlugin";
19
+ private readonly cfg;
20
+ private readonly gcodeViewer?;
21
+ private basePanel?;
22
+ private scrollEl?;
23
+ private windowEl?;
24
+ private sourceLines;
25
+ private errorLines;
26
+ private cursorLine;
27
+ private hasModel;
28
+ private open;
29
+ private rows;
30
+ private resizeObserver?;
31
+ private appliedDefaultCollapse;
32
+ constructor(viewer: BaseViewer, cfg?: GCodeTextPanelPluginConfig);
33
+ /**
34
+ * Programmatically shows or hides the source panel (no close button in chrome).
35
+ */
36
+ setVisible(visible: boolean): void;
37
+ isVisible(): boolean;
38
+ private init;
39
+ private hostContainer;
40
+ private buildDom;
41
+ private onModelsChanged;
42
+ private onLanguageChange;
43
+ private onLineWindowChanged;
44
+ private onWheel;
45
+ private onRowClick;
46
+ private refreshFromViewer;
47
+ private seekLine;
48
+ private applyLocalizedCopy;
49
+ private syncChrome;
50
+ private ensureRows;
51
+ private createRow;
52
+ private renderWindow;
53
+ destroy(): void;
54
+ }
@@ -0,0 +1,11 @@
1
+ import { i18n } from "@gcode-viewer/core";
2
+ export declare const en: {
3
+ view: string;
4
+ };
5
+ export declare const zh: {
6
+ view: string;
7
+ };
8
+ export declare const GCODE_TEXT_PANEL_I18N_NAMESPACE: "gcodeTextPanel";
9
+ export { i18n };
10
+ export type GCodeTextPanelTranslationKey = keyof typeof en;
11
+ export declare function t(key: GCodeTextPanelTranslationKey | string): string;
@@ -0,0 +1,2 @@
1
+ import "./gcode-text-panel.scss";
2
+ export * from "./GCodeTextPanelPlugin";
@@ -0,0 +1,38 @@
1
+ import { THREE, BaseViewer, Plugin, PluginConfig } from "@gcode-viewer/core";
2
+ /**
3
+ * Ground grid plugin.
4
+ */
5
+ export interface GroundGridPluginConfig extends Partial<PluginConfig> {
6
+ /** If ground grid is visible. It is visible by default. */
7
+ visible?: boolean;
8
+ /** World-space Z height of the grid plane. Default 0. */
9
+ height?: number;
10
+ }
11
+ /**
12
+ * Infinite anti-aliased ground grid rendered on the XY plane at configurable world Z.
13
+ * Uses a shader-based approach (Fyrestar/THREE.InfiniteGridHelper technique)
14
+ * so the grid always follows the camera and fades with distance.
15
+ * Can be used by Viewer3d.
16
+ */
17
+ export declare class GroundGridPlugin extends Plugin {
18
+ static readonly DEFAULT_ID = "GroundGridPlugin";
19
+ protected readonly NAME = "GROUND_GRID";
20
+ protected cfg: GroundGridPluginConfig;
21
+ protected gridMesh?: THREE.Mesh;
22
+ constructor(viewer: BaseViewer, cfg?: GroundGridPluginConfig);
23
+ protected init(): void;
24
+ /** World-space Z of the grid plane. */
25
+ getHeight(): number;
26
+ setHeight(height: number): void;
27
+ protected applyGridHeight(): void;
28
+ setVisible(visible: boolean): void;
29
+ isVisible(): boolean;
30
+ protected onModelLoaded: () => void;
31
+ /**
32
+ * Creates an infinite grid mesh using a shader-based approach.
33
+ * A unit PlaneGeometry is scaled in the vertex shader to fill the visible
34
+ * area, always centred on the camera, so no finite boundary is ever visible.
35
+ */
36
+ protected createInfiniteGrid(): THREE.Mesh;
37
+ destroy(): void;
38
+ }
@@ -0,0 +1 @@
1
+ export * from "./GroundGridPlugin";
@@ -0,0 +1,58 @@
1
+ import { THREE, BaseViewer, Plugin, PluginConfig } from "@gcode-viewer/core";
2
+ /**
3
+ * Ground shadow config.
4
+ */
5
+ export interface GroundShadowPluginConfig extends Partial<PluginConfig> {
6
+ /**
7
+ * Blur amount for the shadow.
8
+ * Default is 5.
9
+ */
10
+ blur?: number;
11
+ /**
12
+ * Darkness of the shadow.
13
+ * Default is 0.8.
14
+ */
15
+ darkness?: number;
16
+ /**
17
+ * Delay in milliseconds before updating the shadow after a model is loaded.
18
+ * Default is 2000.
19
+ * This is to avoid updating the shadow too frequently when many models are loaded at once.
20
+ */
21
+ updateDelay?: number;
22
+ /**
23
+ * Enable or disable the ground shadow.
24
+ * Default is true.
25
+ */
26
+ enabled?: boolean;
27
+ }
28
+ /**
29
+ * Ground shadow plugin is used to show shadow for models.
30
+ * Can be used by Viewer3d.
31
+ * @description
32
+ */
33
+ export declare class GroundShadowPlugin extends Plugin {
34
+ static readonly DEFAULT_ID = "GroundShadowPlugin";
35
+ protected cfg: GroundShadowPluginConfig;
36
+ enabled: boolean;
37
+ protected shadowGroup?: THREE.Group;
38
+ protected blurPlane?: THREE.Mesh;
39
+ protected depthMaterial?: THREE.MeshDepthMaterial;
40
+ protected horizontalBlurMaterial?: THREE.ShaderMaterial;
41
+ protected verticalBlurMaterial?: THREE.ShaderMaterial;
42
+ protected shadowCamera?: THREE.OrthographicCamera;
43
+ protected renderTarget?: THREE.WebGLRenderTarget;
44
+ protected renderTargetBlur?: THREE.WebGLRenderTarget;
45
+ constructor(viewer: BaseViewer, cfg?: GroundShadowPluginConfig);
46
+ protected get scene(): THREE.Scene<THREE.Object3DEventMap>;
47
+ protected get renderer(): THREE.WebGLRenderer;
48
+ setEnabled(enable: boolean): void;
49
+ isEnabled(): boolean;
50
+ /**
51
+ * Updates ground shadow.
52
+ */
53
+ update(): void;
54
+ protected onModelUpdate: () => void;
55
+ protected onShadowRender: () => void;
56
+ protected render(): void;
57
+ destroy(): void;
58
+ }
@@ -0,0 +1 @@
1
+ export * from "./GroundShadowPlugin";
@@ -0,0 +1,92 @@
1
+ import { THREE, THREEAddons, BaseViewer, Plugin } from "@gcode-viewer/core";
2
+ export interface Hotpoint {
3
+ hotpointId: string;
4
+ anchorPosition: number[];
5
+ visible?: boolean;
6
+ html: string;
7
+ }
8
+ /**
9
+ * Hotpoint plugin manages hotpoints in a viewer.
10
+ * It can be used by Viewer2d and Viewer3d.
11
+ * - A hotpoint is created and stored by user. User define its html and css.
12
+ * - A hotpoint can be added to, and removed from viewer.
13
+ * - Caller should set a hotpointId that is unique in the session of current viewer.
14
+ * - Viewer2d doesn't maintain the relationship between hotpoint and layout.
15
+ */
16
+ export declare class HotpointPlugin extends Plugin {
17
+ protected hotpointRoot?: THREE.Group;
18
+ protected css2dRenderer: THREEAddons.CSS2DRenderer;
19
+ constructor(viewer: BaseViewer);
20
+ /**
21
+ * Adds a CSS2D hotpoint. `hotpointId` must be unique for this viewer session.
22
+ * @param hotpoint Hotpoint payload (HTML, anchor, visibility).
23
+ * @example
24
+ * ``` typescript
25
+ * const hotpoint = {
26
+ * hotpointId: "c6ea70a3-ddb0-4dd0-87c8-bd2491936428",
27
+ * anchorPosition: [0, 0, 0],
28
+ * html: "<div>hotpoint</div>",
29
+ * visible: true,
30
+ * };
31
+ * const plugin = new HotpointPlugin(viewer);
32
+ * plugin.add(hotpoint);
33
+ * ```
34
+ */
35
+ add(hotpoint: Hotpoint): void;
36
+ /**
37
+ * Removes the hotpoint with the given id.
38
+ * @param hotpointId Hotpoint id to remove.
39
+ * @example
40
+ * ``` typescript
41
+ * const hotpointId = "c6ea70a3-ddb0-4dd0-87c8-bd2491936428";
42
+ * const plugin = new HotpointPlugin(viewer);
43
+ * plugin.remove(hotpointId);
44
+ * ```
45
+ */
46
+ remove(hotpointId: string): void;
47
+ /**
48
+ * Removes every hotpoint from the scene.
49
+ * @example
50
+ * ``` typescript
51
+ * const plugin = new HotpointPlugin(viewer);
52
+ * plugin.clear();
53
+ * ```
54
+ */
55
+ clear(): void;
56
+ /**
57
+ * Checks if hotpoint with specific id already exist
58
+ * Caller should set a hotpointId that is unique in the session of current Viewer2d.
59
+ * @hidden
60
+ */
61
+ has(hotpointId: string): boolean;
62
+ /**
63
+ * Updates world position of an existing hotpoint.
64
+ * @example
65
+ * ``` typescript
66
+ * const hotpointId = "c6ea70a3-ddb0-4dd0-87c8-bd2491936428";
67
+ * const plugin = new HotpointPlugin(viewer);
68
+ * plugin.move(hotpointId, [10, 10, 0]);
69
+ * ```
70
+ */
71
+ move(hotpointId: string, position: THREE.Vector2 | THREE.Vector3): void;
72
+ /**
73
+ * Shows or hides a hotpoint without removing it.
74
+ * @example
75
+ * ``` typescript
76
+ * const hotpointId = "c6ea70a3-ddb0-4dd0-87c8-bd2491936428";
77
+ * const plugin = new HotpointPlugin(viewer);
78
+ * plugin.setVisible(hotpointId, false);
79
+ * ```
80
+ */
81
+ setVisible(hotpointId: string, visible: boolean): void;
82
+ protected findHotpointObject(hotpointId: string): THREEAddons.CSS2DObject | undefined;
83
+ /**
84
+ *
85
+ * @param hotpointId
86
+ * @returns
87
+ * @description Fly to hotpoint by hotpointId.
88
+ */
89
+ flyToHotpoint(hotpointId: string): void;
90
+ destroy(): void;
91
+ protected onAfterRender: () => void;
92
+ }
@@ -0,0 +1 @@
1
+ export * from "./HotpointPlugin";
@@ -0,0 +1,29 @@
1
+ export * from "./axis-gizmo";
2
+ export * from "./bottom-bar";
3
+ export * from "./context-menu";
4
+ export * from "./dat-gui";
5
+ export * from "./explode";
6
+ export * from "./export";
7
+ export * from "./gcode-layer-bar";
8
+ export * from "./gcode-steps-bar";
9
+ export * from "./gcode-text-panel";
10
+ export * from "./gcode-legend";
11
+ export * from "./ground-grid";
12
+ export * from "./plate";
13
+ export * from "./ground-shaow";
14
+ export * from "./hotpoint";
15
+ export * from "./local-model-uploader";
16
+ export * from "./measurements";
17
+ export * from "./property";
18
+ export * from "./rhino-3dm-loader";
19
+ export * from "./scene-edit";
20
+ export * from "./screenshot";
21
+ export * from "./stats";
22
+ export * from "./skybox";
23
+ export * from "./sections";
24
+ export * from "./settings-3d";
25
+ export * from "./step-loader";
26
+ export * from "./toolbars";
27
+ export * from "./tree-view";
28
+ export * from "./transform";
29
+ export * from "./view-cube";
@@ -0,0 +1,55 @@
1
+ import { BaseViewer, Plugin, PluginConfig } from "@gcode-viewer/core";
2
+ /**
3
+ * Uploader plugin config.
4
+ */
5
+ export interface UploaderConfig extends Partial<PluginConfig> {
6
+ formats?: string[];
7
+ /**
8
+ * Enable to drag and drop files.
9
+ * Default to be true.
10
+ */
11
+ enableDragDropFile?: boolean;
12
+ }
13
+ /**
14
+ * @hidden
15
+ */
16
+ export declare class IUploader extends Plugin {
17
+ protected cfg: UploaderConfig;
18
+ protected input: HTMLInputElement;
19
+ protected dropZone: HTMLDivElement;
20
+ protected _formats: string[];
21
+ /**
22
+ * Callback function called when file loading starts.
23
+ * @param event - Event object containing file information
24
+ */
25
+ onStart?: (event: {
26
+ file: File;
27
+ fileName: string;
28
+ }) => void;
29
+ /**
30
+ * Callback function called when file upload and loaded to scene successfully.
31
+ * @param event - Event object containing file information
32
+ */
33
+ onSuccess?: (event: {
34
+ file: File;
35
+ fileName: string;
36
+ }) => void;
37
+ /**
38
+ * Callback function called when file upload fails.
39
+ * @param event - Event object containing file information and error
40
+ */
41
+ onError?: (event: {
42
+ file: File;
43
+ fileName: string;
44
+ error: Error | unknown;
45
+ }) => void;
46
+ constructor(viewer: BaseViewer, cfg: UploaderConfig);
47
+ protected formats(): string[];
48
+ protected uploadFiles(files: FileList): void;
49
+ openFileBrowserToUpload(): void;
50
+ destroy(): void;
51
+ protected handleDragEnter: (e: DragEvent) => void;
52
+ protected handleDragLeave: (e: DragEvent) => void;
53
+ protected handleDragOver: (e: DragEvent) => void;
54
+ protected handleDrop: (e: DragEvent) => void;
55
+ }
@@ -0,0 +1,19 @@
1
+ import type { ModelConfig, Viewer3d } from "@gcode-viewer/core";
2
+ import { IUploader, UploaderConfig } from "./IUploader";
3
+ /**
4
+ * @hidden
5
+ */
6
+ export declare class LocalModelUploader extends IUploader {
7
+ static readonly DEFAULT_ID = "LocalModelUploader";
8
+ readonly defaultModelConfig: ModelConfig;
9
+ constructor(viewer: Viewer3d, cfg?: UploaderConfig);
10
+ protected formats(): string[];
11
+ /**
12
+ * Uploads model files. There are several cases:
13
+ * - Upload a single file, a glTF, obj, etc.
14
+ * - Upload a model with external (bin, texture) files.
15
+ * - Upload many model files with the same format, a number of glTF without external bin or texture.
16
+ * It doesn't support the case to upload many model files, and one or more of them contains external files.
17
+ */
18
+ protected uploadFiles(files: FileList): void;
19
+ }
@@ -0,0 +1,2 @@
1
+ import "./uploader.scss";
2
+ export * from "./LocalModelUploader";
@@ -0,0 +1,12 @@
1
+ import { THREE } from "@gcode-viewer/core";
2
+ import { BaseMeasureDrawable } from "./BaseMeasureDrawable";
3
+ import { MeasurementType } from "./BaseMeasurement";
4
+ export declare class AngleMeasureDrawable extends BaseMeasureDrawable {
5
+ type: MeasurementType;
6
+ constructor(id: string, points: THREE.Vector3[]);
7
+ draw(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
8
+ drawText(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
9
+ getAngleBisector(startPoint: THREE.Vector3, middlePoint: THREE.Vector3, endPoint: THREE.Vector3): THREE.Vector3;
10
+ calculateAngle(startPoint: THREE.Vector3, middlePoint: THREE.Vector3, endPoint: THREE.Vector3): number;
11
+ getClassType(): string;
12
+ }
@@ -0,0 +1,13 @@
1
+ import { BaseViewer, DrawableList, type OSnapHelper, EventInfo, InputManager } from "@gcode-viewer/core";
2
+ import { AngleMeasureDrawable } from "./AngleMeasureDrawable";
3
+ import { BaseMeasurement } from "./BaseMeasurement";
4
+ export declare class AngleMeasurement extends BaseMeasurement {
5
+ constructor(viewer: BaseViewer, input: InputManager, drawList: DrawableList, osnapHelper: OSnapHelper);
6
+ protected createMeasureDrawable(): AngleMeasureDrawable | undefined;
7
+ protected onMouseClick(e: EventInfo): void;
8
+ exitDrawing(): void;
9
+ protected complete(): void;
10
+ cancel(): void;
11
+ deactivate(): void;
12
+ protected setTooltipContent(): void;
13
+ }
@@ -0,0 +1,14 @@
1
+ import { THREE } from "@gcode-viewer/core";
2
+ import { BaseMeasureDrawable } from "./BaseMeasureDrawable";
3
+ import { MeasurementType } from "./BaseMeasurement";
4
+ export declare class AreaMeasureDrawable extends BaseMeasureDrawable {
5
+ type: MeasurementType;
6
+ scale?: number;
7
+ constructor(id: string, points: THREE.Vector3[], scale?: number);
8
+ draw(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
9
+ drawText(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
10
+ calculateArea(points: THREE.Vector3[]): number;
11
+ getBarycenter(points: THREE.Vector3[]): THREE.Vector3;
12
+ isPointInPath(p: THREE.Vector3, raycaster?: THREE.Raycaster): boolean;
13
+ getClassType(): string;
14
+ }
@@ -0,0 +1,24 @@
1
+ import { THREE } from "@gcode-viewer/core";
2
+ import { type BaseViewer, EventInfo, InputManager, OSnapHelper, DrawableList } from "@gcode-viewer/core";
3
+ import { AreaMeasureDrawable } from "./AreaMeasureDrawable";
4
+ import { BaseMeasurement } from "./BaseMeasurement";
5
+ export declare class AreaMeasurement extends BaseMeasurement {
6
+ constructor(viewer: BaseViewer, input: InputManager, drawList: DrawableList, osnapHelper: OSnapHelper);
7
+ activate(): void;
8
+ deactivate(): void;
9
+ protected createMeasureDrawable(): AreaMeasureDrawable | undefined;
10
+ protected onMouseMove(position: THREE.Vector3): void;
11
+ protected onMouseClick(e: EventInfo): void;
12
+ exitDrawing(): void;
13
+ protected complete(): void;
14
+ cancel(): void;
15
+ protected setTooltipContent(): void;
16
+ /**
17
+ * Gets the scale value.
18
+ */
19
+ getScale(): number | undefined;
20
+ /**
21
+ * Sets the scale value.
22
+ */
23
+ setScale(scale: number): void;
24
+ }