@inweb/client 25.3.12 → 25.3.13
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 +17 -35
- package/dist/client.js +16 -17365
- package/dist/client.js.map +1 -1
- package/dist/client.min.js +1 -1
- package/dist/client.module.js +3 -5553
- package/dist/client.module.js.map +1 -1
- package/lib/Api/Assembly.d.ts +0 -1
- package/lib/Api/ClashTest.d.ts +0 -1
- package/lib/Api/Client.d.ts +1 -2
- package/lib/Api/ClientEvents.d.ts +0 -1
- package/lib/Api/File.d.ts +0 -1
- package/lib/Api/HttpClient.d.ts +0 -1
- package/lib/Api/IAssembly.d.ts +0 -1
- package/lib/Api/IFile.d.ts +0 -1
- package/lib/Api/IHttpClient.d.ts +0 -1
- package/lib/Api/IUser.d.ts +0 -1
- package/lib/Api/Job.d.ts +0 -1
- package/lib/Api/Member.d.ts +0 -1
- package/lib/Api/Model.d.ts +0 -1
- package/lib/Api/Permission.d.ts +0 -1
- package/lib/Api/Project.d.ts +0 -1
- package/lib/Api/Role.d.ts +0 -1
- package/lib/Api/User.d.ts +0 -1
- package/lib/Api/impl/FetchError.d.ts +0 -1
- package/lib/Api/impl/Utils.d.ts +0 -1
- package/lib/Api/impl/http.d.ts +0 -1
- package/lib/ConvetMath.d.ts +0 -1
- package/lib/index.d.ts +1 -13
- package/package.json +5 -11
- package/src/Api/Client.ts +2 -1
- package/src/index.ts +1 -13
- package/lib/Viewer/CanvasEvents.d.ts +0 -2
- package/lib/Viewer/Commands/ApplyModelTransform.d.ts +0 -2
- package/lib/Viewer/Commands/ClearMarkup.d.ts +0 -2
- package/lib/Viewer/Commands/ClearSlices.d.ts +0 -2
- package/lib/Viewer/Commands/CreatePreview.d.ts +0 -2
- package/lib/Viewer/Commands/Explode.d.ts +0 -2
- package/lib/Viewer/Commands/GetDefaultViewPositions.d.ts +0 -2
- package/lib/Viewer/Commands/GetModels.d.ts +0 -2
- package/lib/Viewer/Commands/GetSelected.d.ts +0 -2
- package/lib/Viewer/Commands/HideSelected.d.ts +0 -2
- package/lib/Viewer/Commands/IsolateSelected.d.ts +0 -2
- package/lib/Viewer/Commands/RegenerateAll.d.ts +0 -2
- package/lib/Viewer/Commands/ResetView.d.ts +0 -2
- package/lib/Viewer/Commands/SelectModel.d.ts +0 -2
- package/lib/Viewer/Commands/SetActiveDragger.d.ts +0 -2
- package/lib/Viewer/Commands/SetDefaultViewPosition.d.ts +0 -2
- package/lib/Viewer/Commands/SetMarkupColor.d.ts +0 -2
- package/lib/Viewer/Commands/SetSelected.d.ts +0 -2
- package/lib/Viewer/Commands/ShowAll.d.ts +0 -2
- package/lib/Viewer/Commands/Unselect.d.ts +0 -2
- package/lib/Viewer/Commands/ZoomToExtents.d.ts +0 -2
- package/lib/Viewer/Commands/ZoomToObjects.d.ts +0 -2
- package/lib/Viewer/Commands/ZoomToSelected.d.ts +0 -2
- package/lib/Viewer/Commands.d.ts +0 -3
- package/lib/Viewer/Draggers/Actions/OrbitAction.d.ts +0 -22
- package/lib/Viewer/Draggers/Actions/PanAction.d.ts +0 -18
- package/lib/Viewer/Draggers/Actions/ZoomAction.d.ts +0 -8
- package/lib/Viewer/Draggers/Common/Geometry.d.ts +0 -115
- package/lib/Viewer/Draggers/Common/GestureManager.d.ts +0 -41
- package/lib/Viewer/Draggers/Common/OdBaseDragger.d.ts +0 -54
- package/lib/Viewer/Draggers/Common/OdaGeAction.d.ts +0 -30
- package/lib/Viewer/Draggers/MeasureLineDragger/MeasureLineItem.d.ts +0 -31
- package/lib/Viewer/Draggers/MeasureLineDragger/MeasureUtils.d.ts +0 -20
- package/lib/Viewer/Draggers/MeasureLineDragger/index.d.ts +0 -24
- package/lib/Viewer/Draggers/OdBaseCuttingPlaneDragger.d.ts +0 -27
- package/lib/Viewer/Draggers/OdCuttingPlaneXAxisDragger.d.ts +0 -8
- package/lib/Viewer/Draggers/OdCuttingPlaneYAxisDragger.d.ts +0 -8
- package/lib/Viewer/Draggers/OdCuttingPlaneZAxisDragger.d.ts +0 -8
- package/lib/Viewer/Draggers/OdOrbitDragger.d.ts +0 -15
- package/lib/Viewer/Draggers/OdPanDragger.d.ts +0 -12
- package/lib/Viewer/Draggers/OdZoomDragger.d.ts +0 -12
- package/lib/Viewer/Draggers/OdZoomWheelDragger.d.ts +0 -11
- package/lib/Viewer/Draggers/OdZoomWindowDragger/OdSelectionFrame.d.ts +0 -19
- package/lib/Viewer/Draggers/OdZoomWindowDragger/index.d.ts +0 -14
- package/lib/Viewer/Draggers/OdaLineDragger.d.ts +0 -15
- package/lib/Viewer/Draggers/OdaTextDragger.d.ts +0 -16
- package/lib/Viewer/Draggers/OdaWalkDragger.d.ts +0 -30
- package/lib/Viewer/Draggers/OrbitAroundBuildingDragger.d.ts +0 -19
- package/lib/Viewer/EventEmitter2.d.ts +0 -54
- package/lib/Viewer/ICommands.d.ts +0 -25
- package/lib/Viewer/IEventEmitter2.d.ts +0 -13
- package/lib/Viewer/IViewer.d.ts +0 -30
- package/lib/Viewer/Loaders/BaseLoader.d.ts +0 -11
- package/lib/Viewer/Loaders/LoaderFactory.d.ts +0 -11
- package/lib/Viewer/Loaders/TCSLoader.d.ts +0 -5
- package/lib/Viewer/Loaders/UpdaterController.d.ts +0 -15
- package/lib/Viewer/Loaders/VsfXLoader.d.ts +0 -5
- package/lib/Viewer/Loaders/VsfXPartialLoader.d.ts +0 -5
- package/lib/Viewer/Loaders/VsfXStreamingLoader.d.ts +0 -5
- package/lib/Viewer/Markup/Api/IMarkupArrow.d.ts +0 -22
- package/lib/Viewer/Markup/Api/IMarkupCloud.d.ts +0 -15
- package/lib/Viewer/Markup/Api/IMarkupColorable.d.ts +0 -5
- package/lib/Viewer/Markup/Api/IMarkupEllipse.d.ts +0 -15
- package/lib/Viewer/Markup/Api/IMarkupImage.d.ts +0 -15
- package/lib/Viewer/Markup/Api/IMarkupLine.d.ts +0 -13
- package/lib/Viewer/Markup/Api/IMarkupObject.d.ts +0 -12
- package/lib/Viewer/Markup/Api/IMarkupRectangle.d.ts +0 -15
- package/lib/Viewer/Markup/Api/IMarkupText.d.ts +0 -13
- package/lib/Viewer/Markup/Api/Impl/Konva/KonvaArrow.d.ts +0 -47
- package/lib/Viewer/Markup/Api/Impl/Konva/KonvaCloud.d.ts +0 -36
- package/lib/Viewer/Markup/Api/Impl/Konva/KonvaEllipse.d.ts +0 -41
- package/lib/Viewer/Markup/Api/Impl/Konva/KonvaImage.d.ts +0 -37
- package/lib/Viewer/Markup/Api/Impl/Konva/KonvaLine.d.ts +0 -37
- package/lib/Viewer/Markup/Api/Impl/Konva/KonvaRectangle.d.ts +0 -39
- package/lib/Viewer/Markup/Api/Impl/Konva/KonvaText.d.ts +0 -38
- package/lib/Viewer/Markup/IMarkup.d.ts +0 -40
- package/lib/Viewer/Markup/IViewpoint.d.ts +0 -129
- package/lib/Viewer/Markup/Impl/Konva/KonvaMarkup.d.ts +0 -72
- package/lib/Viewer/Markup/Impl/Konva/MarkupColor.d.ts +0 -19
- package/lib/Viewer/Markup/Impl/Visualize/VisualizeMarkup.d.ts +0 -34
- package/lib/Viewer/Markup/MarkupFactory.d.ts +0 -7
- package/lib/Viewer/Options.d.ts +0 -239
- package/lib/Viewer/OptionsEvents.d.ts +0 -26
- package/lib/Viewer/Viewer.d.ts +0 -354
- package/lib/Viewer/ViewerCommands.d.ts +0 -23
- package/lib/Viewer/ViewerEvents.d.ts +0 -602
- package/lib/Viewer/utils.d.ts +0 -4
- package/src/Viewer/CanvasEvents.ts +0 -41
- package/src/Viewer/Commands/ApplyModelTransform.ts +0 -70
- package/src/Viewer/Commands/ClearMarkup.ts +0 -28
- package/src/Viewer/Commands/ClearSlices.ts +0 -27
- package/src/Viewer/Commands/CreatePreview.ts +0 -33
- package/src/Viewer/Commands/Explode.ts +0 -38
- package/src/Viewer/Commands/GetDefaultViewPositions.ts +0 -36
- package/src/Viewer/Commands/GetModels.ts +0 -43
- package/src/Viewer/Commands/GetSelected.ts +0 -58
- package/src/Viewer/Commands/HideSelected.ts +0 -37
- package/src/Viewer/Commands/IsolateSelected.ts +0 -37
- package/src/Viewer/Commands/RegenerateAll.ts +0 -37
- package/src/Viewer/Commands/ResetView.ts +0 -43
- package/src/Viewer/Commands/SelectModel.ts +0 -52
- package/src/Viewer/Commands/SetActiveDragger.ts +0 -29
- package/src/Viewer/Commands/SetDefaultViewPosition.ts +0 -50
- package/src/Viewer/Commands/SetMarkupColor.ts +0 -29
- package/src/Viewer/Commands/SetSelected.ts +0 -47
- package/src/Viewer/Commands/ShowAll.ts +0 -37
- package/src/Viewer/Commands/Unselect.ts +0 -37
- package/src/Viewer/Commands/ZoomToExtents.ts +0 -43
- package/src/Viewer/Commands/ZoomToObjects.ts +0 -47
- package/src/Viewer/Commands/ZoomToSelected.ts +0 -39
- package/src/Viewer/Commands.ts +0 -81
- package/src/Viewer/Draggers/Actions/OrbitAction.ts +0 -250
- package/src/Viewer/Draggers/Actions/PanAction.ts +0 -102
- package/src/Viewer/Draggers/Actions/ZoomAction.ts +0 -45
- package/src/Viewer/Draggers/Common/Geometry.ts +0 -152
- package/src/Viewer/Draggers/Common/GestureManager.ts +0 -263
- package/src/Viewer/Draggers/Common/OdBaseDragger.ts +0 -270
- package/src/Viewer/Draggers/Common/OdaGeAction.ts +0 -146
- package/src/Viewer/Draggers/MeasureLineDragger/MeasureLineItem.ts +0 -248
- package/src/Viewer/Draggers/MeasureLineDragger/MeasureUtils.ts +0 -182
- package/src/Viewer/Draggers/MeasureLineDragger/index.ts +0 -166
- package/src/Viewer/Draggers/OdBaseCuttingPlaneDragger.ts +0 -182
- package/src/Viewer/Draggers/OdCuttingPlaneXAxisDragger.ts +0 -53
- package/src/Viewer/Draggers/OdCuttingPlaneYAxisDragger.ts +0 -53
- package/src/Viewer/Draggers/OdCuttingPlaneZAxisDragger.ts +0 -53
- package/src/Viewer/Draggers/OdOrbitDragger.ts +0 -70
- package/src/Viewer/Draggers/OdPanDragger.ts +0 -62
- package/src/Viewer/Draggers/OdZoomDragger.ts +0 -59
- package/src/Viewer/Draggers/OdZoomWheelDragger.ts +0 -103
- package/src/Viewer/Draggers/OdZoomWindowDragger/OdSelectionFrame.ts +0 -123
- package/src/Viewer/Draggers/OdZoomWindowDragger/index.ts +0 -75
- package/src/Viewer/Draggers/OdaLineDragger.ts +0 -80
- package/src/Viewer/Draggers/OdaTextDragger.ts +0 -118
- package/src/Viewer/Draggers/OdaWalkDragger.ts +0 -278
- package/src/Viewer/Draggers/OrbitAroundBuildingDragger.ts +0 -184
- package/src/Viewer/EventEmitter2.ts +0 -116
- package/src/Viewer/ICommands.ts +0 -53
- package/src/Viewer/IEventEmitter2.ts +0 -36
- package/src/Viewer/IViewer.ts +0 -59
- package/src/Viewer/Loaders/BaseLoader.ts +0 -40
- package/src/Viewer/Loaders/LoaderFactory.ts +0 -47
- package/src/Viewer/Loaders/TCSLoader.ts +0 -82
- package/src/Viewer/Loaders/UpdaterController.ts +0 -36
- package/src/Viewer/Loaders/VsfXLoader.ts +0 -65
- package/src/Viewer/Loaders/VsfXPartialLoader.ts +0 -208
- package/src/Viewer/Loaders/VsfXStreamingLoader.ts +0 -87
- package/src/Viewer/Markup/Api/IMarkupArrow.ts +0 -12
- package/src/Viewer/Markup/Api/IMarkupCloud.ts +0 -15
- package/src/Viewer/Markup/Api/IMarkupColorable.ts +0 -4
- package/src/Viewer/Markup/Api/IMarkupEllipse.ts +0 -15
- package/src/Viewer/Markup/Api/IMarkupImage.ts +0 -15
- package/src/Viewer/Markup/Api/IMarkupLine.ts +0 -13
- package/src/Viewer/Markup/Api/IMarkupObject.ts +0 -15
- package/src/Viewer/Markup/Api/IMarkupRectangle.ts +0 -15
- package/src/Viewer/Markup/Api/IMarkupText.ts +0 -12
- package/src/Viewer/Markup/Api/Impl/Konva/KonvaArrow.ts +0 -117
- package/src/Viewer/Markup/Api/Impl/Konva/KonvaCloud.ts +0 -208
- package/src/Viewer/Markup/Api/Impl/Konva/KonvaEllipse.ts +0 -118
- package/src/Viewer/Markup/Api/Impl/Konva/KonvaImage.ts +0 -123
- package/src/Viewer/Markup/Api/Impl/Konva/KonvaLine.ts +0 -131
- package/src/Viewer/Markup/Api/Impl/Konva/KonvaRectangle.ts +0 -119
- package/src/Viewer/Markup/Api/Impl/Konva/KonvaText.ts +0 -110
- package/src/Viewer/Markup/IMarkup.ts +0 -41
- package/src/Viewer/Markup/IViewpoint.ts +0 -146
- package/src/Viewer/Markup/Impl/Konva/KonvaMarkup.ts +0 -1144
- package/src/Viewer/Markup/Impl/Konva/MarkupColor.ts +0 -39
- package/src/Viewer/Markup/Impl/Visualize/VisualizeMarkup.ts +0 -228
- package/src/Viewer/Markup/MarkupFactory.ts +0 -32
- package/src/Viewer/Options.ts +0 -527
- package/src/Viewer/OptionsEvents.ts +0 -28
- package/src/Viewer/Viewer.ts +0 -1182
- package/src/Viewer/ViewerCommands.ts +0 -45
- package/src/Viewer/ViewerEvents.ts +0 -705
- package/src/Viewer/utils.ts +0 -74
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
-
// Copyright (C) 2002-2021, Open Design Alliance (the "Alliance").
|
|
3
|
-
// All rights reserved.
|
|
4
|
-
//
|
|
5
|
-
// This software and its documentation and related materials are owned by
|
|
6
|
-
// the Alliance. The software may only be incorporated into application
|
|
7
|
-
// programs owned by members of the Alliance, subject to a signed
|
|
8
|
-
// Membership Agreement and Supplemental Software License Agreement with the
|
|
9
|
-
// Alliance. The structure and organization of this software are the valuable
|
|
10
|
-
// trade secrets of the Alliance and its suppliers. The software is also
|
|
11
|
-
// protected by copyright law and international treaty provisions. Application
|
|
12
|
-
// programs incorporating this software must include the following statement
|
|
13
|
-
// with their copyright notices:
|
|
14
|
-
//
|
|
15
|
-
// This application incorporates Open Design Alliance software pursuant to a
|
|
16
|
-
// license agreement with Open Design Alliance.
|
|
17
|
-
// Open Design Alliance Copyright (C) 2002-2021 by Open Design Alliance.
|
|
18
|
-
// All rights reserved.
|
|
19
|
-
//
|
|
20
|
-
// By use of this software, its documentation or related materials, you
|
|
21
|
-
// acknowledge and accept the above terms.
|
|
22
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
23
|
-
|
|
24
|
-
import { BaseLoader } from "./BaseLoader";
|
|
25
|
-
import { UpdaterController, UpdateType } from "./UpdaterController";
|
|
26
|
-
|
|
27
|
-
export class VsfXStreamingLoader extends BaseLoader {
|
|
28
|
-
override async load(): Promise<void> {
|
|
29
|
-
if (!this.viewer.visualizeJs) return;
|
|
30
|
-
|
|
31
|
-
const visLib = this.viewer.visLib();
|
|
32
|
-
const visViewer = visLib.getViewer();
|
|
33
|
-
const abortController = new AbortController();
|
|
34
|
-
|
|
35
|
-
const updaterController = new UpdaterController();
|
|
36
|
-
updaterController.initialize(this.viewer);
|
|
37
|
-
|
|
38
|
-
this.viewer._abortController = abortController;
|
|
39
|
-
|
|
40
|
-
let isFireDatabaseChunk = false;
|
|
41
|
-
|
|
42
|
-
const chunkLoadHandler = (progress, data) => {
|
|
43
|
-
if (!this.viewer.visualizeJs) return;
|
|
44
|
-
|
|
45
|
-
const status = visViewer.parseVsfx(data);
|
|
46
|
-
updaterController.update(UpdateType.kDelay);
|
|
47
|
-
|
|
48
|
-
this.viewer.emitEvent({ type: "geometryprogress", data: progress, model: this.model });
|
|
49
|
-
|
|
50
|
-
let state = false;
|
|
51
|
-
if (
|
|
52
|
-
status === visLib.DatabaseStreamStatus.ReadyServiceData ||
|
|
53
|
-
(status === visLib.DatabaseStreamStatus.Complete && !isFireDatabaseChunk)
|
|
54
|
-
) {
|
|
55
|
-
isFireDatabaseChunk = true;
|
|
56
|
-
state = true;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (state) {
|
|
60
|
-
updaterController.update(UpdateType.kForce);
|
|
61
|
-
|
|
62
|
-
this.viewer.syncOpenCloudVisualStyle(false);
|
|
63
|
-
this.viewer.syncOptions();
|
|
64
|
-
this.viewer.resize();
|
|
65
|
-
|
|
66
|
-
this.viewer.emitEvent({ type: "databasechunk", data, model: this.model });
|
|
67
|
-
} else {
|
|
68
|
-
this.viewer.emitEvent({ type: "geometrychunk", data, model: this.model });
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
console.time("File load time");
|
|
73
|
-
try {
|
|
74
|
-
this.viewer.emitEvent({ type: "geometrystart", model: this.model });
|
|
75
|
-
|
|
76
|
-
await this.model.partialDownloadResource(this.model.database, chunkLoadHandler, abortController.signal);
|
|
77
|
-
console.timeEnd("File load time");
|
|
78
|
-
|
|
79
|
-
updaterController.update(UpdateType.kNormal);
|
|
80
|
-
|
|
81
|
-
this.viewer.emitEvent({ type: "geometryend", model: this.model });
|
|
82
|
-
} catch (error) {
|
|
83
|
-
this.viewer.emitEvent({ type: "geometryerror", data: error, model: this.model });
|
|
84
|
-
throw error;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { IMarkupObject } from "./IMarkupObject";
|
|
2
|
-
|
|
3
|
-
export interface IMarkupArrow extends IMarkupObject {
|
|
4
|
-
getPoints(): { x: number; y: number }[];
|
|
5
|
-
setPoints(points: { x: number; y: number }[]);
|
|
6
|
-
|
|
7
|
-
getStartPoint(): { x: number; y: number };
|
|
8
|
-
setStartPoint(x: number, y: number);
|
|
9
|
-
|
|
10
|
-
getEndPoint(): { x: number; y: number };
|
|
11
|
-
setEndPoint(x: number, y: number);
|
|
12
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { IMarkupObject } from "./IMarkupObject";
|
|
2
|
-
|
|
3
|
-
export interface IMarkupCloud extends IMarkupObject {
|
|
4
|
-
getPosition(): { x: number; y: number };
|
|
5
|
-
setPosition(x: number, y: number);
|
|
6
|
-
|
|
7
|
-
getWidth(): number;
|
|
8
|
-
setWidth(w: number);
|
|
9
|
-
|
|
10
|
-
getHeigth(): number;
|
|
11
|
-
setHeight(h: number);
|
|
12
|
-
|
|
13
|
-
getLineWidth(): number;
|
|
14
|
-
setLineWidth(size: number);
|
|
15
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { IMarkupObject } from "./IMarkupObject";
|
|
2
|
-
|
|
3
|
-
export interface IMarkupEllipse extends IMarkupObject {
|
|
4
|
-
getPosition(): { x: number; y: number };
|
|
5
|
-
setPosition(x: number, y: number);
|
|
6
|
-
|
|
7
|
-
getRadiusX(): number;
|
|
8
|
-
setRadiusX(r: number);
|
|
9
|
-
|
|
10
|
-
getRadiusY(): number;
|
|
11
|
-
setRadiusY(r: number);
|
|
12
|
-
|
|
13
|
-
getLineWidth(): number;
|
|
14
|
-
setLineWidth(size: number);
|
|
15
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { IMarkupObject } from "./IMarkupObject";
|
|
2
|
-
|
|
3
|
-
export interface IMarkupImage extends IMarkupObject {
|
|
4
|
-
getPosition(): { x: number; y: number };
|
|
5
|
-
setPosition(x: number, y: number);
|
|
6
|
-
|
|
7
|
-
getSrc(): string;
|
|
8
|
-
setSrc(src: string);
|
|
9
|
-
|
|
10
|
-
getWidth(): number;
|
|
11
|
-
setWidth(w: number);
|
|
12
|
-
|
|
13
|
-
getHeight(): number;
|
|
14
|
-
setHeight(h: number);
|
|
15
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { IMarkupObject } from "./IMarkupObject";
|
|
2
|
-
|
|
3
|
-
export interface IMarkupLine extends IMarkupObject {
|
|
4
|
-
getPoints(): number[];
|
|
5
|
-
|
|
6
|
-
getLineWidth(): number;
|
|
7
|
-
setLineWidth(size: number);
|
|
8
|
-
|
|
9
|
-
getLineType(): string;
|
|
10
|
-
setLineType(type: string);
|
|
11
|
-
|
|
12
|
-
addPoints(points: [{ x: number; y: number }]);
|
|
13
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export interface IMarkupObject {
|
|
2
|
-
// link to library object (Konva, Vis...)
|
|
3
|
-
ref(): any;
|
|
4
|
-
id(): string;
|
|
5
|
-
enableMouseEditing(value: boolean);
|
|
6
|
-
type(): string;
|
|
7
|
-
|
|
8
|
-
getRotation(): number;
|
|
9
|
-
setRotation(degrees: number): void;
|
|
10
|
-
|
|
11
|
-
getZIndex(): number;
|
|
12
|
-
setZIndex(zIndex: number): void;
|
|
13
|
-
|
|
14
|
-
delete();
|
|
15
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { IMarkupObject } from "./IMarkupObject";
|
|
2
|
-
|
|
3
|
-
export interface IMarkupRectangle extends IMarkupObject {
|
|
4
|
-
getPosition(): { x: number; y: number };
|
|
5
|
-
setPosition(x: number, y: number);
|
|
6
|
-
|
|
7
|
-
getWidth(): number;
|
|
8
|
-
setWidth(w: number);
|
|
9
|
-
|
|
10
|
-
getHeigth(): number;
|
|
11
|
-
setHeight(h: number);
|
|
12
|
-
|
|
13
|
-
getLineWidth(): number;
|
|
14
|
-
setLineWidth(size: number);
|
|
15
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { IMarkupObject } from "./IMarkupObject";
|
|
2
|
-
|
|
3
|
-
export interface IMarkupText extends IMarkupObject {
|
|
4
|
-
getText(): string;
|
|
5
|
-
setText(text: string): void;
|
|
6
|
-
|
|
7
|
-
getPosition(): { x: number; y: number };
|
|
8
|
-
setPosition(x: number, y: number);
|
|
9
|
-
|
|
10
|
-
getFontSize();
|
|
11
|
-
setFontSize(size: number);
|
|
12
|
-
}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import Konva from "konva";
|
|
2
|
-
import { IMarkupArrow } from "../../IMarkupArrow";
|
|
3
|
-
import { IMarkupColorable } from "../../IMarkupColorable";
|
|
4
|
-
|
|
5
|
-
export class KonvaArrow implements IMarkupArrow, IMarkupColorable {
|
|
6
|
-
private _ref: Konva.Arrow;
|
|
7
|
-
|
|
8
|
-
constructor(
|
|
9
|
-
params: {
|
|
10
|
-
start: { x: number; y: number };
|
|
11
|
-
end: { x: number; y: number };
|
|
12
|
-
color?: string;
|
|
13
|
-
id?: string;
|
|
14
|
-
},
|
|
15
|
-
ref = null
|
|
16
|
-
) {
|
|
17
|
-
if (ref) {
|
|
18
|
-
this._ref = ref;
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
if (!params.start || !params.end) return;
|
|
23
|
-
|
|
24
|
-
this._ref = new Konva.Arrow({
|
|
25
|
-
stroke: params.color ?? "#ff0000",
|
|
26
|
-
fill: params.color ?? "#ff0000",
|
|
27
|
-
strokeWidth: 4,
|
|
28
|
-
globalCompositeOperation: "source-over",
|
|
29
|
-
lineCap: "round",
|
|
30
|
-
lineJoin: "round",
|
|
31
|
-
points: [params.start.x, params.start.y, params.end.x, params.end.y],
|
|
32
|
-
draggable: true,
|
|
33
|
-
strokeScaleEnabled: false,
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
this._ref.id(this._ref._id.toString());
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
ref() {
|
|
40
|
-
return this._ref;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
id(): string {
|
|
44
|
-
return this._ref.id();
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
enableMouseEditing(value: boolean) {
|
|
48
|
-
this._ref.draggable(value);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
type(): string {
|
|
52
|
-
return "arrow";
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
getColor(): string {
|
|
56
|
-
return this._ref.stroke();
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
setColor(hex: string) {
|
|
60
|
-
this._ref.stroke(hex);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
getRotation(): number {
|
|
64
|
-
return this._ref.rotation();
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
setRotation(degrees: number): void {
|
|
68
|
-
this._ref.rotation(degrees);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
getZIndex(): number {
|
|
72
|
-
return this._ref.zIndex();
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
setZIndex(zIndex: number): void {
|
|
76
|
-
this._ref.zIndex(zIndex);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
delete() {
|
|
80
|
-
this._ref.destroy();
|
|
81
|
-
this._ref = null;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
getPoints(): { x: number; y: number }[] {
|
|
85
|
-
const points = this._ref.points();
|
|
86
|
-
return [
|
|
87
|
-
{ x: points[0], y: points[1] },
|
|
88
|
-
{ x: points[2], y: points[3] },
|
|
89
|
-
];
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
setPoints(points: { x: number; y: number }[]) {
|
|
93
|
-
if (points.length === 2) {
|
|
94
|
-
this._ref.points([points[0].x, points[0].y, points[1].x, points[1].y]);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
getStartPoint(): { x: number; y: number } {
|
|
99
|
-
const points = this._ref.points();
|
|
100
|
-
return { x: points[0], y: points[1] };
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
setStartPoint(x: number, y: number) {
|
|
104
|
-
const points = this._ref.points();
|
|
105
|
-
this._ref.points([x, y, points[2], points[3]]);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
getEndPoint(): { x: number; y: number } {
|
|
109
|
-
const points = this._ref.points();
|
|
110
|
-
return { x: points[2], y: points[3] };
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
setEndPoint(x: number, y: number) {
|
|
114
|
-
const points = this._ref.points();
|
|
115
|
-
this._ref.points([points[0], points[1], x, y]);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
import Konva from "konva";
|
|
2
|
-
import { IMarkupColorable } from "../../IMarkupColorable";
|
|
3
|
-
import { IMarkupCloud } from "../../IMarkupCloud";
|
|
4
|
-
|
|
5
|
-
export class KonvaCloud implements IMarkupCloud, IMarkupColorable {
|
|
6
|
-
private _ref: Konva.Shape;
|
|
7
|
-
|
|
8
|
-
constructor(
|
|
9
|
-
params: {
|
|
10
|
-
position: { x: number; y: number };
|
|
11
|
-
width?: number;
|
|
12
|
-
height?: number;
|
|
13
|
-
lineWidth?: number;
|
|
14
|
-
color?: string;
|
|
15
|
-
id?: string;
|
|
16
|
-
},
|
|
17
|
-
ref = null
|
|
18
|
-
) {
|
|
19
|
-
if (ref) {
|
|
20
|
-
this._ref = ref;
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if (!params.position || !params.width || !params.height) return;
|
|
25
|
-
|
|
26
|
-
const arcRadius = 16;
|
|
27
|
-
|
|
28
|
-
this._ref = new Konva.Shape({
|
|
29
|
-
x: params.position.x,
|
|
30
|
-
y: params.position.y,
|
|
31
|
-
width: params.width ?? 200,
|
|
32
|
-
height: params.height ?? 200,
|
|
33
|
-
stroke: params.color ?? "#ff0000",
|
|
34
|
-
strokeWidth: params.lineWidth ?? 5,
|
|
35
|
-
draggable: true,
|
|
36
|
-
strokeScaleEnabled: false,
|
|
37
|
-
globalCompositeOperation: "source-over",
|
|
38
|
-
sceneFunc: (context, shape) => {
|
|
39
|
-
function calculateMidpoint(position, width, height) {
|
|
40
|
-
const midX = position.x + width / 2;
|
|
41
|
-
const midY = position.y + height / 2;
|
|
42
|
-
return { x: midX, y: midY };
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const points = [
|
|
46
|
-
{ x: 0, y: 0 },
|
|
47
|
-
{ x: 0 + this._ref.width(), y: 0 },
|
|
48
|
-
{ x: 0 + this._ref.width(), y: 0 + this._ref.height() },
|
|
49
|
-
{ x: 0, y: 0 + this._ref.height() },
|
|
50
|
-
{ x: 0, y: 0 },
|
|
51
|
-
];
|
|
52
|
-
|
|
53
|
-
const midPoint = calculateMidpoint({ x: 0, y: 0 }, this._ref.width(), this._ref.height());
|
|
54
|
-
|
|
55
|
-
const baseArcLength = 30;
|
|
56
|
-
context.beginPath();
|
|
57
|
-
for (let iPoint = 0; iPoint < points.length - 1; iPoint++) {
|
|
58
|
-
let approxArcLength = baseArcLength;
|
|
59
|
-
const dx = points[iPoint + 1].x - points[iPoint].x;
|
|
60
|
-
const dy = points[iPoint + 1].y - points[iPoint].y;
|
|
61
|
-
const length = Math.sqrt(dx * dx + dy * dy);
|
|
62
|
-
|
|
63
|
-
const arcCount = Math.floor(length / approxArcLength);
|
|
64
|
-
const lengthMod = length % approxArcLength;
|
|
65
|
-
approxArcLength = baseArcLength + arcCount / lengthMod;
|
|
66
|
-
|
|
67
|
-
let pX = points[iPoint].x + dx / arcCount / 2;
|
|
68
|
-
let pY = points[iPoint].y + dy / arcCount / 2;
|
|
69
|
-
const pEndX = points[iPoint + 1].x;
|
|
70
|
-
const pEndY = points[iPoint + 1].y;
|
|
71
|
-
const endAngle = Math.atan((pEndY - pY) / (pEndX - pX));
|
|
72
|
-
const startAngle = endAngle + Math.PI;
|
|
73
|
-
const counterClockwise = pX > midPoint.x && pY > midPoint.y;
|
|
74
|
-
for (let iArc = 0; iArc < arcCount; iArc++) {
|
|
75
|
-
if (counterClockwise) {
|
|
76
|
-
context.arc(pX, pY, arcRadius, endAngle, startAngle);
|
|
77
|
-
} else {
|
|
78
|
-
context.arc(pX, pY, arcRadius, startAngle, endAngle);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
pX += dx / arcCount;
|
|
82
|
-
pY += dy / arcCount;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
context.closePath();
|
|
87
|
-
// (!) Konva specific method, it is very important
|
|
88
|
-
// it will apply are required styles
|
|
89
|
-
context.fillStrokeShape(shape);
|
|
90
|
-
},
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
this._ref.className = "Cloud";
|
|
94
|
-
|
|
95
|
-
this._ref.on("transform", (e) => {
|
|
96
|
-
const attrs = e.target.attrs;
|
|
97
|
-
|
|
98
|
-
const minWidth = 100;
|
|
99
|
-
const minHeight = 100;
|
|
100
|
-
|
|
101
|
-
const newWidth = this._ref.width() * attrs.scaleX;
|
|
102
|
-
const newHeight = this._ref.height() * attrs.scaleY;
|
|
103
|
-
|
|
104
|
-
if (newWidth < minWidth || newHeight < minHeight) {
|
|
105
|
-
this._ref.scale({ x: 1, y: 1 });
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if (Math.abs(attrs.scaleX - 1) > 10e-6) {
|
|
110
|
-
this._ref.width(newWidth);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if (Math.abs(attrs.scaleY - 1) > 10e-6) {
|
|
114
|
-
this._ref.height(newHeight);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
this._ref.scale({ x: 1, y: 1 });
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
this._ref.getSelfRect = () => {
|
|
121
|
-
return {
|
|
122
|
-
x: 0 - arcRadius,
|
|
123
|
-
y: 0 - arcRadius,
|
|
124
|
-
width: this._ref.width() + 2 * arcRadius,
|
|
125
|
-
height: this._ref.height() + 2 * arcRadius,
|
|
126
|
-
};
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
this._ref.id(this._ref._id.toString());
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
ref() {
|
|
133
|
-
return this._ref;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
id(): string {
|
|
137
|
-
return this._ref.id();
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
enableMouseEditing(value: boolean) {
|
|
141
|
-
this._ref.draggable(value);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
type(): string {
|
|
145
|
-
return "cloud";
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
getColor(): string {
|
|
149
|
-
return this._ref.stroke();
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
setColor(hex: string) {
|
|
153
|
-
this._ref.stroke(hex);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
getRotation(): number {
|
|
157
|
-
return this._ref.rotation();
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
setRotation(degrees: number): void {
|
|
161
|
-
this._ref.rotation(degrees);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
getZIndex(): number {
|
|
165
|
-
return this._ref.zIndex();
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
setZIndex(zIndex: number): void {
|
|
169
|
-
this._ref.zIndex(zIndex);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
delete() {
|
|
173
|
-
this._ref.destroy();
|
|
174
|
-
this._ref = null;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
getPosition() {
|
|
178
|
-
return this._ref.position();
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
setPosition(x: number, y: number) {
|
|
182
|
-
this._ref.position({ x, y });
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
getWidth(): number {
|
|
186
|
-
return this._ref.width();
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
setWidth(w: number) {
|
|
190
|
-
this._ref.width(w);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
getHeigth(): number {
|
|
194
|
-
return this._ref.height();
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
setHeight(h: number) {
|
|
198
|
-
this._ref.height(h);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
getLineWidth(): number {
|
|
202
|
-
return this._ref.strokeWidth();
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
setLineWidth(size: number) {
|
|
206
|
-
this._ref.strokeWidth(size);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import Konva from "konva";
|
|
2
|
-
import { IMarkupEllipse } from "../../IMarkupEllipse";
|
|
3
|
-
import { IMarkupColorable } from "../../IMarkupColorable";
|
|
4
|
-
|
|
5
|
-
export class KonvaEllipse implements IMarkupEllipse, IMarkupColorable {
|
|
6
|
-
private _ref: Konva.Ellipse;
|
|
7
|
-
|
|
8
|
-
constructor(
|
|
9
|
-
params: {
|
|
10
|
-
position: { x: number; y: number };
|
|
11
|
-
radius: { x: number; y: number };
|
|
12
|
-
lineWidth?: number;
|
|
13
|
-
color?: string;
|
|
14
|
-
id?: string;
|
|
15
|
-
},
|
|
16
|
-
ref = null
|
|
17
|
-
) {
|
|
18
|
-
if (ref) {
|
|
19
|
-
this._ref = ref;
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (!params.position) return;
|
|
24
|
-
|
|
25
|
-
this._ref = new Konva.Ellipse({
|
|
26
|
-
stroke: params.color ?? "#ff0000",
|
|
27
|
-
strokeWidth: params.lineWidth ?? 4,
|
|
28
|
-
globalCompositeOperation: "source-over",
|
|
29
|
-
lineCap: "round",
|
|
30
|
-
lineJoin: "round",
|
|
31
|
-
x: params.position.x,
|
|
32
|
-
y: params.position.y,
|
|
33
|
-
radiusX: params.radius.x,
|
|
34
|
-
radiusY: params.radius.y,
|
|
35
|
-
draggable: true,
|
|
36
|
-
strokeScaleEnabled: false,
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
this._ref.id(this._ref._id.toString());
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
getPosition(): { x: number; y: number } {
|
|
43
|
-
return this._ref.position();
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
setPosition(x: number, y: number) {
|
|
47
|
-
this._ref.setPosition({ x, y });
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
getRadiusX(): number {
|
|
51
|
-
return this._ref.radiusX();
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
setRadiusX(r: number) {
|
|
55
|
-
this._ref.radius({ x: r, y: this._ref.radiusY() });
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
getRadiusY(): number {
|
|
59
|
-
return this._ref.radiusY();
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
setRadiusY(r: number) {
|
|
63
|
-
this._ref.radius({ x: this._ref.radiusX(), y: r });
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
getLineWidth(): number {
|
|
67
|
-
return this._ref.strokeWidth();
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
setLineWidth(size: number) {
|
|
71
|
-
this._ref.strokeWidth(size);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
ref() {
|
|
75
|
-
return this._ref;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
id(): string {
|
|
79
|
-
return this._ref.id();
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
enableMouseEditing(value: boolean) {
|
|
83
|
-
this._ref.draggable(value);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
type(): string {
|
|
87
|
-
return "ellipse";
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
getColor(): string {
|
|
91
|
-
return this._ref.stroke();
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
setColor(hex: string) {
|
|
95
|
-
this._ref.stroke(hex);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
getRotation(): number {
|
|
99
|
-
return this._ref.rotation();
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
setRotation(degrees: number): void {
|
|
103
|
-
this._ref.rotation(degrees);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
getZIndex(): number {
|
|
107
|
-
return this._ref.zIndex();
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
setZIndex(zIndex: number): void {
|
|
111
|
-
this._ref.zIndex(zIndex);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
delete() {
|
|
115
|
-
this._ref.destroy();
|
|
116
|
-
this._ref = null;
|
|
117
|
-
}
|
|
118
|
-
}
|