@vitrosoftware/common-ui-ts 1.1.169 → 1.1.171

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.
Files changed (38) hide show
  1. package/css/std/controls/bim-viewer/annotation.css +7 -2
  2. package/css/std/controls/bim-viewer/bim-viewer-index.css +27 -3
  3. package/css/std/controls/bim-viewer/bim-viewer.css +12 -1
  4. package/css/std/controls/bim-viewer/img/hide-annotation-description.svg +19 -0
  5. package/css/std/controls/bim-viewer/img/show-annotation-description.svg +18 -0
  6. package/css/std/controls/bim-viewer/toolbar.css +8 -0
  7. package/css/std/controls/criterion/criterion.css +0 -1
  8. package/css/std/controls/criterion-field-iterator/criterion-field-iterator.css +8 -9
  9. package/css/std/controls/heading/heading.css +0 -7
  10. package/css/std/controls/search/search.css +12 -7
  11. package/css/std/controls/table-view/img/date-picker.svg +4 -0
  12. package/css/std/controls/table-view/table-view-custom-date-edit.css +23 -0
  13. package/css/std/controls/table-view/table-view.css +0 -7
  14. package/css/std/controls/tree-view/tree-view.css +3 -13
  15. package/css/std/controls/video-viewer/img/video-viewer-close.svg +3 -0
  16. package/css/std/controls/video-viewer/video-viewer.css +56 -0
  17. package/dist/index.css +79 -45
  18. package/dist/index.js +226 -36
  19. package/dist/index.js.map +1 -1
  20. package/dist/src/controls/CheckboxReorderableList/CheckboxReorderableList.d.ts +2 -5
  21. package/dist/src/controls/CheckboxReorderableList/CheckboxReorderableListItem.d.ts +6 -0
  22. package/dist/src/controls/CriterionFieldIterator/CriterionFieldIterator.d.ts +1 -0
  23. package/dist/src/controls/EditableList/EditableList.d.ts +3 -9
  24. package/dist/src/controls/EditableList/EditableListItem.d.ts +6 -0
  25. package/dist/src/controls/TableView/TableViewConstants.d.ts +2 -1
  26. package/dist/src/controls/TreeView/TreeView.d.ts +2 -0
  27. package/dist/src/controls/VideoViewer/TelerikMediaPlayerConstants.d.ts +8 -0
  28. package/dist/src/controls/VideoViewer/TelerikMediaPlayerContext.d.ts +19 -0
  29. package/dist/src/controls/VideoViewer/TelerikMediaPlayerContextImpl.d.ts +50 -0
  30. package/dist/src/controls/VideoViewer/TelerikMediaPlayerSettings.d.ts +13 -0
  31. package/dist/src/controls/VideoViewer/VideoItem.d.ts +5 -0
  32. package/dist/src/controls/VideoViewer/VideoViewer.d.ts +18 -0
  33. package/dist/src/controls/VideoViewer/VideoViewerRef.d.ts +4 -0
  34. package/dist/src/index.d.ts +8 -2
  35. package/package.json +1 -1
  36. package/src/controls/BimViewer/js/bim-viewer.js +125 -10
  37. package/src/controls/DxfViewer/js/dxf-viewer.js +88 -15
  38. package/src/controls/PdfViewer/js/pdf-viewer.js +1 -1
@@ -1,10 +1,7 @@
1
1
  /// <reference types="react" />
