@xtctwins/tctwins-core 1.0.20 → 1.0.21

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xtctwins/tctwins-core",
3
- "version": "1.0.20",
3
+ "version": "1.0.21",
4
4
  "private": false,
5
5
  "description": "Web Programming Toolkit for 3D/2D BIM and CAD",
6
6
  "module": "./dist/tctwins-core.es.js",
@@ -68,4 +68,4 @@
68
68
  "/dist",
69
69
  "/types"
70
70
  ]
71
- }
71
+ }
@@ -3,148 +3,155 @@ import { Entity, Plugin, Viewer } from "../../viewer";
3
3
  import { Annotation } from "./Annotation";
4
4
 
5
5
  export declare type AnnotationsPluginConfiguration = {
6
- /** Optional ID for this plugin, so that we can find it within {@link Viewer.plugins}. */
7
- id?: string;
8
- /** HTML text template for Annotation markers. Defaults to ````<div></div>````. Ignored on {@link Annotation}s configured with a ````markerElementId````. */
9
- markerHTML?: string;
10
- /** HTML text template for Annotation labels. Defaults to ````<div></div>````. Ignored on {@link Annotation}s configured with a ````labelElementId````. */
11
- labelHTML?: string;
12
- /** Container DOM element for markers and labels. Defaults to ````document.body````. */
13
- container?: HTMLElement;
14
- /** Map of default values to insert into the HTML templates for the marker and label. */
15
- values?: { [key: string]: string | number };
16
- /** The amount by which each {@link Annotation} is offset from the surface of its {@link Entity} when we create the Annotation by supplying a {@link PickResult} to {@link AnnotationsPlugin.createAnnotation}.*/
17
- surfaceOffset?: number;
6
+ /** Optional ID for this plugin, so that we can find it within {@link Viewer.plugins}. */
7
+ id?: string;
8
+ /** HTML text template for Annotation markers. Defaults to ````<div></div>````. Ignored on {@link Annotation}s configured with a ````markerElementId````. */
9
+ markerHTML?: string;
10
+ /** HTML text template for Annotation labels. Defaults to ````<div></div>````. Ignored on {@link Annotation}s configured with a ````labelElementId````. */
11
+ labelHTML?: string;
12
+ /** Container DOM element for markers and labels. Defaults to ````document.body````. */
13
+ container?: HTMLElement;
14
+ /** Map of default values to insert into the HTML templates for the marker and label. */
15
+ values?: { [key: string]: string | number };
16
+ /** The amount by which each {@link Annotation} is offset from the surface of its {@link Entity} when we create the Annotation by supplying a {@link PickResult} to {@link AnnotationsPlugin.createAnnotation}.*/
17
+ surfaceOffset?: number;
18
18
  };
19
19
 
20
20
  /**
21
21
  * {@link Viewer} plugin that creates {@link Annotation}s.
22
22
  */
