dxfview 0.0.2
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.
- package/README.md +1 -0
- package/dist/dxfview.esm.min.js +7 -0
- package/dist/types/components/dxf-layout-bar/DxfLayoutBar.d.ts +26 -0
- package/dist/types/components/dxf-layout-bar/index.d.ts +1 -0
- package/dist/types/components/pop-panel/PopPanel.d.ts +14 -0
- package/dist/types/components/pop-panel/index.d.ts +1 -0
- package/dist/types/components/progress-bar/ProgressBar.d.ts +34 -0
- package/dist/types/components/progress-bar/index.d.ts +1 -0
- package/dist/types/components/settings/ProjectSettingsDef.d.ts +44 -0
- package/dist/types/components/settings/index.d.ts +1 -0
- package/dist/types/components/tool-tip/Tooltip.d.ts +20 -0
- package/dist/types/components/tool-tip/index.d.ts +1 -0
- package/dist/types/core/Configs.d.ts +238 -0
- package/dist/types/core/Constants.d.ts +164 -0
- package/dist/types/core/Units.d.ts +16 -0
- package/dist/types/core/VersionManager.d.ts +3 -0
- package/dist/types/core/camera-controls/CameraControls.d.ts +773 -0
- package/dist/types/core/camera-controls/Constants.d.ts +2 -0
- package/dist/types/core/camera-controls/EventDispatcher.d.ts +41 -0
- package/dist/types/core/camera-controls/index.d.ts +2 -0
- package/dist/types/core/camera-controls/types.d.ts +112 -0
- package/dist/types/core/camera-controls/utils/extractClientCoordFromEvent.d.ts +3 -0
- package/dist/types/core/camera-controls/utils/math-utils.d.ts +11 -0
- package/dist/types/core/camera-controls/utils/notSupportedInOrthographicCamera.d.ts +2 -0
- package/dist/types/core/canvas/CanvasRender.d.ts +52 -0
- package/dist/types/core/canvas/Constants.d.ts +28 -0
- package/dist/types/core/canvas/Drawable.d.ts +87 -0
- package/dist/types/core/canvas/DrawableList.d.ts +29 -0
- package/dist/types/core/canvas/index.d.ts +4 -0
- package/dist/types/core/compare/BaseDxfCompareHelper.d.ts +104 -0
- package/dist/types/core/compare/CompareDrawable.d.ts +17 -0
- package/dist/types/core/compare/DxfCompareHelper.d.ts +69 -0
- package/dist/types/core/compare/DxfCompareMarkupManager.d.ts +11 -0
- package/dist/types/core/compare/index.d.ts +4 -0
- package/dist/types/core/controls/CameraControlsEx.d.ts +34 -0
- package/dist/types/core/controls/index.d.ts +1 -0
- package/dist/types/core/dxf/DxfCompare.d.ts +151 -0
- package/dist/types/core/dxf/DxfConstants.d.ts +15 -0
- package/dist/types/core/dxf/DxfLoader.d.ts +526 -0
- package/dist/types/core/dxf/DxfObject.d.ts +32 -0
- package/dist/types/core/dxf/DxfUtils.d.ts +79 -0
- package/dist/types/core/dxf/HatchPatternShaders.d.ts +12 -0
- package/dist/types/core/dxf/LinePatternShaders.d.ts +12 -0
- package/dist/types/core/dxf/bspline.d.ts +8 -0
- package/dist/types/core/dxf/dxfom-mtext.d.ts +46 -0
- package/dist/types/core/dxf/dxfom-text.d.ts +16 -0
- package/dist/types/core/dxf/index.d.ts +10 -0
- package/dist/types/core/dxf/round10.d.ts +2 -0
- package/dist/types/core/dxf-parser/AutoCadColorIndex.d.ts +8 -0
- package/dist/types/core/dxf-parser/DxfBaseReader.d.ts +12 -0
- package/dist/types/core/dxf-parser/DxfBinaryReader.d.ts +14 -0
- package/dist/types/core/dxf-parser/DxfParser.d.ts +327 -0
- package/dist/types/core/dxf-parser/DxfTextReader.d.ts +31 -0
- package/dist/types/core/dxf-parser/ParseHelpers.d.ts +36 -0
- package/dist/types/core/dxf-parser/entities/3dface.d.ts +11 -0
- package/dist/types/core/dxf-parser/entities/arc.d.ts +16 -0
- package/dist/types/core/dxf-parser/entities/attdef.d.ts +31 -0
- package/dist/types/core/dxf-parser/entities/attrib.d.ts +31 -0
- package/dist/types/core/dxf-parser/entities/circle.d.ts +13 -0
- package/dist/types/core/dxf-parser/entities/dimension.d.ts +22 -0
- package/dist/types/core/dxf-parser/entities/ellipse.d.ts +15 -0
- package/dist/types/core/dxf-parser/entities/geomtry.d.ts +40 -0
- package/dist/types/core/dxf-parser/entities/hatch.d.ts +108 -0
- package/dist/types/core/dxf-parser/entities/image.d.ts +37 -0
- package/dist/types/core/dxf-parser/entities/insert.d.ts +20 -0
- package/dist/types/core/dxf-parser/entities/leader.d.ts +23 -0
- package/dist/types/core/dxf-parser/entities/line.d.ts +10 -0
- package/dist/types/core/dxf-parser/entities/lwpolyline.d.ts +21 -0
- package/dist/types/core/dxf-parser/entities/mleader.d.ts +101 -0
- package/dist/types/core/dxf-parser/entities/mtext.d.ts +18 -0
- package/dist/types/core/dxf-parser/entities/ole2frame.d.ts +20 -0
- package/dist/types/core/dxf-parser/entities/point.d.ts +11 -0
- package/dist/types/core/dxf-parser/entities/polyline.d.ts +20 -0
- package/dist/types/core/dxf-parser/entities/ray.d.ts +10 -0
- package/dist/types/core/dxf-parser/entities/region.d.ts +10 -0
- package/dist/types/core/dxf-parser/entities/seqend.d.ts +8 -0
- package/dist/types/core/dxf-parser/entities/solid.d.ts +10 -0
- package/dist/types/core/dxf-parser/entities/spline.d.ts +23 -0
- package/dist/types/core/dxf-parser/entities/table.d.ts +42 -0
- package/dist/types/core/dxf-parser/entities/text.d.ts +18 -0
- package/dist/types/core/dxf-parser/entities/vertex.d.ts +20 -0
- package/dist/types/core/dxf-parser/entities/viewport.d.ts +46 -0
- package/dist/types/core/dxf-parser/entities/xline.d.ts +10 -0
- package/dist/types/core/dxf-parser/index.d.ts +27 -0
- package/dist/types/core/dxf-parser/objects/common.d.ts +15 -0
- package/dist/types/core/dxf-parser/objects/dictionary.d.ts +19 -0
- package/dist/types/core/dxf-parser/objects/imagedef.d.ts +24 -0
- package/dist/types/core/dxf-parser/objects/layout.d.ts +29 -0
- package/dist/types/core/dxf-parser/objects/sortentstable.d.ts +12 -0
- package/dist/types/core/dxf-parser/objects/spatialfilter.d.ts +22 -0
- package/dist/types/core/dxf-parser/objects/xrecord.d.ts +11 -0
- package/dist/types/core/font/BaseFont.d.ts +88 -0
- package/dist/types/core/font/FontManager.d.ts +107 -0
- package/dist/types/core/font/MeshFont.d.ts +44 -0
- package/dist/types/core/font/ShxFont.d.ts +108 -0
- package/dist/types/core/font/index.d.ts +1 -0
- package/dist/types/core/font/shx/ExtraLettersTemplate.d.ts +1 -0
- package/dist/types/core/font/shx/Shx.constants.d.ts +11 -0
- package/dist/types/core/font/shx/ShxParser.d.ts +18 -0
- package/dist/types/core/font/shx/TextShape.d.ts +24 -0
- package/dist/types/core/font/shx/gbk/index.d.ts +4 -0
- package/dist/types/core/font/shx/index.d.ts +1 -0
- package/dist/types/core/font/shx/util/BitConverter.d.ts +18 -0
- package/dist/types/core/geometry-offset/Edge.d.ts +27 -0
- package/dist/types/core/geometry-offset/Offset.d.ts +46 -0
- package/dist/types/core/geometry-offset/index.d.ts +1 -0
- package/dist/types/core/helpers/BinaryReader.d.ts +24 -0
- package/dist/types/core/helpers/BoxSelectHelper.d.ts +44 -0
- package/dist/types/core/helpers/LoadingHelper.d.ts +46 -0
- package/dist/types/core/helpers/MobileTouchHelperDrawable.d.ts +26 -0
- package/dist/types/core/helpers/OSnapHelper.d.ts +167 -0
- package/dist/types/core/helpers/ObjectPixelSizeHelper.d.ts +13 -0
- package/dist/types/core/helpers/PickMarkupHelper.d.ts +29 -0
- package/dist/types/core/helpers/RafHelper.d.ts +18 -0
- package/dist/types/core/helpers/ZoomToRectHelper.d.ts +17 -0
- package/dist/types/core/helpers/index.d.ts +9 -0
- package/dist/types/core/index.d.ts +18 -0
- package/dist/types/core/indexeddb/AnnotationTable.d.ts +14 -0
- package/dist/types/core/indexeddb/BaseTable.d.ts +36 -0
- package/dist/types/core/indexeddb/DxfDataTable.d.ts +22 -0
- package/dist/types/core/indexeddb/FontDataTable.d.ts +32 -0
- package/dist/types/core/indexeddb/IndexedDbManager.d.ts +29 -0
- package/dist/types/core/indexeddb/ViewpointTable.d.ts +14 -0
- package/dist/types/core/indexeddb/index.d.ts +6 -0
- package/dist/types/core/input/InputManager.d.ts +161 -0
- package/dist/types/core/input/index.d.ts +1 -0
- package/dist/types/core/license/AutoConfig.d.ts +17 -0
- package/dist/types/core/license/LicenseManager.d.ts +107 -0
- package/dist/types/core/license/PublicKey.d.ts +1 -0
- package/dist/types/core/license/index.d.ts +1 -0
- package/dist/types/core/markup/ArrowMarkup.d.ts +14 -0
- package/dist/types/core/markup/BaseMarkup.d.ts +28 -0
- package/dist/types/core/markup/CircleMarkup.d.ts +12 -0
- package/dist/types/core/markup/CloudLineMarkup.d.ts +10 -0
- package/dist/types/core/markup/CloudRectMarkup.d.ts +11 -0
- package/dist/types/core/markup/CloudRectWithTextMarkup.d.ts +43 -0
- package/dist/types/core/markup/Constants.d.ts +17 -0
- package/dist/types/core/markup/DotMarkup.d.ts +9 -0
- package/dist/types/core/markup/EllipseMarkup.d.ts +12 -0
- package/dist/types/core/markup/LeaderLineMarkup.d.ts +25 -0
- package/dist/types/core/markup/MarkupManager.d.ts +91 -0
- package/dist/types/core/markup/PolylineMarkup.d.ts +11 -0
- package/dist/types/core/markup/RectMarkup.d.ts +10 -0
- package/dist/types/core/markup/TextMarkup.d.ts +40 -0
- package/dist/types/core/markup/XMarkup.d.ts +10 -0
- package/dist/types/core/markup/index.d.ts +13 -0
- package/dist/types/core/model/Constants.d.ts +51 -0
- package/dist/types/core/model/Model.d.ts +18 -0
- package/dist/types/core/model/Model2d.d.ts +115 -0
- package/dist/types/core/model/index.d.ts +3 -0
- package/dist/types/core/patches/Constants.d.ts +4 -0
- package/dist/types/core/patches/Line.d.ts +2 -0
- package/dist/types/core/patches/Mesh.d.ts +2 -0
- package/dist/types/core/patches/Points.d.ts +2 -0
- package/dist/types/core/patches/index.d.ts +4 -0
- package/dist/types/core/undo-redo/AddAnnotationCommand.d.ts +11 -0
- package/dist/types/core/undo-redo/AddMarkupCommand.d.ts +10 -0
- package/dist/types/core/undo-redo/AddMeasurementCommand.d.ts +9 -0
- package/dist/types/core/undo-redo/Command.d.ts +6 -0
- package/dist/types/core/undo-redo/RemoveAnnotationCommand.d.ts +11 -0
- package/dist/types/core/undo-redo/RemoveMarkupCommand.d.ts +10 -0
- package/dist/types/core/undo-redo/RemoveMeasurementCommand.d.ts +9 -0
- package/dist/types/core/undo-redo/UndoRedoManager.d.ts +21 -0
- package/dist/types/core/undo-redo/UpdateMarkupCommand.d.ts +11 -0
- package/dist/types/core/undo-redo/index.d.ts +9 -0
- package/dist/types/core/utils/CSS2DObjectUtils.d.ts +14 -0
- package/dist/types/core/utils/ColorUtils.d.ts +21 -0
- package/dist/types/core/utils/CommonUtils.d.ts +125 -0
- package/dist/types/core/utils/CoordinateUtils.d.ts +81 -0
- package/dist/types/core/utils/DecimalPrecisionUtils.d.ts +4 -0
- package/dist/types/core/utils/DeviceUtils.d.ts +15 -0
- package/dist/types/core/utils/EdgeUtils.d.ts +14 -0
- package/dist/types/core/utils/Event.d.ts +33 -0
- package/dist/types/core/utils/FpsUtils.d.ts +13 -0
- package/dist/types/core/utils/GeometryUtils.d.ts +111 -0
- package/dist/types/core/utils/Locale.d.ts +190 -0
- package/dist/types/core/utils/LogUtils.d.ts +7 -0
- package/dist/types/core/utils/MaterialUtils.d.ts +40 -0
- package/dist/types/core/utils/MathUtils.d.ts +59 -0
- package/dist/types/core/utils/MergeUtils.d.ts +638 -0
- package/dist/types/core/utils/ObjectUtils.d.ts +87 -0
- package/dist/types/core/utils/PolygonUtils.d.ts +8 -0
- package/dist/types/core/utils/SVGObjectUtils.d.ts +16 -0
- package/dist/types/core/utils/SceneUtils.d.ts +26 -0
- package/dist/types/core/utils/SectionUtils.d.ts +11 -0
- package/dist/types/core/utils/UnitConversionUtils.d.ts +31 -0
- package/dist/types/core/utils/index.d.ts +21 -0
- package/dist/types/core/viewers/BaseViewer.d.ts +265 -0
- package/dist/types/core/viewers/DxfViewer.d.ts +1372 -0
- package/dist/types/core/viewers/Plugin.d.ts +29 -0
- package/dist/types/core/viewers/ViewerEvent.d.ts +178 -0
- package/dist/types/core/viewers/index.d.ts +4 -0
- package/dist/types/export.doc.d.ts +10 -0
- package/dist/types/fetch-polyfill.d.ts +2 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/plugins/annotation/AnnotationPlugin.d.ts +139 -0
- package/dist/types/plugins/annotation/AutoDrawAnnotation.d.ts +63 -0
- package/dist/types/plugins/annotation/BaseAnnotation.d.ts +113 -0
- package/dist/types/plugins/annotation/BaseAnnotationDrawable.d.ts +139 -0
- package/dist/types/plugins/annotation/CopyAnnotation.d.ts +36 -0
- package/dist/types/plugins/annotation/CopyDrawable.d.ts +26 -0
- package/dist/types/plugins/annotation/FreeDrawAnnotation.d.ts +59 -0
- package/dist/types/plugins/annotation/RectAnnotation.d.ts +53 -0
- package/dist/types/plugins/annotation/RectDrawable.d.ts +42 -0
- package/dist/types/plugins/annotation/ShapeFinder.d.ts +51 -0
- package/dist/types/plugins/annotation/freeDrawDrawable.d.ts +21 -0
- package/dist/types/plugins/annotation/index.d.ts +8 -0
- package/dist/types/plugins/annotation/type.d.ts +182 -0
- package/dist/types/plugins/axis-gizmo/AxisGizmoPlugin.d.ts +49 -0
- package/dist/types/plugins/axis-gizmo/CoordinateAxes.d.ts +12 -0
- package/dist/types/plugins/axis-gizmo/index.d.ts +1 -0
- package/dist/types/plugins/bottom-bar/BottomBarPlugin.d.ts +44 -0
- package/dist/types/plugins/bottom-bar/index.d.ts +1 -0
- package/dist/types/plugins/divide/CoverLayerManager.d.ts +44 -0
- package/dist/types/plugins/divide/DivGeometryUtils.d.ts +66 -0
- package/dist/types/plugins/divide/DividePlugin.d.ts +181 -0
- package/dist/types/plugins/divide/FrameAnnotation.d.ts +142 -0
- package/dist/types/plugins/divide/FrameDrawable.d.ts +75 -0
- package/dist/types/plugins/divide/index.d.ts +6 -0
- package/dist/types/plugins/divide/types.d.ts +38 -0
- package/dist/types/plugins/hotpoint/HotpointPlugin.d.ts +93 -0
- package/dist/types/plugins/hotpoint/index.d.ts +1 -0
- package/dist/types/plugins/index.d.ts +12 -0
- package/dist/types/plugins/layer-manager/LayerManagerPlugin.d.ts +59 -0
- package/dist/types/plugins/layer-manager/index.d.ts +1 -0
- package/dist/types/plugins/local-model-uploader/IUploader.d.ts +10 -0
- package/dist/types/plugins/local-model-uploader/LocalDxfUploader.d.ts +19 -0
- package/dist/types/plugins/local-model-uploader/index.d.ts +1 -0
- package/dist/types/plugins/measure/AngleMeasureDrawable.d.ts +12 -0
- package/dist/types/plugins/measure/AngleMeasurement.d.ts +16 -0
- package/dist/types/plugins/measure/AreaMeasureDrawable.d.ts +14 -0
- package/dist/types/plugins/measure/AreaMeasurement.d.ts +31 -0
- package/dist/types/plugins/measure/BaseMeasureDrawable.d.ts +35 -0
- package/dist/types/plugins/measure/BaseMeasurement.d.ts +127 -0
- package/dist/types/plugins/measure/CoordinateMeasureDrawable.d.ts +10 -0
- package/dist/types/plugins/measure/CoordinateMeasurement.d.ts +15 -0
- package/dist/types/plugins/measure/DistanceMeasureDrawable.d.ts +15 -0
- package/dist/types/plugins/measure/DistanceMeasurement.d.ts +28 -0
- package/dist/types/plugins/measure/MeasurementPlugin.d.ts +131 -0
- package/dist/types/plugins/measure/index.d.ts +3 -0
- package/dist/types/plugins/overview-map/ImageDrawable.d.ts +41 -0
- package/dist/types/plugins/overview-map/LineDrawable.d.ts +20 -0
- package/dist/types/plugins/overview-map/OverviewMapDrawable.d.ts +24 -0
- package/dist/types/plugins/overview-map/OverviewMapPlugin.d.ts +156 -0
- package/dist/types/plugins/overview-map/TextDrawable.d.ts +50 -0
- package/dist/types/plugins/overview-map/index.d.ts +5 -0
- package/dist/types/plugins/screenshot/ScreenshotPlugin.d.ts +88 -0
- package/dist/types/plugins/screenshot/index.d.ts +1 -0
- package/dist/types/plugins/stats/StatsPlugin.d.ts +20 -0
- package/dist/types/plugins/stats/index.d.ts +1 -0
- package/dist/types/plugins/toolbars/DxfViewerToolbarPlugin.d.ts +67 -0
- package/dist/types/plugins/toolbars/MarkupToolbar.d.ts +33 -0
- package/dist/types/plugins/toolbars/Toolbar.config.d.ts +5 -0
- package/dist/types/plugins/toolbars/Toolbar.constants.d.ts +96 -0
- package/dist/types/plugins/toolbars/Toolbar.d.ts +102 -0
- package/dist/types/plugins/toolbars/index.d.ts +5 -0
- package/dist/types/version.d.ts +2 -0
- package/package.json +90 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import { BaseMarkup } from "./BaseMarkup";
|
|
3
|
+
import type { MarkupManager } from "./MarkupManager";
|
|
4
|
+
import { DrawableData } from "../../core/canvas";
|
|
5
|
+
import { MarkupType } from "../../core/markup/Constants";
|
|
6
|
+
export interface TextShape extends DrawableData {
|
|
7
|
+
text: string;
|
|
8
|
+
fontSize: number;
|
|
9
|
+
}
|
|
10
|
+
export declare class TextMarkup extends BaseMarkup {
|
|
11
|
+
text: string;
|
|
12
|
+
fontSize: number;
|
|
13
|
+
type: MarkupType;
|
|
14
|
+
protected padding: number;
|
|
15
|
+
static readonly DEFAULT_INPUT_WIDTH = 50;
|
|
16
|
+
protected manager?: MarkupManager;
|
|
17
|
+
protected textInput?: HTMLTextAreaElement;
|
|
18
|
+
protected inputStatus: string;
|
|
19
|
+
isEditing: boolean;
|
|
20
|
+
constructor(id: string, points: THREE.Vector3[], text: string);
|
|
21
|
+
draw(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
|
|
22
|
+
protected drawText(ctx: CanvasRenderingContext2D, camera: THREE.Camera, text: string): void;
|
|
23
|
+
setFontSize(fontSize: number): void;
|
|
24
|
+
update(points: THREE.Vector3[]): this;
|
|
25
|
+
setData(data: TextShape): void;
|
|
26
|
+
updateText(text: string): void;
|
|
27
|
+
getData(): TextShape;
|
|
28
|
+
getClassType(): string;
|
|
29
|
+
addInput(manager: MarkupManager, x?: number, y?: number): void;
|
|
30
|
+
addInputEvents(): void;
|
|
31
|
+
handleClick: () => void;
|
|
32
|
+
handleKeydown: (e: KeyboardEvent) => void;
|
|
33
|
+
handleInput: () => void;
|
|
34
|
+
handleCompositionStart: () => void;
|
|
35
|
+
handleCompositionEnd: () => void;
|
|
36
|
+
handleBlur: () => void;
|
|
37
|
+
handleFoucs: () => void;
|
|
38
|
+
enterEditing(): void;
|
|
39
|
+
exitEditing(): void;
|
|
40
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import { BaseMarkup } from "../../core/markup/BaseMarkup";
|
|
3
|
+
import { MarkupType } from "../../core/markup/Constants";
|
|
4
|
+
export declare class XMarkup extends BaseMarkup {
|
|
5
|
+
type: MarkupType;
|
|
6
|
+
constructor(id: string, points: THREE.Vector3[]);
|
|
7
|
+
draw(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
|
|
8
|
+
isPointInPath(p: THREE.Vector3): boolean;
|
|
9
|
+
getClassType(): string;
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from "./ArrowMarkup";
|
|
2
|
+
export * from "./CircleMarkup";
|
|
3
|
+
export * from "./CloudLineMarkup";
|
|
4
|
+
export * from "./CloudRectMarkup";
|
|
5
|
+
export * from "./DotMarkup";
|
|
6
|
+
export * from "./EllipseMarkup";
|
|
7
|
+
export * from "./LeaderLineMarkup";
|
|
8
|
+
export * from "./PolylineMarkup";
|
|
9
|
+
export * from "./RectMarkup";
|
|
10
|
+
export * from "./TextMarkup";
|
|
11
|
+
export * from "./XMarkup";
|
|
12
|
+
export * from "./MarkupManager";
|
|
13
|
+
export * from "./Constants";
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import type { DxfData } from "../../core/dxf";
|
|
3
|
+
import type { PdfData } from "../../core/viewers";
|
|
4
|
+
/**
|
|
5
|
+
* Loaded 3d model info for BimViewer.
|
|
6
|
+
*/
|
|
7
|
+
export interface ModelData3d {
|
|
8
|
+
/**
|
|
9
|
+
* modelId that is unique for loaded models
|
|
10
|
+
*/
|
|
11
|
+
modelId: string;
|
|
12
|
+
/**
|
|
13
|
+
* Three.js object.
|
|
14
|
+
*/
|
|
15
|
+
object: THREE.Object3D;
|
|
16
|
+
/**
|
|
17
|
+
* Bounding box of the model.
|
|
18
|
+
*/
|
|
19
|
+
bbox?: THREE.Box3;
|
|
20
|
+
/**
|
|
21
|
+
* Edge objects of the model.
|
|
22
|
+
*/
|
|
23
|
+
edges?: THREE.LineSegments[];
|
|
24
|
+
/**
|
|
25
|
+
* TilesRenderer for 3dTiles
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
tilesRenderer?: any;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Loaded 2d model info for DxfViewer.
|
|
32
|
+
*/
|
|
33
|
+
export interface ModelData2d {
|
|
34
|
+
/**
|
|
35
|
+
* modelId that is unique for loaded models
|
|
36
|
+
*/
|
|
37
|
+
modelId: string;
|
|
38
|
+
/**
|
|
39
|
+
* Used for dxf data.
|
|
40
|
+
*/
|
|
41
|
+
dxfData?: DxfData;
|
|
42
|
+
/**
|
|
43
|
+
* Used for pdf data.
|
|
44
|
+
*/
|
|
45
|
+
pdfData?: PdfData;
|
|
46
|
+
/**
|
|
47
|
+
* Model space transform matrix.
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
msTransformMatrix?: THREE.Matrix4;
|
|
51
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
/**
|
|
3
|
+
* Base model class.
|
|
4
|
+
*/
|
|
5
|
+
export declare abstract class Model {
|
|
6
|
+
/**
|
|
7
|
+
* The model id, it should be unique in the lifecycle of a viewer.
|
|
8
|
+
*/
|
|
9
|
+
abstract modelId: string;
|
|
10
|
+
/**
|
|
11
|
+
* Gets the THREE.Object3D of this model.
|
|
12
|
+
*/
|
|
13
|
+
abstract getModelObject(): THREE.Object3D;
|
|
14
|
+
/**
|
|
15
|
+
* Gets the bounding box of this model.
|
|
16
|
+
*/
|
|
17
|
+
abstract getBBox(): THREE.Box3;
|
|
18
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import { ModelData2d } from "./Constants";
|
|
3
|
+
import { Units } from "../../core/Units";
|
|
4
|
+
import { DxfData } from "../../core/dxf";
|
|
5
|
+
import { ILayer, ILayoutObject, IPoint, IViewport, IViewportEntity } from "../../core/dxf-parser";
|
|
6
|
+
import { Model } from "../../core/model/Model";
|
|
7
|
+
import type { PdfData, PdfLayer } from "../../core/viewers/DxfViewer";
|
|
8
|
+
/**
|
|
9
|
+
* Loaded 2d model info for DxfViewer.
|
|
10
|
+
*/
|
|
11
|
+
export declare class Model2d extends Model {
|
|
12
|
+
modelId: string;
|
|
13
|
+
private modelData;
|
|
14
|
+
private bbox?;
|
|
15
|
+
constructor(modelData: ModelData2d);
|
|
16
|
+
get pdfData(): PdfData | undefined;
|
|
17
|
+
get dxfData(): DxfData | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
get msTransformMatrix(): THREE.Matrix4 | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
set msTransformMatrix(matrix: THREE.Matrix4 | undefined);
|
|
26
|
+
/**
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
get loadedEntityCount(): number;
|
|
30
|
+
/**
|
|
31
|
+
* Gets dxf data header.
|
|
32
|
+
*/
|
|
33
|
+
get header(): Record<string, number | IPoint> | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Gets dxf data viewports.
|
|
36
|
+
*/
|
|
37
|
+
get viewports(): IViewport[] | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Gets layers.
|
|
40
|
+
*/
|
|
41
|
+
get layers(): Record<string, ILayer | PdfLayer> | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Gets dxf data layoutViewportsMap.
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
46
|
+
get layoutViewportsMap(): Record<string, IViewportEntity[]> | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Gets three.js object of the model.
|
|
49
|
+
*/
|
|
50
|
+
getModelObject(): THREE.Object3D;
|
|
51
|
+
/**
|
|
52
|
+
* Gets model bounding box.
|
|
53
|
+
*/
|
|
54
|
+
getBBox(): THREE.Box3;
|
|
55
|
+
/**
|
|
56
|
+
* Gets dxf units.
|
|
57
|
+
* @internal
|
|
58
|
+
*/
|
|
59
|
+
getUnits(): Units;
|
|
60
|
+
/**
|
|
61
|
+
* Gets dxf model space extent.
|
|
62
|
+
* @internal
|
|
63
|
+
*/
|
|
64
|
+
getModelSpaceExtent(): THREE.Box3 | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Gets layer by layer name.
|
|
67
|
+
*/
|
|
68
|
+
getLayer(layerName: string): ILayer | PdfLayer | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* Gets layer object and three.js object by layer name.
|
|
71
|
+
*/
|
|
72
|
+
getObjectsByLayer(layerName: string): THREE.Object3D[] | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* Gets layout of dxf data.
|
|
75
|
+
*/
|
|
76
|
+
getLayouts(): ILayoutObject[];
|
|
77
|
+
/**
|
|
78
|
+
* Gets layout extent of dxf data.
|
|
79
|
+
* @internal
|
|
80
|
+
*/
|
|
81
|
+
getLayoutExtent(layout: ILayoutObject): THREE.Box3;
|
|
82
|
+
/**
|
|
83
|
+
* Gets layout viewports.
|
|
84
|
+
* @internal
|
|
85
|
+
*/
|
|
86
|
+
getLayoutViewports(layout: ILayoutObject): IViewportEntity[];
|
|
87
|
+
/**
|
|
88
|
+
* Gets the layout level three.js object.
|
|
89
|
+
*/
|
|
90
|
+
getLayoutLevelObject(layoutName: string): THREE.Object3D | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* Sets model visibility.
|
|
93
|
+
*/
|
|
94
|
+
setVisible(visible: boolean): void;
|
|
95
|
+
/**
|
|
96
|
+
* Sets layer visibility.
|
|
97
|
+
*/
|
|
98
|
+
setLayerVisible(layerName: string, visible: boolean, enableHideVisuallySmallObjects?: boolean, cameraZoom?: number): void;
|
|
99
|
+
/**
|
|
100
|
+
* Sets layer opacity.
|
|
101
|
+
*/
|
|
102
|
+
setLayerOpacity(layerName: string, opacity: number): void;
|
|
103
|
+
/**
|
|
104
|
+
* Sets layer color.
|
|
105
|
+
*/
|
|
106
|
+
setLayerColor(layerName: string, color: number): void;
|
|
107
|
+
/**
|
|
108
|
+
* Resets layer color.
|
|
109
|
+
*/
|
|
110
|
+
resetLayerColor(layerName: string): void;
|
|
111
|
+
/**
|
|
112
|
+
* @internal
|
|
113
|
+
*/
|
|
114
|
+
switchTransformMs(layoutName: string): void;
|
|
115
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Command } from "./Command";
|
|
2
|
+
import type { AnnotationPlugin } from "../../plugins/annotation/AnnotationPlugin";
|
|
3
|
+
import type { AnnotationData } from "../../plugins/annotation/BaseAnnotationDrawable";
|
|
4
|
+
export declare class AddAnnotationCommand extends Command {
|
|
5
|
+
private plugin;
|
|
6
|
+
private data;
|
|
7
|
+
constructor(plugin: AnnotationPlugin, data: AnnotationData);
|
|
8
|
+
execute(): void;
|
|
9
|
+
undo(): boolean;
|
|
10
|
+
redo(): boolean;
|
|
11
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command } from "./Command";
|
|
2
|
+
import type { MarkupManager } from "../../core/markup";
|
|
3
|
+
import type { MarkupData } from "../../core/viewers";
|
|
4
|
+
export declare class AddMarkupCommand extends Command {
|
|
5
|
+
private manager;
|
|
6
|
+
private data;
|
|
7
|
+
constructor(manager: MarkupManager, data: MarkupData);
|
|
8
|
+
undo(): boolean;
|
|
9
|
+
redo(): boolean;
|
|
10
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Command } from "./Command";
|
|
2
|
+
import type { MeasurementPlugin, MeasurementData } from "../../plugins/measure";
|
|
3
|
+
export declare class AddMeasurementCommand extends Command {
|
|
4
|
+
private manager;
|
|
5
|
+
private data;
|
|
6
|
+
constructor(manager: MeasurementPlugin, data: MeasurementData);
|
|
7
|
+
undo(): boolean;
|
|
8
|
+
redo(): boolean;
|
|
9
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Command } from "./Command";
|
|
2
|
+
import type { AnnotationPlugin } from "../../plugins/annotation/AnnotationPlugin";
|
|
3
|
+
import type { AnnotationData } from "../../plugins/annotation/BaseAnnotationDrawable";
|
|
4
|
+
export declare class RemoveAnnotationCommand extends Command {
|
|
5
|
+
private plugin;
|
|
6
|
+
private data;
|
|
7
|
+
constructor(plugin: AnnotationPlugin, data: AnnotationData);
|
|
8
|
+
execute(): void;
|
|
9
|
+
undo(): boolean;
|
|
10
|
+
redo(): boolean;
|
|
11
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command } from "./Command";
|
|
2
|
+
import type { MarkupManager } from "../../core/markup";
|
|
3
|
+
import type { MarkupData } from "../../core/viewers";
|
|
4
|
+
export declare class RemoveMarkupCommand extends Command {
|
|
5
|
+
private manager;
|
|
6
|
+
private data;
|
|
7
|
+
constructor(manager: MarkupManager, data: MarkupData);
|
|
8
|
+
undo(): boolean;
|
|
9
|
+
redo(): boolean;
|
|
10
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Command } from "./Command";
|
|
2
|
+
import type { MeasurementPlugin, MeasurementData } from "../../plugins/measure";
|
|
3
|
+
export declare class RemoveMeasurementCommand extends Command {
|
|
4
|
+
private manager;
|
|
5
|
+
private data;
|
|
6
|
+
constructor(manager: MeasurementPlugin, data: MeasurementData);
|
|
7
|
+
undo(): boolean;
|
|
8
|
+
redo(): boolean;
|
|
9
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Command } from "./Command";
|
|
2
|
+
declare type CommandData = Command | Command[];
|
|
3
|
+
export declare class UndoRedoManager {
|
|
4
|
+
private history;
|
|
5
|
+
private step;
|
|
6
|
+
private maxCount;
|
|
7
|
+
private isBatchCommand;
|
|
8
|
+
private batchCommands;
|
|
9
|
+
constructor(maxCount?: number);
|
|
10
|
+
addCommand(command: Command): void;
|
|
11
|
+
startTransaction(): void;
|
|
12
|
+
endTransaction(): void;
|
|
13
|
+
undo(): boolean;
|
|
14
|
+
redo(): boolean;
|
|
15
|
+
getCommands(): CommandData[];
|
|
16
|
+
canUndo(): boolean;
|
|
17
|
+
canRedo(): boolean;
|
|
18
|
+
clear(): void;
|
|
19
|
+
destroy(): void;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Command } from "./Command";
|
|
2
|
+
import type { MarkupManager } from "../../core/markup";
|
|
3
|
+
import type { MarkupData } from "../../core/viewers";
|
|
4
|
+
export declare class UpdateMarkupCommand extends Command {
|
|
5
|
+
private manager;
|
|
6
|
+
private oldData;
|
|
7
|
+
private newData;
|
|
8
|
+
constructor(manager: MarkupManager, oldData: MarkupData, newData: MarkupData);
|
|
9
|
+
undo(): boolean;
|
|
10
|
+
redo(): boolean;
|
|
11
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./UndoRedoManager";
|
|
2
|
+
export * from "./Command";
|
|
3
|
+
export * from "./AddMarkupCommand";
|
|
4
|
+
export * from "./UpdateMarkupCommand";
|
|
5
|
+
export * from "./RemoveMarkupCommand";
|
|
6
|
+
export * from "./AddMeasurementCommand";
|
|
7
|
+
export * from "./RemoveMeasurementCommand";
|
|
8
|
+
export * from "./AddAnnotationCommand";
|
|
9
|
+
export * from "./RemoveAnnotationCommand";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CSS2DObject } from "three/examples/jsm/renderers/CSS2DRenderer.js";
|
|
2
|
+
export declare class CSS2DObjectUtils {
|
|
3
|
+
/**
|
|
4
|
+
* Creates CSS2DObject with HTMLElement
|
|
5
|
+
*/
|
|
6
|
+
static createCSS2DObject(element: HTMLElement): CSS2DObject;
|
|
7
|
+
static createDefaultHotpoint(size?: number): CSS2DObject;
|
|
8
|
+
static createHotpoint(html?: string): CSS2DObject;
|
|
9
|
+
static createLabel(label: string, cssClass?: string): CSS2DObject;
|
|
10
|
+
/**
|
|
11
|
+
* Recursively find "dataset.objectId" of a HTMLElement
|
|
12
|
+
*/
|
|
13
|
+
static tryFindObjectId(element: HTMLElement): number | undefined;
|
|
14
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare class ColorUtils {
|
|
2
|
+
static color2rgba(style: string): [number, number, number, number];
|
|
3
|
+
static rgba2Color(rgba: number[]): string;
|
|
4
|
+
/**
|
|
5
|
+
* Converts color string in format "rgba(255, 255, 255, 1)" to rgba number array.
|
|
6
|
+
*/
|
|
7
|
+
static colorStr2Rgba(colorStr: string): number[];
|
|
8
|
+
/**
|
|
9
|
+
* Converts rgb or rgba to hex number.
|
|
10
|
+
* @param rgba Color value is between 0 and 1.
|
|
11
|
+
*/
|
|
12
|
+
static rgb2Hex(rgba: number[]): number;
|
|
13
|
+
/**
|
|
14
|
+
* Maps a value between 0 and 1 to 0 and 255.
|
|
15
|
+
*/
|
|
16
|
+
private static to255;
|
|
17
|
+
/**
|
|
18
|
+
* Maps a value between 0 and 255 to 0 and 1.
|
|
19
|
+
*/
|
|
20
|
+
private static to1;
|
|
21
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import { IconClass } from "../Configs";
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export declare class CommonUtils {
|
|
7
|
+
/**
|
|
8
|
+
* Checks full screen mode
|
|
9
|
+
*/
|
|
10
|
+
static isFullScreen(): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Enters full screen mode
|
|
13
|
+
*/
|
|
14
|
+
static fullScreen(element?: HTMLElement): void;
|
|
15
|
+
/**
|
|
16
|
+
* Exits full screen mode
|
|
17
|
+
*/
|
|
18
|
+
static exitFullscreen(): void;
|
|
19
|
+
/**
|
|
20
|
+
* Displays a pointer marker in a period of time.
|
|
21
|
+
* @param duration display time in ms. 0/null/undefined means always display.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Join strings
|
|
25
|
+
* @param args
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
28
|
+
static joinStrings(...args: string[]): string;
|
|
29
|
+
/**
|
|
30
|
+
* Converts a number to a string with proper fraction digits
|
|
31
|
+
*/
|
|
32
|
+
static numberToString(num: number): string;
|
|
33
|
+
static hexToBase64(hexstring: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* Converts vector to a string with proper fraction digits
|
|
36
|
+
*/
|
|
37
|
+
static vectorToString(vec: THREE.Vector2 | THREE.Vector3): string;
|
|
38
|
+
/**
|
|
39
|
+
* Converts number array to THREE.Vector2
|
|
40
|
+
*/
|
|
41
|
+
static arrayToVector2(arr: number[] | THREE.Vector2 | undefined): THREE.Vector2 | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Converts number array to THREE.Vector3
|
|
44
|
+
* If length of arr is 2, will assign z value to 0
|
|
45
|
+
*/
|
|
46
|
+
static arrayToVector3(arr: number[] | THREE.Vector3 | undefined): THREE.Vector3 | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Converts number array to THREE.Euler
|
|
49
|
+
*/
|
|
50
|
+
static arrayToEuler(arr: number[] | THREE.Euler | undefined): THREE.Euler | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Converts number array to THREE.Vector3
|
|
53
|
+
*/
|
|
54
|
+
static arrayOrObjectToVector3(arrOrObj: number[] | THREE.Vector3 | undefined): THREE.Vector3 | undefined;
|
|
55
|
+
static isVectorValid(vec: THREE.Vector2 | THREE.Vector3): boolean;
|
|
56
|
+
static isBoxValid(box: THREE.Box2 | THREE.Box3): boolean;
|
|
57
|
+
static isMatrixValid(matrix: THREE.Matrix4): boolean;
|
|
58
|
+
static guid(): string;
|
|
59
|
+
/**
|
|
60
|
+
* Expands given box by a scale factor
|
|
61
|
+
*/
|
|
62
|
+
static expandBoxByScale(box: THREE.Box3, scale: number): void;
|
|
63
|
+
/**
|
|
64
|
+
* Expands given box by a min size
|
|
65
|
+
*/
|
|
66
|
+
static expandBoxByMinSize(box: THREE.Box3, minSize: number): void;
|
|
67
|
+
/**
|
|
68
|
+
* Generate random integers in the range [min, max]
|
|
69
|
+
*/
|
|
70
|
+
static generateRandomInt(min: number, max: number): number;
|
|
71
|
+
/**
|
|
72
|
+
* Round to N decimal places
|
|
73
|
+
*/
|
|
74
|
+
static roundNumber(value: number, n: number): number;
|
|
75
|
+
static convertDecimalToHex(decimal: number | string): string;
|
|
76
|
+
static canvasToImage(canvas: HTMLCanvasElement): Promise<HTMLImageElement>;
|
|
77
|
+
/**
|
|
78
|
+
* Takes screenshot to given rendering context and return base64 string in png/jpeg format.
|
|
79
|
+
* @param bbox If valid, takes screenshot of a sub image with given bounding box in screen coordinate.
|
|
80
|
+
*/
|
|
81
|
+
static renderingContextToImage(context: CanvasRenderingContext2D, bbox?: THREE.Box2, type?: string, quality?: number): string;
|
|
82
|
+
/**
|
|
83
|
+
* Prints memory usage
|
|
84
|
+
*/
|
|
85
|
+
static printMemory(title: string): void;
|
|
86
|
+
static printGpuInfo(webgl: WebGLRenderingContext): void;
|
|
87
|
+
/**
|
|
88
|
+
* Sleep a while
|
|
89
|
+
*/
|
|
90
|
+
static sleep(ms: number): Promise<void>;
|
|
91
|
+
private static twinklingObjectIds;
|
|
92
|
+
/**
|
|
93
|
+
* Twinkle the object several times
|
|
94
|
+
*/
|
|
95
|
+
static twinkle(obj: THREE.Object3D, ms?: number): Promise<void>;
|
|
96
|
+
/**
|
|
97
|
+
* Gets a function to update progress.
|
|
98
|
+
* @param onProgress onProgress callback.
|
|
99
|
+
*/
|
|
100
|
+
static getUpdateProgressFunc(onProgress?: (e: ProgressEvent) => void): (progress: number) => void;
|
|
101
|
+
/**
|
|
102
|
+
* Gets an async function to update progress.
|
|
103
|
+
* The reason to use async function is, in order to give UI thread chance to update the progress!
|
|
104
|
+
* @param onProgress onProgress callback.
|
|
105
|
+
*/
|
|
106
|
+
static getUpdateProgressFuncAsync(onProgress?: (e: ProgressEvent) => void): (progress: number) => Promise<void>;
|
|
107
|
+
/**
|
|
108
|
+
* Gets an async function to update progress for a for/while loop.
|
|
109
|
+
* @param total Total number of a for/while loop.
|
|
110
|
+
* @param onProgress onProgress callback.
|
|
111
|
+
*/
|
|
112
|
+
static getUpdateProgressFuncForLoop(total: number, onProgress?: (e: ProgressEvent) => void): (i: number) => Promise<void>;
|
|
113
|
+
/**
|
|
114
|
+
* Gets a function to update sub progress, which has a progress range limitation according to its parent progress.
|
|
115
|
+
* @param min Min range number between 0-100
|
|
116
|
+
* @param max Max range number between 0-100
|
|
117
|
+
* @param onProgress onProgress callback.
|
|
118
|
+
* @returns
|
|
119
|
+
*/
|
|
120
|
+
static getUpdateSubProgressFunc(min: number, max: number, onProgress?: (e: ProgressEvent) => void): (e: ProgressEvent) => void;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* @internal
|
|
124
|
+
*/
|
|
125
|
+
export declare const setIcon: (classList: DOMTokenList, iconClass: IconClass, active: boolean) => void;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import type { EventInfo, IPointerEvent } from "../../core/input/InputManager";
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
* Some concepts:
|
|
6
|
+
*
|
|
7
|
+
* 1. Screen coordinate:
|
|
8
|
+
* (0, 0)
|
|
9
|
+
* ----------------------> x
|
|
10
|
+
* | |
|
|
11
|
+
* | |
|
|
12
|
+
* | |
|
|
13
|
+
* | |
|
|
14
|
+
* |___________________|
|
|
15
|
+
* y (1024, 768) e.g.
|
|
16
|
+
*
|
|
17
|
+
* 2. Normalized screen coordinate:
|
|
18
|
+
* (0, 0)
|
|
19
|
+
* ----------------------> x
|
|
20
|
+
* | |
|
|
21
|
+
* | |
|
|
22
|
+
* | |
|
|
23
|
+
* | |
|
|
24
|
+
* |___________________|
|
|
25
|
+
* y (1, 1)
|
|
26
|
+
*
|
|
27
|
+
* 3. NDC: Normalized Device Coordinates
|
|
28
|
+
* ^ y (1, 1)
|
|
29
|
+
* |
|
|
30
|
+
* (-1, 0) |(0, 0) (1, 0)
|
|
31
|
+
* ----------------------> x
|
|
32
|
+
* |
|
|
33
|
+
* |
|
|
34
|
+
* (-1, -1)
|
|
35
|
+
*
|
|
36
|
+
* 4. World Coordinates
|
|
37
|
+
* ^ y
|
|
38
|
+
* |
|
|
39
|
+
* | / x
|
|
40
|
+
* | /
|
|
41
|
+
* | /
|
|
42
|
+
* ---------------> z
|
|
43
|
+
* (0, 0)
|
|
44
|
+
*/
|
|
45
|
+
export declare class CoordinateUtils {
|
|
46
|
+
/**
|
|
47
|
+
* Gets screen coordinate by pointer event.
|
|
48
|
+
*/
|
|
49
|
+
static getScreenCoordinateByEvent(event: IPointerEvent | EventInfo | MouseEvent | PointerEvent, container: HTMLElement): THREE.Vector2;
|
|
50
|
+
/**
|
|
51
|
+
* Gets screen coordinate by touch event.
|
|
52
|
+
*/
|
|
53
|
+
static getScreenCoordinateByTouchEvent(event: TouchEvent, container: HTMLElement): THREE.Vector2;
|
|
54
|
+
/**
|
|
55
|
+
* Converts world to screen coordinate.
|
|
56
|
+
*/
|
|
57
|
+
static world2Screen(vector: THREE.Vector3, camera: THREE.Camera, container: HTMLElement): THREE.Vector2;
|
|
58
|
+
/**
|
|
59
|
+
* Converts a bbox under world coordinate to screen coordinate.
|
|
60
|
+
*/
|
|
61
|
+
static worldBBox2Screen(bbox: THREE.Box3, camera: THREE.Camera, container: HTMLElement): THREE.Box2;
|
|
62
|
+
/**
|
|
63
|
+
* Converts screen to world coordinate.
|
|
64
|
+
*/
|
|
65
|
+
static screen2World(vector: THREE.Vector2, camera: THREE.Camera, container: HTMLElement): THREE.Vector3;
|
|
66
|
+
/**
|
|
67
|
+
* Converts screen point to NDC coordinate.
|
|
68
|
+
* @description {en} Normalized screen coordinate: bottom-left(-1, -1), top-right(1, 1).
|
|
69
|
+
* @description {zh} 标准化屏幕坐标:左下角(-1, -1), 右上角(1, 1)。
|
|
70
|
+
* @description {en} World coordinate to normalized screen coordinate(0-1).
|
|
71
|
+
* @description {zh} 世界坐标转标准化屏幕坐标(0-1)。
|
|
72
|
+
*/
|
|
73
|
+
static screen2Ndc(vector: THREE.Vector2, camera: THREE.Camera, container: HTMLElement): THREE.Vector2;
|
|
74
|
+
/**
|
|
75
|
+
* @description {en} Normalized screen coordinate: top-left(0, 0), bottom-right(1, 1).
|
|
76
|
+
* @description {zh} 标准化屏幕坐标:左上角(0, 0), 右下角(1, 1)。
|
|
77
|
+
* @description {en} World coordinate to normalized screen coordinate(0-1).
|
|
78
|
+
* @description {zh} 世界坐标转标准化屏幕坐标(0-1)。
|
|
79
|
+
*/
|
|
80
|
+
static world2NormalizedScreen(worldCoord: THREE.Vector2 | THREE.Vector3, camera: THREE.Camera, container: HTMLElement): THREE.Vector2;
|
|
81
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Device util class
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export declare class DeviceUtils {
|
|
6
|
+
/**
|
|
7
|
+
* Checks if it is opened in touch screen device, like iphone, ipad, etc.
|
|
8
|
+
*/
|
|
9
|
+
static isTouchScreenDevice(): boolean;
|
|
10
|
+
static printDeviceInfo(): void;
|
|
11
|
+
static isMobile: boolean;
|
|
12
|
+
static creatReactNativeCanvas(context: WebGLRenderingContext | WebGL2RenderingContext | CanvasRenderingContext2D): HTMLCanvasElement;
|
|
13
|
+
static isBrowser: boolean;
|
|
14
|
+
static isNode: boolean;
|
|
15
|
+
}
|