@inweb/viewer-core 27.4.6 → 27.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/viewer-core.js +95 -5
- package/dist/viewer-core.js.map +1 -1
- package/dist/viewer-core.module.js +95 -5
- package/dist/viewer-core.module.js.map +1 -1
- package/lib/options/IOptions.d.ts +75 -2
- package/lib/options/Options.d.ts +42 -0
- package/lib/viewer/IViewer.d.ts +5 -3
- package/lib/viewer/IViewpoint.d.ts +15 -5
- package/lib/viewer/ViewerEvents.d.ts +17 -0
- package/package.json +3 -3
- package/src/options/IOptions.ts +81 -2
- package/src/options/Options.ts +110 -5
- package/src/viewer/IViewer.ts +5 -3
- package/src/viewer/IViewpoint.ts +15 -6
- package/src/viewer/ViewerEvents.ts +19 -0
package/src/options/IOptions.ts
CHANGED
|
@@ -128,12 +128,82 @@ export interface IOptions {
|
|
|
128
128
|
memoryLimit?: number;
|
|
129
129
|
|
|
130
130
|
/**
|
|
131
|
-
*
|
|
131
|
+
* Deprecated since `27.5`. Use {@link sectionFillColor} instead.
|
|
132
132
|
*
|
|
133
|
-
* @
|
|
133
|
+
* @deprecated
|
|
134
134
|
*/
|
|
135
135
|
cuttingPlaneFillColor?: RGB;
|
|
136
136
|
|
|
137
|
+
/**
|
|
138
|
+
* Show solid fill on section caps.
|
|
139
|
+
*
|
|
140
|
+
* When disabled, neither the fill nor the hatch is drawn (the outline, if enabled, is still shown).
|
|
141
|
+
*
|
|
142
|
+
* @defaultValue true
|
|
143
|
+
*/
|
|
144
|
+
enableSectionFill?: boolean;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Section cap fill color.
|
|
148
|
+
*
|
|
149
|
+
* @defaultValue { red: 0xff, green: 0x98, blue: 0x00 }
|
|
150
|
+
*/
|
|
151
|
+
sectionFillColor?: { r: number; g: number; b: number };
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Use the intersected object's color for the section cap fill.
|
|
155
|
+
*
|
|
156
|
+
* When enabled, each section cap is filled with a color derived from the intersected object and
|
|
157
|
+
* `sectionFillColor` is ignored. The outline color is not affected.
|
|
158
|
+
*
|
|
159
|
+
* @defaultValue false
|
|
160
|
+
*/
|
|
161
|
+
sectionUseObjectColor?: boolean;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Overlay a hatch pattern on top of the section fill.
|
|
165
|
+
*
|
|
166
|
+
* @defaultValue true
|
|
167
|
+
*/
|
|
168
|
+
enableSectionHatch?: boolean;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Hatch line color used on top of the section fill.
|
|
172
|
+
*
|
|
173
|
+
* @defaultValue { red: 0x4b, green: 0x4c, blue: 0x35 }
|
|
174
|
+
*/
|
|
175
|
+
sectionHatchColor?: { r: number; g: number; b: number };
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Distance between hatch lines, in screen-space pixels.
|
|
179
|
+
*
|
|
180
|
+
* Larger values produce sparser hatching.
|
|
181
|
+
*
|
|
182
|
+
* @defaultValue 8
|
|
183
|
+
*/
|
|
184
|
+
sectionHatchScale?: number;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Draw the outline contour along the section boundary.
|
|
188
|
+
*
|
|
189
|
+
* @defaultValue true
|
|
190
|
+
*/
|
|
191
|
+
enableSectionOutline?: boolean;
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Color of the section outline contour.
|
|
195
|
+
*
|
|
196
|
+
* @defaultValue { red: 0, green: 0, blue: 0 }
|
|
197
|
+
*/
|
|
198
|
+
sectionOutlineColor?: { r: number; g: number; b: number };
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Width of the section outline contour, in pixels.
|
|
202
|
+
*
|
|
203
|
+
* @defaultValue 2
|
|
204
|
+
*/
|
|
205
|
+
sectionOutlineWidth?: number;
|
|
206
|
+
|
|
137
207
|
/**
|
|
138
208
|
* Edges highlight color.
|
|
139
209
|
*/
|
|
@@ -315,6 +385,15 @@ export function defaultOptions(): IOptions {
|
|
|
315
385
|
enablePartialMode: false,
|
|
316
386
|
memoryLimit: 3294967296,
|
|
317
387
|
cuttingPlaneFillColor: { red: 0xff, green: 0x98, blue: 0x00 },
|
|
388
|
+
enableSectionFill: true,
|
|
389
|
+
sectionFillColor: { r: 0xff, g: 0x98, b: 0x00 },
|
|
390
|
+
sectionUseObjectColor: false,
|
|
391
|
+
enableSectionHatch: true,
|
|
392
|
+
sectionHatchColor: { r: 0, g: 0, b: 0 },
|
|
393
|
+
sectionHatchScale: 8,
|
|
394
|
+
enableSectionOutline: true,
|
|
395
|
+
sectionOutlineColor: { r: 0, g: 0, b: 0 },
|
|
396
|
+
sectionOutlineWidth: 2,
|
|
318
397
|
edgesColor: { r: 0xff, g: 0x98, b: 0x00 },
|
|
319
398
|
facesColor: { r: 0xff, g: 0x98, b: 0x00 },
|
|
320
399
|
edgesVisibility: true,
|
package/src/options/Options.ts
CHANGED
|
@@ -90,9 +90,19 @@ export class Options implements IOptions {
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
set data(value: IOptions) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
this._data = { ...Options.defaults(), ...this._data, ...value };
|
|
94
|
+
// partial mode first
|
|
95
|
+
if (this._data.enablePartialMode) {
|
|
96
|
+
this._data.enableStreamingMode = true;
|
|
97
|
+
this._data.sceneGraph = false;
|
|
98
|
+
}
|
|
99
|
+
// sectionFillColor since 27.5
|
|
100
|
+
if (!value.sectionFillColor && value.cuttingPlaneFillColor)
|
|
101
|
+
this._data.sectionFillColor = {
|
|
102
|
+
r: value.cuttingPlaneFillColor.red,
|
|
103
|
+
g: value.cuttingPlaneFillColor.green,
|
|
104
|
+
b: value.cuttingPlaneFillColor.blue,
|
|
105
|
+
};
|
|
96
106
|
this.change();
|
|
97
107
|
}
|
|
98
108
|
|
|
@@ -201,11 +211,106 @@ export class Options implements IOptions {
|
|
|
201
211
|
}
|
|
202
212
|
|
|
203
213
|
get cuttingPlaneFillColor(): RGB {
|
|
204
|
-
|
|
214
|
+
console.warn(
|
|
215
|
+
"Options.cuttingPlaneFillColor has been deprecated since 27.5 and will be removed in a future release, use sectionFillColor instead"
|
|
216
|
+
);
|
|
217
|
+
return {
|
|
218
|
+
red: this._data.sectionFillColor.r,
|
|
219
|
+
green: this._data.sectionFillColor.g,
|
|
220
|
+
blue: this._data.sectionFillColor.b,
|
|
221
|
+
};
|
|
205
222
|
}
|
|
206
223
|
|
|
207
224
|
set cuttingPlaneFillColor(value: RGB) {
|
|
208
|
-
|
|
225
|
+
console.warn(
|
|
226
|
+
"Options.cuttingPlaneFillColor has been deprecated since 27.5 and will be removed in a future release, use sectionFillColor instead"
|
|
227
|
+
);
|
|
228
|
+
this._data.sectionFillColor = {
|
|
229
|
+
r: value.red,
|
|
230
|
+
g: value.green,
|
|
231
|
+
b: value.blue,
|
|
232
|
+
};
|
|
233
|
+
this.change();
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
get enableSectionFill(): boolean {
|
|
237
|
+
return this._data.enableSectionFill;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
set enableSectionFill(value: boolean) {
|
|
241
|
+
this._data.enableSectionFill = value;
|
|
242
|
+
this.change();
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
get sectionFillColor() {
|
|
246
|
+
return this._data.sectionFillColor;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
set sectionFillColor(value) {
|
|
250
|
+
this._data.sectionFillColor = value;
|
|
251
|
+
this.change();
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
get sectionUseObjectColor(): boolean {
|
|
255
|
+
return this._data.sectionUseObjectColor;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
set sectionUseObjectColor(value: boolean) {
|
|
259
|
+
this._data.sectionUseObjectColor = value;
|
|
260
|
+
this.change();
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
get enableSectionHatch(): boolean {
|
|
264
|
+
return this._data.enableSectionHatch;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
set enableSectionHatch(value: boolean) {
|
|
268
|
+
this._data.enableSectionHatch = value;
|
|
269
|
+
this.change();
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
get sectionHatchColor() {
|
|
273
|
+
return this._data.sectionHatchColor;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
set sectionHatchColor(value) {
|
|
277
|
+
this._data.sectionHatchColor = value;
|
|
278
|
+
this.change();
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
get sectionHatchScale(): number {
|
|
282
|
+
return this._data.sectionHatchScale;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
set sectionHatchScale(value: number) {
|
|
286
|
+
this._data.sectionHatchScale = value;
|
|
287
|
+
this.change();
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
get enableSectionOutline(): boolean {
|
|
291
|
+
return this._data.enableSectionOutline;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
set enableSectionOutline(value: boolean) {
|
|
295
|
+
this._data.enableSectionOutline = value;
|
|
296
|
+
this.change();
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
get sectionOutlineColor() {
|
|
300
|
+
return this._data.sectionOutlineColor;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
set sectionOutlineColor(value) {
|
|
304
|
+
this._data.sectionOutlineColor = value;
|
|
305
|
+
this.change();
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
get sectionOutlineWidth(): number {
|
|
309
|
+
return this._data.sectionOutlineWidth;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
set sectionOutlineWidth(value: number) {
|
|
313
|
+
this._data.sectionOutlineWidth = value;
|
|
209
314
|
this.change();
|
|
210
315
|
}
|
|
211
316
|
|
package/src/viewer/IViewer.ts
CHANGED
|
@@ -167,10 +167,12 @@ export interface IViewer extends IEventEmitter, ICommandService {
|
|
|
167
167
|
* - {@link UpdateEvent | update}
|
|
168
168
|
* - {@link RenderEvent | render}
|
|
169
169
|
*
|
|
170
|
-
* @param force - If `true` updates the viewer immidietly.
|
|
171
|
-
* the
|
|
170
|
+
* @param force - If `true` updates the viewer immidietly. If a `number` is specified and more than the
|
|
171
|
+
* given amount of milliseconds has elapsed since the last rendering, the update is performed
|
|
172
|
+
* immediately as well. Otherwise the update will be scheduled for the next animation frame. Default
|
|
173
|
+
* is `false`.
|
|
172
174
|
*/
|
|
173
|
-
update(force?: boolean): void;
|
|
175
|
+
update(force?: boolean | number): void;
|
|
174
176
|
|
|
175
177
|
/**
|
|
176
178
|
* Loads a file into the viewer.
|
package/src/viewer/IViewpoint.ts
CHANGED
|
@@ -226,9 +226,10 @@ export interface IText {
|
|
|
226
226
|
font_size?: number;
|
|
227
227
|
|
|
228
228
|
/**
|
|
229
|
-
* Deprecated. Use {@link font_size} instead.
|
|
229
|
+
* Deprecated since `25.3`. Use {@link font_size} instead.
|
|
230
|
+
*
|
|
231
|
+
* @deprecated
|
|
230
232
|
*/
|
|
231
|
-
|
|
232
233
|
text_size?: number;
|
|
233
234
|
|
|
234
235
|
/**
|
|
@@ -373,12 +374,16 @@ export interface IImage {
|
|
|
373
374
|
src: string;
|
|
374
375
|
|
|
375
376
|
/**
|
|
376
|
-
* Deprecated. Use {@link position2} instead. Width of the image.
|
|
377
|
+
* Deprecated since `26.5`. Use {@link position2} instead. Width of the image.
|
|
378
|
+
*
|
|
379
|
+
* @deprecated
|
|
377
380
|
*/
|
|
378
381
|
width?: number;
|
|
379
382
|
|
|
380
383
|
/**
|
|
381
|
-
* Deprecated. Use {@link position2} instead. Height of the image.
|
|
384
|
+
* Deprecated since `26.5`. Use {@link position2} instead. Height of the image.
|
|
385
|
+
*
|
|
386
|
+
* @deprecated
|
|
382
387
|
*/
|
|
383
388
|
height?: number;
|
|
384
389
|
|
|
@@ -403,12 +408,16 @@ export interface IRectangle {
|
|
|
403
408
|
position2: IPoint;
|
|
404
409
|
|
|
405
410
|
/**
|
|
406
|
-
* Deprecated. Use {@link position2} instead. Width of the rectangle.
|
|
411
|
+
* Deprecated since `26.5`. Use {@link position2} instead. Width of the rectangle.
|
|
412
|
+
*
|
|
413
|
+
* @deprecated
|
|
407
414
|
*/
|
|
408
415
|
width?: number;
|
|
409
416
|
|
|
410
417
|
/**
|
|
411
|
-
* Deprecated. Use {@link position2} instead. Height of the rectangle.
|
|
418
|
+
* Deprecated since `26.5`. Use {@link position2} instead. Height of the rectangle.
|
|
419
|
+
*
|
|
420
|
+
* @deprecated
|
|
412
421
|
*/
|
|
413
422
|
height?: number;
|
|
414
423
|
|
|
@@ -100,6 +100,20 @@ export interface ChangeCameraModeEvent {
|
|
|
100
100
|
mode: string;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Event that fires when cutting planes (slices) have been changed.
|
|
105
|
+
*
|
|
106
|
+
* Fires when cutting planes are added, deleted, or transformed (moved/rotated).
|
|
107
|
+
*
|
|
108
|
+
* @event
|
|
109
|
+
*/
|
|
110
|
+
export interface ChangeCuttingPlanesEvent {
|
|
111
|
+
/**
|
|
112
|
+
* Event type.
|
|
113
|
+
*/
|
|
114
|
+
type: "changecuttingplanes";
|
|
115
|
+
}
|
|
116
|
+
|
|
103
117
|
/**
|
|
104
118
|
* Event that fires when the default color of new markup objects has been changed.
|
|
105
119
|
*
|
|
@@ -807,6 +821,11 @@ export interface ViewerEventMap {
|
|
|
807
821
|
*/
|
|
808
822
|
changecameramode: ChangeCameraModeEvent;
|
|
809
823
|
|
|
824
|
+
/**
|
|
825
|
+
* Event that fires when cutting planes (slices) have been changed.
|
|
826
|
+
*/
|
|
827
|
+
changecuttingplanes: ChangeCuttingPlanesEvent;
|
|
828
|
+
|
|
810
829
|
/**
|
|
811
830
|
* Event that fires when the markup color has been changed.
|
|
812
831
|
*/
|