@xtctwins/tctwins-core 1.0.16 → 1.0.18
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/dist/tctwins-core.es.js +1151 -1053
- package/dist/tctwins-core.min.es.js +2 -2
- package/package.json +1 -1
- package/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.d.ts +74 -48
- package/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.d.ts +96 -82
- package/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.d.ts +75 -49
- package/dist/tctwins-core.cjs.js +0 -196494
- package/dist/tctwins-core.es5.js +0 -29199
- package/dist/tctwins-core.min.cjs.js +0 -37
- package/dist/tctwins-core.min.es5.js +0 -36
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AngleMeasurementsControl } from "./AngleMeasurementsControl.js";
|
|
2
2
|
import { math } from "../../viewer/scene/math/math.js";
|
|
3
|
-
import {AngleMeasurementsPlugin} from "./AngleMeasurementsPlugin";
|
|
4
|
-
import {PointerLens} from "../../extras/PointerLens/PointerLens";
|
|
3
|
+
import { AngleMeasurementsPlugin } from "./AngleMeasurementsPlugin";
|
|
4
|
+
import { PointerLens } from "../../extras/PointerLens/PointerLens";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Creates {@link AngleMeasurement}s in an {@link AngleMeasurementsPlugin} from mouse input.
|
|
@@ -36,58 +36,84 @@ import {PointerLens} from "../../extras/PointerLens/PointerLens";
|
|
|
36
36
|
* angleMeasurementsMouseControl.activate();
|
|
37
37
|
*/
|
|
38
38
|
export class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
39
|
+
/**
|
|
40
|
+
* Creates a new AngleMeasurementsMouseControl.
|
|
41
|
+
*
|
|
42
|
+
* @param {AngleMeasurementsPlugin} angleMeasurementsPlugin The AngleMeasurementsPlugin to control.
|
|
43
|
+
* @param {Object} [cfg] Configuration options.
|
|
44
|
+
* @param {PointerLens} [cfg.pointerLens] A PointerLens to use for providing a magnified view of the cursor when snapping is enabled.
|
|
45
|
+
* @param {boolean} [cfg.snapping=true] Whether to initially enable snap-to-vertex and snap-to-edge for this AngleMeasurementsMouseControl.
|
|
46
|
+
* @param {offsetX} [cfg.offsetX] offsetX of the mouse
|
|
47
|
+
* @param {offsetY} [cfg.offsetY] offsetY of the mouse
|
|
48
|
+
*/
|
|
49
|
+
constructor(
|
|
50
|
+
angleMeasurementsPlugin: AngleMeasurementsPlugin,
|
|
51
|
+
cfg?: {
|
|
52
|
+
pointerLens?: PointerLens;
|
|
53
|
+
snapping?: boolean;
|
|
54
|
+
offsetX?: number;
|
|
55
|
+
offsetY?: number;
|
|
56
|
+
}
|
|
57
|
+
);
|
|
39
58
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
* @param {Object} [cfg] Configuration options.
|
|
45
|
-
* @param {PointerLens} [cfg.pointerLens] A PointerLens to use for providing a magnified view of the cursor when snapping is enabled.
|
|
46
|
-
* @param {boolean} [cfg.snapping=true] Whether to initially enable snap-to-vertex and snap-to-edge for this AngleMeasurementsMouseControl.
|
|
47
|
-
*/
|
|
48
|
-
constructor(angleMeasurementsPlugin: AngleMeasurementsPlugin, cfg?: {
|
|
49
|
-
pointerLens?: PointerLens;
|
|
50
|
-
snapping?: boolean;
|
|
51
|
-
});
|
|
59
|
+
/**
|
|
60
|
+
* @return {number} mouse offset
|
|
61
|
+
*/
|
|
62
|
+
get offsetX(): number;
|
|
52
63
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
*/
|
|
58
|
-
get active(): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* @param {number} offsetX
|
|
66
|
+
*/
|
|
67
|
+
set offsetX(offsetX: number);
|
|
59
68
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
*/
|
|
65
|
-
set snapping(snapping: boolean);
|
|
69
|
+
/**
|
|
70
|
+
* @return {number} mouse offset
|
|
71
|
+
*/
|
|
72
|
+
get offsetY(): number;
|
|
66
73
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
*/
|
|
72
|
-
get snapping(): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* @param {number} offsetY
|
|
76
|
+
*/
|
|
77
|
+
set offsetY(offsetY: number);
|
|
73
78
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
79
|
+
/**
|
|
80
|
+
* Gets whether this AngleMeasurementsMouseControl is currently active, responding to input.
|
|
81
|
+
*
|
|
82
|
+
* @returns {boolean} True if active, false otherwise.
|
|
83
|
+
*/
|
|
84
|
+
get active(): boolean;
|
|
78
85
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
86
|
+
/**
|
|
87
|
+
* Sets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.
|
|
88
|
+
*
|
|
89
|
+
* @param {boolean} snapping True to enable snap-to-vertex and snap-to-edge, false to disable.
|
|
90
|
+
*/
|
|
91
|
+
set snapping(snapping: boolean);
|
|
83
92
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
93
|
+
/**
|
|
94
|
+
* Gets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.
|
|
95
|
+
*
|
|
96
|
+
* @returns {boolean} True if snap-to-vertex and snap-to-edge are enabled, false otherwise.
|
|
97
|
+
*/
|
|
98
|
+
get snapping(): boolean;
|
|
88
99
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
100
|
+
/**
|
|
101
|
+
* Activates this AngleMeasurementsMouseControl, making it responsive to input.
|
|
102
|
+
*/
|
|
103
|
+
activate(): void;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Deactivates this AngleMeasurementsMouseControl, making it unresponsive to input.
|
|
107
|
+
*/
|
|
108
|
+
deactivate(): void;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Resets this AngleMeasurementsMouseControl, destroying any AngleMeasurement under construction.
|
|
112
|
+
*/
|
|
113
|
+
reset(): void;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Destroys this AngleMeasurementsMouseControl.
|
|
117
|
+
*/
|
|
118
|
+
destroy(): void;
|
|
93
119
|
}
|
|
@@ -3,97 +3,111 @@ import { AngleMeasurement } from "./AngleMeasurement";
|
|
|
3
3
|
import { AngleMeasurementsControl } from "./AngleMeasurementsControl";
|
|
4
4
|
|
|
5
5
|
export declare type AngleMeasurementsPluginConfiguration = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
/** Optional ID for this plugin, so that we can find it within {@link Viewer.plugins}. */
|
|
7
|
+
id?: string;
|
|
8
|
+
/** Container DOM element for markers and labels. Defaults to ````document.body````. */
|
|
9
|
+
container?: HTMLElement;
|
|
10
|
+
/** The default color of the dots, wire and label. */
|
|
11
|
+
defaultColor?: string;
|
|
12
|
+
/** If set, the wires, dots and labels will have this zIndex (+1 for dots and +2 for labels). */
|
|
13
|
+
zIndex?: number;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* {@link Viewer} plugin for measuring angles.
|
|
18
18
|
*/
|
|
19
19
|
export declare class AngleMeasurementsPlugin extends Plugin {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
/**
|
|
21
|
+
* @constructor
|
|
22
|
+
* @param {Viewer} viewer The Viewer.
|
|
23
|
+
* @param {AngleMeasurementsPluginConfiguration} [cfg] Plugin configuration.
|
|
24
|
+
*/
|
|
25
|
+
constructor(viewer: Viewer, cfg?: AngleMeasurementsPluginConfiguration);
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Gets the {@link AngleMeasurementsControl}, which creates {@link AngleMeasurement}s from user input.
|
|
29
|
+
*
|
|
30
|
+
* @type {AngleMeasurementsControl}
|
|
31
|
+
*/
|
|
32
|
+
get control(): AngleMeasurementsControl;
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Gets the existing {@link AngleMeasurement}s, each mapped to its {@link AngleMeasurement.id}.
|
|
36
|
+
*
|
|
37
|
+
* @type {{String:AngleMeasurement}}
|
|
38
|
+
*/
|
|
39
|
+
get measurements(): { [key: string]: AngleMeasurement };
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Creates an {@link AngleMeasurement}.
|
|
43
|
+
*
|
|
44
|
+
* The AngleMeasurement is then registered by {@link AngleMeasurement.id} in {@link AngleMeasurementsPlugin.measurements}.
|
|
45
|
+
*
|
|
46
|
+
* @param {Object} params {@link AngleMeasurement} configuration.
|
|
47
|
+
* @param {String} params.id Unique ID to assign to {@link AngleMeasurement.id}. The AngleMeasurement will be registered by this in {@link AngleMeasurementsPlugin.measurements} and {@link Scene.components}. Must be unique among all components in the {@link Viewer}.
|
|
48
|
+
* @param {Number[]} params.origin.worldPos Origin World-space 3D position.
|
|
49
|
+
* @param {Entity} params.origin.entity Origin Entity.
|
|
50
|
+
* @param {Number[]} params.corner.worldPos Corner World-space 3D position.
|
|
51
|
+
* @param {Entity} params.corner.entity Corner Entity.
|
|
52
|
+
* @param {Number[]} params.target.worldPos Target World-space 3D position.
|
|
53
|
+
* @param {Entity} params.target.entity Target Entity.
|
|
54
|
+
* @param {Boolean} [params.visible=true] Whether to initially show the {@link AngleMeasurement}.
|
|
55
|
+
* @returns {AngleMeasurement} The new {@link AngleMeasurement}.
|
|
56
|
+
*/
|
|
57
|
+
createMeasurement(params?: {
|
|
58
|
+
id: string;
|
|
59
|
+
origin: {
|
|
60
|
+
entity: Entity;
|
|
61
|
+
worldPos: number[];
|
|
62
|
+
};
|
|
63
|
+
corner: {
|
|
64
|
+
entity: Entity;
|
|
65
|
+
worldPos: number[];
|
|
66
|
+
};
|
|
67
|
+
target: {
|
|
68
|
+
entity: Entity;
|
|
69
|
+
worldPos: number[];
|
|
70
|
+
};
|
|
71
|
+
visible?: boolean;
|
|
72
|
+
}): AngleMeasurement;
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Destroys all {@link AngleMeasurement}s.
|
|
83
|
-
*/
|
|
84
|
-
clear(): void;
|
|
74
|
+
/**
|
|
75
|
+
* Destroys a {@link AngleMeasurement}.
|
|
76
|
+
*
|
|
77
|
+
* @param {String} id ID of AngleMeasurement to destroy.
|
|
78
|
+
*/
|
|
79
|
+
destroyMeasurement(id: string): void;
|
|
85
80
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
*/
|
|
91
|
-
on(event: "measurementCreated", callback: (measurement: AngleMeasurement)=> void): void;
|
|
81
|
+
/**
|
|
82
|
+
* Destroys all {@link AngleMeasurement}s.
|
|
83
|
+
*/
|
|
84
|
+
clear(): void;
|
|
92
85
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
86
|
+
/**
|
|
87
|
+
* Fires when a measurement is created.
|
|
88
|
+
* @param {String} event The measurementCreated event
|
|
89
|
+
* @param {Function} callback Callback fired on the event
|
|
90
|
+
*/
|
|
91
|
+
on(event: "measurementCreated", callback: (measurement: AngleMeasurement) => void): void;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Fires when a measurement is completed.
|
|
95
|
+
* @param {String} event The measurementEnd event
|
|
96
|
+
* @param {Function} callback Callback fired on the event
|
|
97
|
+
*/
|
|
98
|
+
on(event: "measurementEnd", callback: (measurement: AngleMeasurement) => void): string;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Fires when a measurement is cancelled.
|
|
102
|
+
* @param {String} event The measurementCancel event
|
|
103
|
+
* @param {Function} callback Callback fired on the event
|
|
104
|
+
*/
|
|
105
|
+
on(event: "measurementCancel", callback: (measurement: AngleMeasurement) => void): string;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Fires when a measurement is destroyed.
|
|
109
|
+
* @param {String} event The measurementDestroyed event
|
|
110
|
+
* @param {Function} callback Callback fired on the event
|
|
111
|
+
*/
|
|
112
|
+
on(event: "measurementDestroyed", callback: (measurement: AngleMeasurement) => void): void;
|
|
113
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {DistanceMeasurementsControl} from "./DistanceMeasurementsControl.js";
|
|
1
|
+
import { DistanceMeasurementsControl } from "./DistanceMeasurementsControl.js";
|
|
2
2
|
|
|
3
|
-
import {DistanceMeasurementsPlugin} from "./DistanceMeasurementsPlugin";
|
|
4
|
-
import {PointerLens} from "../../extras/PointerLens/PointerLens";
|
|
3
|
+
import { DistanceMeasurementsPlugin } from "./DistanceMeasurementsPlugin";
|
|
4
|
+
import { PointerLens } from "../../extras/PointerLens/PointerLens";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Creates {@link DistanceMeasurement}s in a {@link DistanceMeasurementsPlugin} from mouse input.
|
|
@@ -14,58 +14,84 @@ import {PointerLens} from "../../extras/PointerLens/PointerLens";
|
|
|
14
14
|
* });
|
|
15
15
|
*/
|
|
16
16
|
export class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
17
|
+
/**
|
|
18
|
+
* Creates a DistanceMeasurementsMouseControl bound to the given DistanceMeasurementsPlugin.
|
|
19
|
+
*
|
|
20
|
+
* @param {DistanceMeasurementsPlugin} distanceMeasurementsPlugin The DistanceMeasurementsPlugin to control.
|
|
21
|
+
* @param {Object} cfg Configuration options.
|
|
22
|
+
* @param {PointerLens} [cfg.pointerLens] A PointerLens to provide a magnified view of the cursor when snapping is enabled.
|
|
23
|
+
* @param {boolean} [cfg.snapping=true] Whether to enable snap-to-vertex and snap-to-edge for this DistanceMeasurementsMouseControl.
|
|
24
|
+
* @param {offsetX} [cfg.offsetX] offsetX of the mouse
|
|
25
|
+
* @param {offsetY} [cfg.offsetY] offsetY of the mouse
|
|
26
|
+
*/
|
|
27
|
+
constructor(
|
|
28
|
+
distanceMeasurementsPlugin: DistanceMeasurementsPlugin,
|
|
29
|
+
cfg?: {
|
|
30
|
+
pointerLens?: PointerLens;
|
|
31
|
+
snapping?: boolean;
|
|
32
|
+
offsetX?: number;
|
|
33
|
+
offsetY?: number;
|
|
34
|
+
}
|
|
35
|
+
);
|
|
17
36
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
* @param {Object} cfg Configuration options.
|
|
23
|
-
* @param {PointerLens} [cfg.pointerLens] A PointerLens to provide a magnified view of the cursor when snapping is enabled.
|
|
24
|
-
* @param {boolean} [cfg.snapping=true] Whether to enable snap-to-vertex and snap-to-edge for this DistanceMeasurementsMouseControl.
|
|
25
|
-
*/
|
|
26
|
-
constructor(distanceMeasurementsPlugin: DistanceMeasurementsPlugin, cfg?: {
|
|
27
|
-
pointerLens?: PointerLens;
|
|
28
|
-
snapping?: boolean;
|
|
29
|
-
});
|
|
37
|
+
/**
|
|
38
|
+
* @return {number} mouse offset
|
|
39
|
+
*/
|
|
40
|
+
get offsetX(): number;
|
|
30
41
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
*/
|
|
36
|
-
get active(): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* @param {number} offsetX
|
|
44
|
+
*/
|
|
45
|
+
set offsetX(offsetX: number);
|
|
37
46
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
*/
|
|
43
|
-
set snapping(snapping: boolean);
|
|
47
|
+
/**
|
|
48
|
+
* @return {number} mouse offset
|
|
49
|
+
*/
|
|
50
|
+
get offsetY(): number;
|
|
44
51
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
*/
|
|
50
|
-
get snapping(): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* @param {number} offsetY
|
|
54
|
+
*/
|
|
55
|
+
set offsetY(offsetY: number);
|
|
51
56
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
57
|
+
/**
|
|
58
|
+
* Gets if this DistanceMeasurementsMouseControl is currently active, where it is responding to input.
|
|
59
|
+
*
|
|
60
|
+
* @returns {boolean} True if this DistanceMeasurementsMouseControl is active.
|
|
61
|
+
*/
|
|
62
|
+
get active(): boolean;
|
|
56
63
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
64
|
+
/**
|
|
65
|
+
* Sets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsMouseControl.
|
|
66
|
+
*
|
|
67
|
+
* @param {boolean} snapping Whether to enable snap-to-vertex and snap-to-edge for this DistanceMeasurementsMouseControl.
|
|
68
|
+
*/
|
|
69
|
+
set snapping(snapping: boolean);
|
|
61
70
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
71
|
+
/**
|
|
72
|
+
* Gets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsMouseControl.
|
|
73
|
+
*
|
|
74
|
+
* @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsMouseControl.
|
|
75
|
+
*/
|
|
76
|
+
get snapping(): boolean;
|
|
66
77
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
78
|
+
/**
|
|
79
|
+
* Activates this DistanceMeasurementsMouseControl, ready to respond to input.
|
|
80
|
+
*/
|
|
81
|
+
activate(): void;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Deactivates this DistanceMeasurementsMouseControl, making it unresponsive to input.
|
|
85
|
+
*/
|
|
86
|
+
deactivate(): void;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Resets this DistanceMeasurementsMouseControl.
|
|
90
|
+
*/
|
|
91
|
+
reset(): void;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Destroys this DistanceMeasurementsMouseControl.
|
|
95
|
+
*/
|
|
96
|
+
destroy(): void;
|
|
71
97
|
}
|