23
23
  export declare class AnnotationsPlugin extends Plugin {
24
- /**
25
- * @constructor
26
- * @param {Viewer} viewer The Viewer.
27
- * @param {AnnotationsPluginConfiguration} cfg Plugin configuration.
28
- */
29
- constructor(viewer: Viewer, cfg: AnnotationsPluginConfiguration);
24
+ /**
25
+ * @constructor
26
+ * @param {Viewer} viewer The Viewer.
27
+ * @param {AnnotationsPluginConfiguration} cfg Plugin configuration.
28
+ */
29
+ constructor(viewer: Viewer, cfg: AnnotationsPluginConfiguration);
30
30
 
31
- /**
32
- * The {@link Annotation}s created by {@link AnnotationsPlugin.createAnnotation}, each mapped to its {@link Annotation.id}.
33
- * @type {{String:Annotation}}
34
- */
35
- annotations: { [key:string]: Annotation };
31
+ /**
32
+ * The {@link Annotation}s created by {@link AnnotationsPlugin.createAnnotation}, each mapped to its {@link Annotation.id}.
33
+ * @type {{String:Annotation}}
34
+ */
35
+ annotations: { [key: string]: Annotation };
36
36
 
37
- /**
38
- * Sets the amount by which each {@link Annotation} is offset from the surface of its {@link Entity}, when we
39
- * create the Annotation by supplying a {@link PickResult} to {@link AnnotationsPlugin.createAnnotation}.
40
- *
41
- * See the class comments for more info.
42
- *
43
- * This is ````0.3```` by default.
44
- *
45
- * @param {Number} surfaceOffset The surface offset.
46
- */
47
- set surfaceOffset(arg: number);
48
-
49
- /**
50
- * Gets the amount by which an {@link Annotation} is offset from the surface of its {@link Entity} when
51
- * created by {@link AnnotationsPlugin.createAnnotation}, when we
52
- * create the Annotation by supplying a {@link PickResult} to {@link AnnotationsPlugin.createAnnotation}.
53
- *
54
- * This is ````0.3```` by default.
55
- *
56
- * @returns {Number} The surface offset.
57
- */
58
- get surfaceOffset(): number;
37
+ /**
38
+ * Sets the amount by which each {@link Annotation} is offset from the surface of its {@link Entity}, when we
39
+ * create the Annotation by supplying a {@link PickResult} to {@link AnnotationsPlugin.createAnnotation}.
40
+ *
41
+ * See the class comments for more info.
42
+ *
43
+ * This is ````0.3```` by default.
44
+ *
45
+ * @param {Number} surfaceOffset The surface offset.
46
+ */
47
+ set surfaceOffset(arg: number);
59
48
 
60
- /**
61
- * Creates an {@link Annotation}.
62
- *
63
- * The Annotation is then registered by {@link Annotation.id} in {@link AnnotationsPlugin.annotations}.
64
- *
65
- * @param {Object} params Annotation configuration.
66
- * @param {String} params.id Unique ID to assign to {@link Annotation.id}. The Annotation will be registered by this in {@link AnnotationsPlugin.annotations} and {@link Scene.components}. Must be unique among all components in the {@link Viewer}.
67
- * @param {String} [params.markerElementId] ID of pre-existing DOM element to render the marker. This overrides ````markerHTML```` and does not support ````values```` (data is baked into the label DOM element).
68
- * @param {String} [params.labelElementId] ID of pre-existing DOM element to render the label. This overrides ````labelHTML```` and does not support ````values```` (data is baked into the label DOM element).
69
- * @param {String} [params.markerHTML] HTML text template for the Annotation marker. Defaults to the marker HTML given to the AnnotationsPlugin constructor. Ignored if you provide ````markerElementId````.
70
- * @param {String} [params.labelHTML] HTML text template for the Annotation label. Defaults to the label HTML given to the AnnotationsPlugin constructor. Ignored if you provide ````labelElementId````.
71
- * @param {Number[]} [params.worldPos=[0,0,0]] World-space position of the Annotation marker, assigned to {@link Annotation.worldPos}.
72
- * @param {Entity} [params.entity] Optional {@link Entity} to associate the Annotation with. Causes {@link Annotation.visible} to be ````false```` whenever {@link Entity.visible} is also ````false````.
73
- * @param {PickResult} [params.pickResult] Sets the Annotation's World-space position and direction vector from the given {@link PickResult}'s {@link PickResult.worldPos} and {@link PickResult.worldNormal}, and the Annotation's Entity from {@link PickResult.entity}. Causes ````worldPos```` and ````entity```` parameters to be ignored, if they are also given.
74
- * @param {Boolean} [params.occludable=false] Indicates whether or not the {@link Annotation} marker and label are hidden whenever the marker occluded by {@link Entity}s in the {@link Scene}. The
75
- * {@link Scene} periodically occlusion-tests all Annotations on every 20th "tick" (which represents a rendered frame). We can adjust that frequency via property {@link Scene.ticksPerOcclusionTest}.
76
- * @param {{String:(String|Number)}} [params.values={}] Map of values to insert into the HTML templates for the marker and label. These will be inserted in addition to any values given to the AnnotationsPlugin constructor.
77
- * @param {Boolean} [params.markerShown=true] Whether to initially show the {@link Annotation} marker.
78
- * @param {Boolean} [params.labelShown=false] Whether to initially show the {@link Annotation} label.
79
- * @param {Number[]} [params.eye] Optional World-space position for {@link Camera.eye}, used when this Annotation is associated with a {@link Camera} position.
80
- * @param {Number[]} [params.look] Optional World-space position for {@link Camera.look}, used when this Annotation is associated with a {@link Camera} position.
81
- * @param {Number[]} [params.up] Optional World-space position for {@link Camera.up}, used when this Annotation is associated with a {@link Camera} position.
82
- * @param {String} [params.projection] Optional projection type for {@link Camera.projection}, used when this Annotation is associated with a {@link Camera} position.
83
- * @returns {Annotation} The new {@link Annotation}.
84
- */
85
- createAnnotation(params: {
86
- id: string;
87
- markerElementId?: string;
88
- labelElementId?: string;
89
- markerHTML?: string;
90
- labelHTML?: string;
91
- worldPos?: number[];
92
- entity?: Entity;
93
- pickResult?: PickResult;
94
- occludable?: boolean;
95
- values?: { [key: string]: string | number };
96
- markerShown?: boolean;
97
- labelShown?: boolean;
98
- eye?: number[];
99
- look?: number[];
100
- up?: number[];
101
- projection?: string;
102
- }): Annotation;
103
-
104
- /**
105
- * Destroys an {@link Annotation}.
106
- *
107
- * @param {String} id ID of Annotation to destroy.
108
- */
109
- destroyAnnotation(id: string): void;
49
+ /**
50
+ * Gets the amount by which an {@link Annotation} is offset from the surface of its {@link Entity} when
51
+ * created by {@link AnnotationsPlugin.createAnnotation}, when we
52
+ * create the Annotation by supplying a {@link PickResult} to {@link AnnotationsPlugin.createAnnotation}.
53
+ *
54
+ * This is ````0.3```` by default.
55
+ *
56
+ * @returns {Number} The surface offset.
57
+ */
58
+ get surfaceOffset(): number;
110
59
 
111
- /**
112
- * Destroys all {@link Annotation}s.
113
- */
114
- clear(): void;
60
+ /**
61
+ * Creates an {@link Annotation}.
62
+ *
63
+ * The Annotation is then registered by {@link Annotation.id} in {@link AnnotationsPlugin.annotations}.
64
+ *
65
+ * @param {Object} params Annotation configuration.
66
+ * @param {String} params.id Unique ID to assign to {@link Annotation.id}. The Annotation will be registered by this in {@link AnnotationsPlugin.annotations} and {@link Scene.components}. Must be unique among all components in the {@link Viewer}.
67
+ * @param {String} [params.markerElementId] ID of pre-existing DOM element to render the marker. This overrides ````markerHTML```` and does not support ````values```` (data is baked into the label DOM element).
68
+ * @param {String} [params.labelElementId] ID of pre-existing DOM element to render the label. This overrides ````labelHTML```` and does not support ````values```` (data is baked into the label DOM element).
69
+ * @param {String} [params.markerHTML] HTML text template for the Annotation marker. Defaults to the marker HTML given to the AnnotationsPlugin constructor. Ignored if you provide ````markerElementId````.
70
+ * @param {String} [params.labelHTML] HTML text template for the Annotation label. Defaults to the label HTML given to the AnnotationsPlugin constructor. Ignored if you provide ````labelElementId````.
71
+ * @param {Number[]} [params.worldPos=[0,0,0]] World-space position of the Annotation marker, assigned to {@link Annotation.worldPos}.
72
+ * @param {Entity} [params.entity] Optional {@link Entity} to associate the Annotation with. Causes {@link Annotation.visible} to be ````false```` whenever {@link Entity.visible} is also ````false````.
73
+ * @param {PickResult} [params.pickResult] Sets the Annotation's World-space position and direction vector from the given {@link PickResult}'s {@link PickResult.worldPos} and {@link PickResult.worldNormal}, and the Annotation's Entity from {@link PickResult.entity}. Causes ````worldPos```` and ````entity```` parameters to be ignored, if they are also given.
74
+ * @param {Boolean} [params.occludable=false] Indicates whether or not the {@link Annotation} marker and label are hidden whenever the marker occluded by {@link Entity}s in the {@link Scene}. The
75
+ * {@link Scene} periodically occlusion-tests all Annotations on every 20th "tick" (which represents a rendered frame). We can adjust that frequency via property {@link Scene.ticksPerOcclusionTest}.
76
+ * @param {{String:(String|Number)}} [params.values={}] Map of values to insert into the HTML templates for the marker and label. These will be inserted in addition to any values given to the AnnotationsPlugin constructor.
77
+ * @param {Boolean} [params.markerShown=true] Whether to initially show the {@link Annotation} marker.
78
+ * @param {Boolean} [params.labelShown=false] Whether to initially show the {@link Annotation} label.
79
+ * @param {Number[]} [params.eye] Optional World-space position for {@link Camera.eye}, used when this Annotation is associated with a {@link Camera} position.
80
+ * @param {Number[]} [params.look] Optional World-space position for {@link Camera.look}, used when this Annotation is associated with a {@link Camera} position.
81
+ * @param {Number[]} [params.up] Optional World-space position for {@link Camera.up}, used when this Annotation is associated with a {@link Camera} position.
82
+ * @param {String} [params.projection] Optional projection type for {@link Camera.projection}, used when this Annotation is associated with a {@link Camera} position.
83
+ * @returns {Annotation} The new {@link Annotation}.
84
+ */
85
+ createAnnotation(params: {
86
+ id: string;
87
+ markerElementId?: string;
88
+ labelElementId?: string;
89
+ markerHTML?: string;
90
+ labelHTML?: string;
91
+ worldPos?: number[];
92
+ entity?: Entity;
93
+ pickResult?: PickResult;
94
+ occludable?: boolean;
95
+ values?: { [key: string]: string | number };
96
+ markerShown?: boolean;
97
+ labelShown?: boolean;
98
+ eye?: number[];
99
+ look?: number[];
100
+ up?: number[];
101
+ projection?: string;
102
+ }): Annotation;
115
103
 
116
- /**
117
- * Fires when a annotation is created.
118
- * @param {String} event The annotationCreated event
119
- * @param {Function} callback Callback fired on the event
120
- */
121
- on(event: "annotationCreated", callback: (annotationId: string)=> void): void;
104
+ /**
105
+ * Destroys an {@link Annotation}.
106
+ *
107
+ * @param {String} id ID of Annotation to destroy.
108
+ */
109
+ destroyAnnotation(id: string): void;
122
110
 
123
- /**
124
- * Fires when a annotation is destroyed.
125
- * @param {String} event The annotationDestroyed event
126
- * @param {Function} callback Callback fired on the event
127
- */
128
- on(event: "annotationDestroyed", callback: (annotationId: string)=> void): void;
111
+ /**
112
+ * Destroys all {@link Annotation}s.
113
+ */
114
+ clear(): void;
129
115
 
130
- /**
131
- * Fires when a mouse enters a annotation.
132
- * @param {String} event The markerMouseEnter event
133
- * @param {Function} callback Callback fired on the event
134
- */
135
- on(event: "markerMouseEnter", callback: (annotation: Annotation)=> void): void;
116
+ /**
117
+ * Fires when a annotation is created.
118
+ * @param {String} event The annotationCreated event
119
+ * @param {Function} callback Callback fired on the event
120
+ */
121
+ on(event: "annotationCreated", callback: (annotationId: string) => void): void;
136
122
 
137
- /**
138
- * Fires when a mouse leave an annotation.
139
- * @param {String} event The markerMouseLeave event
140
- * @param {Function} callback Callback fired on the event
141
- */
142
- on(event: "markerMouseLeave", callback: (annotation: Annotation)=> void): void;
123
+ /**
124
+ * Fires when a annotation is destroyed.
125
+ * @param {String} event The annotationDestroyed event
126
+ * @param {Function} callback Callback fired on the event
127
+ */
128
+ on(event: "annotationDestroyed", callback: (annotationId: string) => void): void;
143
129
 
144
- /**
145
- * Fires when a mouse leave an annotation.
146
- * @param {String} event The markerClicked event
147
- * @param {Function} callback Callback fired on the event
148
- */
149
- on(event: "markerClicked", callback: (annotation: Annotation)=> void): void;
130
+ /**
131
+ * Fires when a mouse enters a annotation.
132
+ * @param {String} event The markerMouseEnter event
133
+ * @param {Function} callback Callback fired on the event
134
+ */
135
+ on(event: "markerMouseEnter", callback: (annotation: Annotation) => void): void;
136
+
137
+ /**
138
+ * Fires when a mouse leave an annotation.
139
+ * @param {String} event The markerMouseLeave event
140
+ * @param {Function} callback Callback fired on the event
141
+ */
142
+ on(event: "markerMouseLeave", callback: (annotation: Annotation) => void): void;
143
+
144
+ /**
145
+ * Fires when a mouse click an annotation.
146
+ * @param {String} event The markerClicked event
147
+ * @param {Function} callback Callback fired on the event
148
+ */
149
+ on(event: "markerClicked", callback: (annotation: Annotation) => void): void;
150
+
151
+ /**
152
+ * Fires when a mouse dbclick an annotation.
153
+ * @param {String} event The markerDoubleClicked event
154
+ * @param {Function} callback Callback fired on the event
155
+ */
156
+ on(event: "markerDoubleClicked", callback: (annotation: Annotation) => void): void;
150
157
  }