2
+ import { CheckboxReorderableListItem } from './CheckboxReorderableListItem';
2
3
  interface CheckboxReorderableListProps {
3
- itemList: {
4
- id: string;
5
- text: string;
6
- value?: boolean;
7
- }[];
4
+ itemList: CheckboxReorderableListItem[];
8
5
  onChange?: (selectedItemList: any[]) => void;
9
6
  isAllSelected?: boolean;
10
7
  className?: string;
@@ -0,0 +1,6 @@
1
+ export interface CheckboxReorderableListItem {
2
+ id: string;
3
+ index: number;
4
+ text: string;
5
+ value?: boolean;
6
+ }
@@ -19,6 +19,7 @@ interface CriterionFieldIteratorProps {
19
19
  isMobileView?: boolean;
20
20
  isNoScrollBar?: boolean;
21
21
  isClearChangedFieldValueMap?: boolean;
22
+ className?: string;
22
23
  }
23
24
  export declare const CriterionFieldIterator: (props: CriterionFieldIteratorProps) => JSX.Element;
24
25
  export {};
@@ -1,15 +1,9 @@
1
1
  import React from 'react';
2
2
  import { DropdownItem } from '../DropdownButton/DropdownItem';
3
+ import { EditableListItem } from './EditableListItem';
3
4
  interface EditableListProps {
4
- itemList: {
5
- id: string;
6
- text: string;
7
- dropdownItemList?: DropdownItem[];
8
- }[];
9
- newItem?: {
10
- id: string;
11
- text: string;
12
- };
5
+ itemList: EditableListItem[];
6
+ newItem?: EditableListItem;
13
7
  title?: string;
14
8
  createButtonTooltip?: string;
15
9
  editedItemId?: string;
@@ -0,0 +1,6 @@
1
+ import { DropdownItem } from '../DropdownButton/DropdownItem';
2
+ export interface EditableListItem {
3
+ id: string;
4
+ text: string;
5
+ dropdownItemList?: DropdownItem[];
6
+ }
@@ -57,7 +57,8 @@ export declare enum EVENT {
57
57
  ON_ZOOM = "OnZoom",
58
58
  ON_GET_DEPENDENCY = "OnGetDependency",
59
59
  ON_DATA_RECEIVE = "OnDataReceive",
60
- ON_GET_TYPE = "OnGetType"
60
+ ON_GET_TYPE = "OnGetType",
61
+ ON_BUTTON_CLICK = "OnButtonClick"
61
62
  }
62
63
  export declare enum URL {
63
64
  LAYOUT = "Layout",
@@ -10,6 +10,7 @@ export interface TreeViewProps {
10
10
  onDrop?: (treeView: TreeViewContext, targetNode: JsTreeViewNode, eventDetail: {
11
11
  target: any;
12
12
  }, e: DragEvent) => void;
13
+ onInitScrollBar?: (container?: HTMLDivElement) => void;
13
14
  isCheckboxSelect?: boolean;
14
15
  isSaveCheckboxState?: boolean;
15
16
  isSaveState?: boolean;
@@ -17,5 +18,6 @@ export interface TreeViewProps {
17
18
  selectNodeId?: string;
18
19
  isExpandButtonRight?: boolean;
19
20
  isRootCanCollapse?: boolean;
21
+ className?: string;
20
22
  }
21
23
  export declare const TreeView: (props: TreeViewProps) => JSX.Element;
@@ -0,0 +1,8 @@
1
+ export declare enum LOCALE {
2
+ PLAY = "app.common.videoViewer.action.play",
3
+ PAUSE = "app.common.videoViewer.action.pause",
4
+ MUTE = "app.common.videoViewer.action.mute",
5
+ UNMUTE = "app.common.videoViewer.action.unmute",
6
+ FULLSCREEN = "app.common.videoViewer.action.fullscreen",
7
+ QUALITY = "app.common.videoViewer.action.quality"
8
+ }
@@ -0,0 +1,19 @@
1
+ export interface TelerikMediaPlayerContext {
2
+ setFullScreen(isFullScreen?: boolean): void;
3
+ setMedia(media: {
4
+ title?: string;
5
+ source: string;
6
+ poster?: string;
7
+ }): void;
8
+ setVolume(volume: number): void;
9
+ play(): void;
10
+ stop(): void;
11
+ pause(): void;
12
+ seek(seekTime: number): void;
13
+ getToolbar(): any;
14
+ getTitlebar(): any;
15
+ getIsPaused(): boolean;
16
+ getIsPlaying(): boolean;
17
+ getIsEnded(): boolean;
18
+ getIsFullScreen(): boolean;
19
+ }
@@ -0,0 +1,50 @@
1
+ import { LocaleService } from '../../services/LocaleService';
2
+ import { TelerikMediaPlayerContext } from './TelerikMediaPlayerContext';
3
+ import { TelerikMediaPlayerSettings } from './TelerikMediaPlayerSettings';
4
+ export declare class TelerikMediaPlayerContextImpl implements TelerikMediaPlayerContext {
5
+ private playerContainer;
6
+ private player;
7
+ private localeService;
8
+ constructor(playerContainer: any, settings: TelerikMediaPlayerSettings, localeService: LocaleService);
9
+ getPlayerConfig(settings: TelerikMediaPlayerSettings): {
10
+ media: {
11
+ title: string;
12
+ source: string;
13
+ poster: string | boolean;
14
+ };
15
+ autoPlay: boolean;
16
+ autoRepeat: boolean;
17
+ fullScreen: boolean;
18
+ mute: boolean;
19
+ volume: number;
20
+ ready: boolean | (() => void);
21
+ play: boolean | (() => void);
22
+ pause: boolean | (() => void);
23
+ onEnd: boolean | (() => void);
24
+ messages: {
25
+ play: string;
26
+ pause: string;
27
+ mute: string;
28
+ unmute: string;
29
+ fullscreen: string;
30
+ quality: string;
31
+ };
32
+ };
33
+ setFullScreen(isFullScreen?: boolean): void;
34
+ setMedia(media: {
35
+ title?: string;
36
+ source: string;
37
+ poster?: string;
38
+ }): void;
39
+ setVolume(volume: number): void;
40
+ play(): void;
41
+ stop(): void;
42
+ pause(): void;
43
+ seek(seekTime: number): void;
44
+ getToolbar(): any;
45
+ getTitlebar(): any;
46
+ getIsPaused(): any;
47
+ getIsPlaying(): any;
48
+ getIsEnded(): any;
49
+ getIsFullScreen(): any;
50
+ }
@@ -0,0 +1,13 @@
1
+ import { VideoItem } from './VideoItem';
2
+ export interface TelerikMediaPlayerSettings {
3
+ isAutoPlay?: boolean;
4
+ isAutoRepeat?: boolean;
5
+ isFullScreen?: boolean;
6
+ media: VideoItem;
7
+ isMute?: boolean;
8
+ volume?: number;
9
+ onReady?: () => void;
10
+ onPlay?: () => void;
11
+ onPause?: () => void;
12
+ onEnd?: () => void;
13
+ }
@@ -0,0 +1,5 @@
1
+ export interface VideoItem {
2
+ title?: string;
3
+ poster?: string;
4
+ url: string;
5
+ }
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { VideoViewerRef } from './VideoViewerRef';
3
+ import { VideoItem } from './VideoItem';
4
+ interface VideoViewerProps {
5
+ isAutoPlay?: boolean;
6
+ isAutoRepeat?: boolean;
7
+ isFullScreen?: boolean;
8
+ isMute?: boolean;
9
+ item: VideoItem;
10
+ volume?: number;
11
+ onCloseClick: () => void;
12
+ onReady?: () => void;
13
+ onPlay?: () => void;
14
+ onPause?: () => void;
15
+ onEnd?: () => void;
16
+ }
17
+ export declare const VideoViewer: React.ForwardRefExoticComponent<VideoViewerProps & React.RefAttributes<VideoViewerRef>>;
18
+ export {};
@@ -0,0 +1,4 @@
1
+ import { VideoItem } from './VideoItem';
2
+ export interface VideoViewerRef {
3
+ setItem(item: VideoItem): void;
4
+ }
@@ -153,13 +153,18 @@ import { Select } from './controls/Select/Select';
153
153
  import { CopyButton } from './controls/CopyButton/CopyButton';
154
154
  import { Switch } from './controls/Switch/Switch';
155
155
  import { EditableList } from './controls/EditableList/EditableList';
156
+ import { EditableListItem } from './controls/EditableList/EditableListItem';
156
157
  import { ReorderableList } from './controls/ReorderableList/ReorderableList';
157
158
  import { CheckboxReorderableList } from './controls/CheckboxReorderableList/CheckboxReorderableList';
159
+ import { CheckboxReorderableListItem } from './controls/CheckboxReorderableList/CheckboxReorderableListItem';
158
160
  import { PinButton } from './controls/PinButton/PinButton';
159
161
  import { DropZone } from './controls/DropZone/DropZone';
160
162
  import { FileList } from './controls/FileList/FileList';
161
163
  import { FilePicker } from './controls/FilePicker/FilePicker';
162
164
  import { FilePickerProps } from './controls/FilePicker/FilePicker';
165
+ import { VideoViewer } from './controls/VideoViewer/VideoViewer';
166
+ import { VideoViewerRef } from './controls/VideoViewer/VideoViewerRef';
167
+ import { VideoItem } from './controls/VideoViewer/VideoItem';
163
168
  export { Breadcrumbs };
164
169
  export { TopLevelMenu };
165
170
  export { TreeView, TreeViewContext, TREE_VIEW, TreeViewProps, JsTreeViewNode };
@@ -254,10 +259,11 @@ export { ErrorMessage };
254
259
  export { Select };
255
260
  export { CopyButton };
256
261
  export { Switch };
257
- export { EditableList };
262
+ export { EditableList, EditableListItem };
258
263
  export { ReorderableList };
259
- export { CheckboxReorderableList };
264
+ export { CheckboxReorderableList, CheckboxReorderableListItem };
260
265
  export { PinButton };
261
266
  export { DropZone };
262
267
  export { FilePicker, FilePickerProps };
263
268
  export { FileList };
269
+ export { VideoViewer, VideoViewerRef, VideoItem };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitrosoftware/common-ui-ts",
3
- "version": "1.1.169",
3
+ "version": "1.1.171",
4
4
  "description": "vitro software common ui ts",
5
5
  "author": "",
6
6
  "license": "MIT",
@@ -1,11 +1,11 @@
1
- import { BIMModel, BIMCommon, BIMAnnotation } from '/resource/bimViewer/js/bim-viewer-models.js?version=1.1.169';
1
+ import { BIMModel, BIMCommon, BIMAnnotation } from '/resource/bimViewer/js/bim-viewer-models.js?version=1.1.171';
2
2
 
3
3
  import {
4
4
  Viewer, XKTLoaderPlugin, NavCubePlugin, SectionPlanesPlugin, math, BCFViewpointsPlugin, AnnotationsPlugin,
5
5
  ContextMenu, TreeViewPlugin, StoreyViewsPlugin, AngleMeasurementsPlugin, CameraMemento, DistanceMeasurementsPlugin,
6
6
  GLTFLoaderPlugin, utils, FastNavPlugin, MetaObject, parsers
7
7
  }
8
- from '/resource/bimViewer/js/xeokit/xeokit-sdk.es.js?version=1.1.169';
8
+ from '/resource/bimViewer/js/xeokit/xeokit-sdk.es.js?version=1.1.171';
9
9
 
10
10
 
11
11
  //----------------------------------------------------------------------------------------------------------------------
@@ -1353,6 +1353,10 @@ var prevAnnotationClicked = null;
1353
1353
  // Annotation onClick
1354
1354
  //------------------------------------------------------------------------------------------------------------------
1355
1355
  annotations.on("markerClicked", (annotation) => {
1356
+ onAnnotationsMarkerClickedHandler(annotation);
1357
+ });
1358
+
1359
+ function onAnnotationsMarkerClickedHandler(annotation) {
1356
1360
  //console.log('annotation', annotation.id);
1357
1361
  showNoteDesc(annotation.id);
1358
1362
 
@@ -1362,7 +1366,7 @@ annotations.on("markerClicked", (annotation) => {
1362
1366
  annotation.setLabelShown(true);
1363
1367
  viewer.cameraFlight.flyTo(annotation);
1364
1368
  prevAnnotationClicked = annotation;
1365
- });
1369
+ }
1366
1370
 
1367
1371
  //------------------------------------------------------------------------------------------------------------------
1368
1372
  // Load Model
@@ -3094,6 +3098,8 @@ function initPropertySetsResizable() {
3094
3098
  //
3095
3099
  //------------------------------------------------------------------------------------------------------------------
3096
3100
 
3101
+ var notesDescriptionVisibleList = {};
3102
+
3097
3103
  BIMAnnotation.GetNote = (callback) => {
3098
3104
  callback([]);
3099
3105
  }
@@ -3127,6 +3133,10 @@ function createMarkupData(pickResult) {
3127
3133
  markup.up.push(up[1]);
3128
3134
  markup.up.push(up[2]);
3129
3135
 
3136
+ if (pickResult.entity && pickResult.entity.id) {
3137
+ markup.entity = pickResult.entity.id;
3138
+ }
3139
+
3130
3140
  return markup;
3131
3141
  }
3132
3142
 
@@ -3206,7 +3216,7 @@ function getMarkupData(item) {
3206
3216
  eye: markup.eye, // need for camera fly on sidebar click
3207
3217
  look: markup.look, // need for camera fly on sidebar click
3208
3218
  up: markup.up, // need for camera fly on sidebar click
3209
- occludable: true,
3219
+ occludable: false,
3210
3220
  markerShown: true,
3211
3221
  labelShown: false,
3212
3222
  version: '',
@@ -3220,8 +3230,8 @@ function getMarkupData(item) {
3220
3230
  }
3221
3231
  };
3222
3232
 
3223
- if (markup.entity && markup.entity.id) {
3224
- options.entity = markup.entity.id;
3233
+ if (markup.entity) {
3234
+ options.entity = viewer.scene.objects[markup.entity];
3225
3235
  }
3226
3236
 
3227
3237
  return options;
@@ -3262,24 +3272,37 @@ function updatePage(e) {
3262
3272
  }
3263
3273
  });
3264
3274
  window.dispatchEvent(event);
3275
+ setTimeout(function () {
3276
+ if (isNoteDescriptionVisible(data.id)) {
3277
+ annotations.annotations[data.id].setLabelShown(true);
3278
+ } else {
3279
+ annotations.annotations[data.id].setLabelShown(false);
3280
+ }
3281
+ }, 10);
3265
3282
  }
3266
3283
 
3267
3284
  if (e.type === context.deleteIssueEvent) {
3268
3285
 
3269
3286
  let item = e.detail.itemList[0];
3270
3287
  annotations.destroyAnnotation(item.fieldValueMap.item_id);
3271
-
3272
3288
  if ($('.sidebar').is(':visible')) {
3273
3289
  initSidebarNotes();
3274
3290
  }
3291
+ if (isNoteDescriptionVisible(item.fieldValueMap.item_id)) {
3292
+ removeFromNotesDescriptionVisibleList(item.fieldValueMap.item_id);
3293
+ }
3275
3294
  }
3276
3295
  }
3277
3296
 
3278
3297
  function goToNoteMarker(issue) {
3279
3298
  if (!$('#btnCreateNotes').hasClass('toggled')) {
3299
+ hideNotesDescription();
3300
+ clearNotesDesriptionVisibleList();
3301
+ addToNotesDescriptionVisibleList(issue.id);
3280
3302
  var annotation = annotations.annotations[issue.id];
3281
- console.log('annotation', annotation);
3282
3303
  viewer.cameraFlight.flyTo(annotation);
3304
+ annotation.occludable = false;
3305
+ annotation.setLabelShown(true);
3283
3306
  highlightSidebarNote(issue.id);
3284
3307
  }
3285
3308
  }
@@ -3370,7 +3393,7 @@ function loadAnnotations() {
3370
3393
  context.getIssueList().then(issueList => {
3371
3394
  issueList.map(issue => {
3372
3395
  let data = getMarkupData(issue.item);
3373
- data.entity = viewer.scene.objects[data.entity];
3396
+ data.occludable = false;
3374
3397
  annotations.createAnnotation(data);
3375
3398
  })
3376
3399
  })
@@ -3901,7 +3924,98 @@ function convertProperty(data) {
3901
3924
 
3902
3925
  return groups;
3903
3926
  }
3904
-
3927
+
3928
+ function onAnnotationsMarkerClickedHandler(annotation) {
3929
+ showNoteDesc(annotation.id);
3930
+ if (annotation.getLabelShown()) {
3931
+ removeFromNotesDescriptionVisibleList(annotation.id);
3932
+ } else {
3933
+ addToNotesDescriptionVisibleList(annotation.id);
3934
+ }
3935
+ annotation.occludable = false;
3936
+ annotation.setLabelShown(!annotation.getLabelShown());
3937
+ viewer.cameraFlight.flyTo(annotation);
3938
+ }
3939
+
3940
+ function doGetNoteOptions(noteId, creator, pickResult, glyph, title, description, imageSrc, bgColor) {
3941
+ var options = {
3942
+ id: noteId,
3943
+ creator: creator,
3944
+ pickResult: pickResult,
3945
+ worldPos: pickResult.worldPos,
3946
+ eye: viewer.camera.eye, // need for camera fly on sidebar click
3947
+ look: viewer.camera.look, // need for camera fly on sidebar click
3948
+ up: viewer.camera.up, // need for camera fly on sidebar click
3949
+ occludable: false,
3950
+ markerShown: true,
3951
+ labelShown: false,
3952
+ version: fileVersion,
3953
+ fileVersionPath: fileVersionPath,
3954
+ values: {
3955
+ glyph: glyph,
3956
+ title: title,
3957
+ description: description,
3958
+ markerBGColor: bgColor,
3959
+ imageSrc: imageSrc
3960
+ }
3961
+ };
3962
+
3963
+ if (pickResult.entity && pickResult.entity.id) {
3964
+ options.entity = pickResult.entity.id;
3965
+ }
3966
+
3967
+ return options;
3968
+ }
3969
+
3970
+ function bindToggleNotesDescription() {
3971
+ $(document).on('click', '#btnToggleNotesDescription', function () {
3972
+ $(this).toggleClass('show');
3973
+ if ($(this).hasClass('show')) {
3974
+ hideNotesDescription();
3975
+ } else {
3976
+ showNotesDescription();
3977
+ }
3978
+ });
3979
+ }
3980
+
3981
+ function hideNotesDescription() {
3982
+ if (annotations?.annotations) {
3983
+ $.each(annotations.annotations, function () {
3984
+ this.setLabelShown(false);
3985
+ });
3986
+ }
3987
+ clearNotesDesriptionVisibleList();
3988
+ }
3989
+
3990
+ function addToNotesDescriptionVisibleList(itemKey) {
3991
+ if (!notesDescriptionVisibleList.hasOwnProperty(itemKey)) {
3992
+ notesDescriptionVisibleList[itemKey] = true;
3993
+ }
3994
+ }
3995
+
3996
+ function removeFromNotesDescriptionVisibleList(itemKey) {
3997
+ if (notesDescriptionVisibleList.hasOwnProperty(itemKey)) {
3998
+ delete notesDescriptionVisibleList[itemKey];
3999
+ }
4000
+ }
4001
+
4002
+ function clearNotesDesriptionVisibleList() {
4003
+ notesDescriptionVisibleList = {};
4004
+ }
4005
+
4006
+ function isNoteDescriptionVisible(itemKey) {
4007
+ return notesDescriptionVisibleList.hasOwnProperty(itemKey);
4008
+ }
4009
+
4010
+ function showNotesDescription() {
4011
+ if (annotations?.annotations) {
4012
+ $.each(annotations.annotations, function () {
4013
+ addToNotesDescriptionVisibleList(this.id);
4014
+ this.occludable = false;
4015
+ this.setLabelShown(true);
4016
+ });
4017
+ }
4018
+ }
3905
4019
  //------------------------------------------------------------------------------------------------------------------
3906
4020
  // Do action wherever we click on an object
3907
4021
  //------------------------------------------------------------------------------------------------------------------
@@ -3983,6 +4097,7 @@ function init() {
3983
4097
  bindBtnClearSectionPlan();
3984
4098
  bindBtnToggleSectionPlan();
3985
4099
  bindToggleNotes();
4100
+ bindToggleNotesDescription();
3986
4101
 
3987
4102
  bindBtnCreateAngleMeasurements();
3988
4103
  bindBtnToggleAngleMeasurements();
@@ -1,17 +1,17 @@
1
- import * as three from '/resource/dxfViewer/js/three/three.module.js?version=1.1.169';
2
- import { Matrix3, Vector2 } from '/resource/dxfViewer/js/three/three.module.js?version=1.1.169';
3
- import { Batch, DxfViewer, Layer } from '/resource/dxfViewer/js/viewer/DxfViewer.js?version=1.1.169';
4
- import { Block as SceneBlock } from '/resource/dxfViewer/js/viewer/DxfScene.js?version=1.1.169';
5
- import { Block } from '/resource/dxfViewer/js/viewer/DxfViewer.js?version=1.1.169';
6
- import { DxfScene, Entity, ColorCode } from '/resource/dxfViewer/js/viewer/DxfScene.js?version=1.1.169';
7
- import { TextRenderer, ParseSpecialChars, HAlign, VAlign } from '/resource/dxfViewer/js/viewer/TextRenderer.js?version=1.1.169';
8
- import { DxfWorker } from '/resource/dxfViewer/js/viewer/DxfWorker.js?version=1.1.169';
9
- import { DxfFetcher } from '/resource/dxfViewer/js/viewer/DxfFetcher.js?version=1.1.169';
10
- import DxfParser from '/resource/dxfViewer/js/viewer/parser/DxfParser.js?version=1.1.169';
11
- import { RenderBatch } from '/resource/dxfViewer/js/viewer/DxfScene.js?version=1.1.169';
12
- import { DynamicBuffer, NativeType } from '/resource/dxfViewer/js/viewer/DynamicBuffer.js?version=1.1.169';
13
- import { OrbitControls } from '/resource/dxfViewer/js/viewer/OrbitControls.js?version=1.1.169';
14
- import { CSS2DRenderer, CSS2DObject } from '/resource/dxfViewer/js/three/three.module.js?version=1.1.169';
1
+ import * as three from '/resource/dxfViewer/js/three/three.module.js?version=1.1.171';
2
+ import { Matrix3, Vector2 } from '/resource/dxfViewer/js/three/three.module.js?version=1.1.171';
3
+ import { Batch, DxfViewer, Layer } from '/resource/dxfViewer/js/viewer/DxfViewer.js?version=1.1.171';
4
+ import { Block as SceneBlock } from '/resource/dxfViewer/js/viewer/DxfScene.js?version=1.1.171';
5
+ import { Block } from '/resource/dxfViewer/js/viewer/DxfViewer.js?version=1.1.171';
6
+ import { DxfScene, Entity, ColorCode } from '/resource/dxfViewer/js/viewer/DxfScene.js?version=1.1.171';
7
+ import { TextRenderer, ParseSpecialChars, HAlign, VAlign } from '/resource/dxfViewer/js/viewer/TextRenderer.js?version=1.1.171';
8
+ import { DxfWorker } from '/resource/dxfViewer/js/viewer/DxfWorker.js?version=1.1.171';
9
+ import { DxfFetcher } from '/resource/dxfViewer/js/viewer/DxfFetcher.js?version=1.1.171';
10
+ import DxfParser from '/resource/dxfViewer/js/viewer/parser/DxfParser.js?version=1.1.171';
11
+ import { RenderBatch } from '/resource/dxfViewer/js/viewer/DxfScene.js?version=1.1.171';
12
+ import { DynamicBuffer, NativeType } from '/resource/dxfViewer/js/viewer/DynamicBuffer.js?version=1.1.171';
13
+ import { OrbitControls } from '/resource/dxfViewer/js/viewer/OrbitControls.js?version=1.1.171';
14
+ import { CSS2DRenderer, CSS2DObject } from '/resource/dxfViewer/js/three/three.module.js?version=1.1.171';
15
15
 
16
16
  let treeViewData = [];
17
17
  let notes = [];
@@ -1154,7 +1154,7 @@ export class VitroDxfWorker extends DxfWorker {
1154
1154
  } else {
1155
1155
  fontFetchers = []
1156
1156
  }
1157
- const dxf = await new DxfFetcher(url).Fetch(progressCbk)
1157
+ const dxf = await new VitroDxfFetcher(url).Fetch(progressCbk)
1158
1158
  if (progressCbk) {
1159
1159
  progressCbk("prepare", 0, null)
1160
1160
  }
@@ -2287,6 +2287,79 @@ export class VitroDxfFetcher extends DxfFetcher {
2287
2287
  const txt = await response.json()
2288
2288
  return txt
2289
2289
  }
2290
+
2291
+ _getFileName(response) {
2292
+ const contentDisposition = response.headers.get('Content-Disposition');
2293
+ if (contentDisposition) {
2294
+ const matches = contentDisposition.match(/filename\*=UTF-8''([^;]+)/);
2295
+ if (matches && matches[1]) {
2296
+ return decodeURIComponent(matches[1]);
2297
+ }
2298
+ }
2299
+
2300
+ return "";
2301
+ }
2302
+
2303
+ /** @param progressCbk {Function} (phase, receivedSize, totalSize) */
2304
+ async Fetch(progressCbk = null) {
2305
+ const response = await fetch(this.url)
2306
+ const fileName = this._getFileName(response)
2307
+ const totalSize = +response.headers.get('Content-Length')
2308
+
2309
+ const reader = response.body.getReader()
2310
+ let receivedSize = 0
2311
+ //XXX streaming parsing is not supported in dxf-parser for now (its parseStream() method
2312
+ // just accumulates chunks in a string buffer before parsing. Fix it later.
2313
+ let buffer = new Uint8Array(totalSize);
2314
+
2315
+ while (true) {
2316
+ const { done, value } = await reader.read();
2317
+ if (done) {
2318
+ break;
2319
+ }
2320
+
2321
+ buffer.set(value, receivedSize);
2322
+ receivedSize += value.length;
2323
+
2324
+ if (progressCbk !== null) {
2325
+ progressCbk("fetch", receivedSize, totalSize)
2326
+ }
2327
+ }
2328
+
2329
+ if (fileName.endsWith(".zdxf")) {
2330
+ return await this._processZip(buffer, progressCbk);
2331
+ }
2332
+
2333
+ return this._decodeAndParse(buffer, progressCbk);
2334
+ }
2335
+
2336
+ _decodeAndParse(buffer, progressCbk) {
2337
+ const decoder = new TextDecoder('utf-8');
2338
+ const parser = new DxfParser();
2339
+
2340
+ if (progressCbk !== null) {
2341
+ progressCbk("parse", 0, null)
2342
+ }
2343
+
2344
+ return parser.parseSync(decoder.decode(buffer));
2345
+ }
2346
+
2347
+ async _processZip(zipBuffer, progressCbk) {
2348
+ const zip = await JSZip.loadAsync(zipBuffer);
2349
+ const dxfFile = Object.keys(zip.files).find((file) => file.endsWith(".dxf"));
2350
+
2351
+ if (!dxfFile) {
2352
+ throw new Error("DXF-file not found.");
2353
+ }
2354
+
2355
+ if (progressCbk !== null) {
2356
+ progressCbk("extract", 0, null);
2357
+ }
2358
+ const fileData = await zip.file(dxfFile).async("uint8array");
2359
+
2360
+ return this._decodeAndParse(fileData, progressCbk);
2361
+ }
2362
+
2290
2363
  }
2291
2364
  const INDEXED_CHUNK_SIZE = 0x10000
2292
2365
 
@@ -21208,7 +21208,7 @@ const defaultOptions = {
21208
21208
  kind: OptionKind.WORKER
21209
21209
  },
21210
21210
  workerSrc: {
21211
- value: "resource/pdfViewer/js/pdf.worker.js?version=1.1.169",
21211
+ value: "resource/pdfViewer/js/pdf.worker.js?version=1.1.171",
21212
21212
  kind: OptionKind.WORKER
21213
21213
  }
21214
21214
  };