@dtducas/wh-forge-viewer 1.0.3 → 1.0.5
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/index.d.ts +89 -0
- package/dist/index.esm.js +333 -29
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +333 -29
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
package/dist/index.js
CHANGED
|
@@ -194,6 +194,7 @@ function registerToolbarExtension(Autodesk) {
|
|
|
194
194
|
this.paginationGroup = null;
|
|
195
195
|
this.viewables = [];
|
|
196
196
|
this.currentIndex = 0;
|
|
197
|
+
this.docBrowserShouldBeOpen = false; // Track if doc browser should remain open
|
|
197
198
|
}
|
|
198
199
|
ToolbarExtension.prototype = Object.create(Autodesk.Viewing.Extension.prototype);
|
|
199
200
|
ToolbarExtension.prototype.constructor = ToolbarExtension;
|
|
@@ -220,6 +221,10 @@ function registerToolbarExtension(Autodesk) {
|
|
|
220
221
|
var _this = this;
|
|
221
222
|
this.viewables = viewables;
|
|
222
223
|
this.currentIndex = 0;
|
|
224
|
+
// If multiple pages, document browser will be auto-opened
|
|
225
|
+
if (viewables.length > 1) {
|
|
226
|
+
this.docBrowserShouldBeOpen = true;
|
|
227
|
+
}
|
|
223
228
|
this.updatePaginationState();
|
|
224
229
|
this.viewer.addEventListener(Autodesk.Viewing.MODEL_ADDED_EVENT, function (e) {
|
|
225
230
|
_this.updateCurrentIndexFromModel();
|
|
@@ -242,6 +247,23 @@ function registerToolbarExtension(Autodesk) {
|
|
|
242
247
|
};
|
|
243
248
|
ToolbarExtension.prototype.updatePaginationState = function () {
|
|
244
249
|
if (!this.paginationGroup) return;
|
|
250
|
+
|
|
251
|
+
// Hide pagination group if there's only 1 page or no pages
|
|
252
|
+
if (this.viewables.length <= 1) {
|
|
253
|
+
this.paginationGroup.setVisible(false);
|
|
254
|
+
// Also hide the container via CSS to ensure it's completely hidden
|
|
255
|
+
if (this.paginationGroup.container) {
|
|
256
|
+
this.paginationGroup.container.style.display = 'none';
|
|
257
|
+
}
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// Show pagination group for multi-page documents
|
|
262
|
+
this.paginationGroup.setVisible(true);
|
|
263
|
+
// Ensure container is visible
|
|
264
|
+
if (this.paginationGroup.container) {
|
|
265
|
+
this.paginationGroup.container.style.display = '';
|
|
266
|
+
}
|
|
245
267
|
var totalBtn = this.paginationGroup.getControl('total-page-label');
|
|
246
268
|
if (totalBtn) {
|
|
247
269
|
var current = this.viewables.length > 0 ? this.currentIndex + 1 : 0;
|
|
@@ -258,6 +280,26 @@ function registerToolbarExtension(Autodesk) {
|
|
|
258
280
|
if (this.viewables.length > 0 && this.viewables[this.currentIndex]) {
|
|
259
281
|
var viewer = this.viewer;
|
|
260
282
|
var toolbar = viewer.toolbar;
|
|
283
|
+
var self = this;
|
|
284
|
+
|
|
285
|
+
// Store Document Browser panel state before loading new page
|
|
286
|
+
var docBrowserExt = viewer.getExtension('Autodesk.DocumentBrowser');
|
|
287
|
+
var isCurrentlyOpen = docBrowserExt && docBrowserExt.ui && docBrowserExt.ui.panel && docBrowserExt.ui.panel.isVisible();
|
|
288
|
+
|
|
289
|
+
// Update flag - if currently open or flag is already set, keep it open
|
|
290
|
+
if (isCurrentlyOpen) {
|
|
291
|
+
this.docBrowserShouldBeOpen = true;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// Add one-time listener for geometry loaded to restore states
|
|
295
|
+
var _onGeometryLoaded = function onGeometryLoaded() {
|
|
296
|
+
viewer.removeEventListener(Autodesk.Viewing.GEOMETRY_LOADED_EVENT, _onGeometryLoaded);
|
|
297
|
+
// Restore after geometry is fully loaded
|
|
298
|
+
setTimeout(function () {
|
|
299
|
+
self.restoreButtonStates(self.docBrowserShouldBeOpen);
|
|
300
|
+
}, 200);
|
|
301
|
+
};
|
|
302
|
+
viewer.addEventListener(Autodesk.Viewing.GEOMETRY_LOADED_EVENT, _onGeometryLoaded);
|
|
261
303
|
viewer.loadDocumentNode(viewer.model.getDocumentNode().getDocument(), this.viewables[this.currentIndex]).then(function () {
|
|
262
304
|
var defaultGroups = ['settingsTools', 'modelTools', 'navTools'];
|
|
263
305
|
defaultGroups.forEach(function (id) {
|
|
@@ -276,11 +318,170 @@ function registerToolbarExtension(Autodesk) {
|
|
|
276
318
|
if (_this2.paginationGroup) _this2.paginationGroup.setVisible(true);
|
|
277
319
|
toolbar.setVisible(true);
|
|
278
320
|
_this2.updatePaginationState();
|
|
321
|
+
|
|
322
|
+
// Also restore immediately (may work for cached pages)
|
|
323
|
+
_this2.restoreButtonStates(_this2.docBrowserShouldBeOpen);
|
|
279
324
|
})["catch"](function (err) {
|
|
280
325
|
return console.error('Error loading viewable:', err);
|
|
281
326
|
});
|
|
282
327
|
}
|
|
283
328
|
};
|
|
329
|
+
ToolbarExtension.prototype.restoreButtonStates = function (shouldOpenDocBrowser) {
|
|
330
|
+
var viewer = this.viewer;
|
|
331
|
+
var toolbar = viewer.toolbar;
|
|
332
|
+
if (!toolbar) return;
|
|
333
|
+
var self = this;
|
|
334
|
+
|
|
335
|
+
// Restore Document Browser state
|
|
336
|
+
var openDocBrowser = /*#__PURE__*/function () {
|
|
337
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
338
|
+
var docBrowserExt, _t;
|
|
339
|
+
return _regenerator().w(function (_context) {
|
|
340
|
+
while (1) switch (_context.p = _context.n) {
|
|
341
|
+
case 0:
|
|
342
|
+
if (shouldOpenDocBrowser) {
|
|
343
|
+
_context.n = 1;
|
|
344
|
+
break;
|
|
345
|
+
}
|
|
346
|
+
return _context.a(2);
|
|
347
|
+
case 1:
|
|
348
|
+
docBrowserExt = viewer.getExtension('Autodesk.DocumentBrowser'); // If extension is null, it was unloaded - we need to reload it
|
|
349
|
+
if (docBrowserExt) {
|
|
350
|
+
_context.n = 5;
|
|
351
|
+
break;
|
|
352
|
+
}
|
|
353
|
+
_context.p = 2;
|
|
354
|
+
_context.n = 3;
|
|
355
|
+
return viewer.loadExtension('Autodesk.DocumentBrowser');
|
|
356
|
+
case 3:
|
|
357
|
+
docBrowserExt = _context.v;
|
|
358
|
+
// After loading, we need to wait for the extension to fully initialize
|
|
359
|
+
// and then open the panel
|
|
360
|
+
setTimeout(function () {
|
|
361
|
+
if (docBrowserExt && docBrowserExt.ui) {
|
|
362
|
+
docBrowserExt.ui.togglePanel();
|
|
363
|
+
setTimeout(function () {
|
|
364
|
+
self.applyDocBrowserStyling();
|
|
365
|
+
self.checkButtonState();
|
|
366
|
+
}, 150);
|
|
367
|
+
}
|
|
368
|
+
}, 200);
|
|
369
|
+
return _context.a(2);
|
|
370
|
+
case 4:
|
|
371
|
+
_context.p = 4;
|
|
372
|
+
_t = _context.v;
|
|
373
|
+
console.error('[ToolbarExt] Failed to reload DocumentBrowser:', _t);
|
|
374
|
+
return _context.a(2);
|
|
375
|
+
case 5:
|
|
376
|
+
if (docBrowserExt.ui) {
|
|
377
|
+
_context.n = 6;
|
|
378
|
+
break;
|
|
379
|
+
}
|
|
380
|
+
return _context.a(2);
|
|
381
|
+
case 6:
|
|
382
|
+
if (!docBrowserExt.ui.panel) {
|
|
383
|
+
_context.n = 8;
|
|
384
|
+
break;
|
|
385
|
+
}
|
|
386
|
+
if (!docBrowserExt.ui.panel.isVisible()) {
|
|
387
|
+
_context.n = 7;
|
|
388
|
+
break;
|
|
389
|
+
}
|
|
390
|
+
self.applyDocBrowserStyling();
|
|
391
|
+
self.checkButtonState();
|
|
392
|
+
return _context.a(2);
|
|
393
|
+
case 7:
|
|
394
|
+
// Use setVisible(true) directly on the panel
|
|
395
|
+
docBrowserExt.ui.panel.setVisible(true);
|
|
396
|
+
setTimeout(function () {
|
|
397
|
+
self.applyDocBrowserStyling();
|
|
398
|
+
self.checkButtonState();
|
|
399
|
+
}, 100);
|
|
400
|
+
return _context.a(2);
|
|
401
|
+
case 8:
|
|
402
|
+
// If panel doesn't exist yet, use togglePanel to create it
|
|
403
|
+
if (typeof docBrowserExt.ui.togglePanel === 'function') {
|
|
404
|
+
docBrowserExt.ui.togglePanel();
|
|
405
|
+
setTimeout(function () {
|
|
406
|
+
self.applyDocBrowserStyling();
|
|
407
|
+
self.checkButtonState();
|
|
408
|
+
}, 150);
|
|
409
|
+
}
|
|
410
|
+
case 9:
|
|
411
|
+
return _context.a(2);
|
|
412
|
+
}
|
|
413
|
+
}, _callee, null, [[2, 4]]);
|
|
414
|
+
}));
|
|
415
|
+
return function openDocBrowser() {
|
|
416
|
+
return _ref.apply(this, arguments);
|
|
417
|
+
};
|
|
418
|
+
}();
|
|
419
|
+
|
|
420
|
+
// Restore Pan tool active state
|
|
421
|
+
var restorePanTool = function restorePanTool() {
|
|
422
|
+
self.activatePanTool();
|
|
423
|
+
};
|
|
424
|
+
|
|
425
|
+
// Call restore at multiple intervals to ensure it works
|
|
426
|
+
// Use longer delays since geometry needs to fully load
|
|
427
|
+
setTimeout(openDocBrowser, 300);
|
|
428
|
+
setTimeout(openDocBrowser, 600);
|
|
429
|
+
setTimeout(openDocBrowser, 1000);
|
|
430
|
+
setTimeout(restorePanTool, 100);
|
|
431
|
+
setTimeout(restorePanTool, 300);
|
|
432
|
+
};
|
|
433
|
+
ToolbarExtension.prototype.applyDocBrowserStyling = function () {
|
|
434
|
+
var viewer = this.viewer;
|
|
435
|
+
var ext = viewer.getExtension('Autodesk.DocumentBrowser');
|
|
436
|
+
if (ext && ext.ui && ext.ui.panel && ext.ui.panel.container) {
|
|
437
|
+
ext.ui.panel.container.style.top = '0';
|
|
438
|
+
ext.ui.panel.container.style.left = 'unset';
|
|
439
|
+
ext.ui.panel.container.style.right = '0px';
|
|
440
|
+
ext.ui.panel.container.style.width = '200px';
|
|
441
|
+
ext.ui.panel.container.style.height = '80%';
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
// Switch to Thumbnail tab
|
|
445
|
+
this.switchToThumbnailTab();
|
|
446
|
+
};
|
|
447
|
+
ToolbarExtension.prototype.switchToThumbnailTab = function () {
|
|
448
|
+
// Try multiple selectors to find the thumbnail tab button
|
|
449
|
+
var thumbnailTab = document.querySelector('.docking-panel-thumbnail-view') || document.querySelector('[data-i18n="Thumbnails"]') || Array.from(document.querySelectorAll('.adsk-control-group .adsk-button')).find(function (btn) {
|
|
450
|
+
return btn.textContent.includes('Thumbnails') || btn.title.includes('Thumbnails');
|
|
451
|
+
});
|
|
452
|
+
if (thumbnailTab && !thumbnailTab.classList.contains('active')) {
|
|
453
|
+
thumbnailTab.click();
|
|
454
|
+
}
|
|
455
|
+
};
|
|
456
|
+
ToolbarExtension.prototype.activatePanTool = function () {
|
|
457
|
+
var viewer = this.viewer;
|
|
458
|
+
var toolbar = viewer.toolbar;
|
|
459
|
+
if (!toolbar) return;
|
|
460
|
+
|
|
461
|
+
// Activate pan tool using viewer API
|
|
462
|
+
try {
|
|
463
|
+
viewer.setActiveNavigationTool('pan');
|
|
464
|
+
} catch (e) {
|
|
465
|
+
// Fallback: click the original pan button
|
|
466
|
+
var originalPanBtn = document.getElementById('toolbar-panTool');
|
|
467
|
+
if (originalPanBtn) {
|
|
468
|
+
originalPanBtn.click();
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
// Update custom pan button visual state
|
|
473
|
+
var toolGroup = toolbar.getControl('custom-tool-group');
|
|
474
|
+
if (toolGroup) {
|
|
475
|
+
var panBtn = toolGroup.getControl('custom-pan-btn');
|
|
476
|
+
if (panBtn) {
|
|
477
|
+
panBtn.setState(Autodesk.Viewing.UI.Button.State.ACTIVE);
|
|
478
|
+
if (panBtn.container) {
|
|
479
|
+
panBtn.container.classList.add('active');
|
|
480
|
+
panBtn.container.classList.remove('inactive');
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
};
|
|
284
485
|
ToolbarExtension.prototype.onToolbarCreated = function (toolbar) {
|
|
285
486
|
var _this3 = this;
|
|
286
487
|
this.refreshToolbar();
|
|
@@ -303,9 +504,53 @@ function registerToolbarExtension(Autodesk) {
|
|
|
303
504
|
if (!toolGroup || !pagGroup) {
|
|
304
505
|
_this3.refreshToolbar();
|
|
305
506
|
}
|
|
507
|
+
_this3.checkButtonState();
|
|
306
508
|
}
|
|
307
509
|
}, 200);
|
|
308
510
|
};
|
|
511
|
+
ToolbarExtension.prototype.checkButtonState = function () {
|
|
512
|
+
var viewer = this.viewer;
|
|
513
|
+
if (!viewer.toolbar) return;
|
|
514
|
+
var toolGroup = viewer.toolbar.getControl('custom-tool-group');
|
|
515
|
+
if (!toolGroup) return;
|
|
516
|
+
|
|
517
|
+
// Check Document Browser button state
|
|
518
|
+
var docBtn = toolGroup.getControl('custom-doc-browser-btn');
|
|
519
|
+
if (docBtn) {
|
|
520
|
+
var ext = viewer.getExtension('Autodesk.DocumentBrowser');
|
|
521
|
+
var isVisible = ext && ext.ui && ext.ui.panel && ext.ui.panel.isVisible();
|
|
522
|
+
var newState = isVisible ? Autodesk.Viewing.UI.Button.State.ACTIVE : Autodesk.Viewing.UI.Button.State.INACTIVE;
|
|
523
|
+
if (docBtn.getState() !== newState) {
|
|
524
|
+
docBtn.setState(newState);
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
// Force CSS class update to ensure visual state is correct
|
|
528
|
+
if (docBtn.container) {
|
|
529
|
+
if (isVisible) {
|
|
530
|
+
docBtn.container.classList.add('active');
|
|
531
|
+
docBtn.container.classList.remove('inactive');
|
|
532
|
+
} else {
|
|
533
|
+
docBtn.container.classList.remove('active');
|
|
534
|
+
docBtn.container.classList.add('inactive');
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
// Check Pan button state - ensure it stays active
|
|
540
|
+
var panBtn = toolGroup.getControl('custom-pan-btn');
|
|
541
|
+
if (panBtn) {
|
|
542
|
+
// Check if pan tool is the active tool
|
|
543
|
+
var activeTool = viewer.getActiveNavigationTool();
|
|
544
|
+
var isPanActive = activeTool === 'pan';
|
|
545
|
+
if (isPanActive) {
|
|
546
|
+
panBtn.setState(Autodesk.Viewing.UI.Button.State.ACTIVE);
|
|
547
|
+
if (panBtn.container) {
|
|
548
|
+
panBtn.container.classList.add('active');
|
|
549
|
+
panBtn.container.classList.remove('inactive');
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
};
|
|
309
554
|
var originalUnload = ToolbarExtension.prototype.unload;
|
|
310
555
|
ToolbarExtension.prototype.unload = function () {
|
|
311
556
|
if (this._toolbarInterval) {
|
|
@@ -345,7 +590,7 @@ function registerToolbarExtension(Autodesk) {
|
|
|
345
590
|
}
|
|
346
591
|
this.createPaginationGroup(toolbar);
|
|
347
592
|
} else {
|
|
348
|
-
|
|
593
|
+
// Don't force visibility here - let updatePaginationState handle it
|
|
349
594
|
this.paginationGroup = pagGroup;
|
|
350
595
|
}
|
|
351
596
|
toolbar.setVisible(true);
|
|
@@ -360,45 +605,62 @@ function registerToolbarExtension(Autodesk) {
|
|
|
360
605
|
panBtn.setIcon('adsk-icon-pan');
|
|
361
606
|
panBtn.setToolTip('Pan');
|
|
362
607
|
panBtn.onClick = function () {
|
|
363
|
-
|
|
608
|
+
var originalPanBtn = document.getElementById('toolbar-panTool');
|
|
609
|
+
if (originalPanBtn) {
|
|
610
|
+
originalPanBtn.click();
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
// Set this button to active state
|
|
614
|
+
if (panBtn.container) {
|
|
615
|
+
panBtn.container.classList.add('active');
|
|
616
|
+
panBtn.container.classList.remove('inactive');
|
|
617
|
+
}
|
|
618
|
+
panBtn.setState(Autodesk.Viewing.UI.Button.State.ACTIVE);
|
|
364
619
|
};
|
|
365
620
|
this.subToolbar.addControl(panBtn);
|
|
366
621
|
var docBrowserBtn = new Autodesk.Viewing.UI.Button('custom-doc-browser-btn');
|
|
367
622
|
docBrowserBtn.setIcon('adsk-icon-documentModels');
|
|
368
623
|
docBrowserBtn.setToolTip('Document Browser');
|
|
624
|
+
var self = this;
|
|
369
625
|
docBrowserBtn.onClick = function () {
|
|
370
626
|
var ext = viewer.getExtension('Autodesk.DocumentBrowser');
|
|
371
|
-
if (ext && ext.ui)
|
|
627
|
+
if (ext && ext.ui) {
|
|
628
|
+
ext.ui.togglePanel();
|
|
629
|
+
// Update flag based on new state
|
|
630
|
+
setTimeout(function () {
|
|
631
|
+
self.docBrowserShouldBeOpen = ext.ui.panel && ext.ui.panel.isVisible();
|
|
632
|
+
}, 50);
|
|
633
|
+
}
|
|
372
634
|
};
|
|
373
635
|
this.subToolbar.addControl(docBrowserBtn);
|
|
374
636
|
var downloadBtn = new Autodesk.Viewing.UI.Button('custom-download-btn');
|
|
375
637
|
downloadBtn.setIcon('adsk-icon-custom-download');
|
|
376
638
|
downloadBtn.setToolTip('Download File');
|
|
377
|
-
downloadBtn.onClick = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
378
|
-
var fileUrl, response, blob, urlPath, filename, blobUrl, anchor,
|
|
379
|
-
return _regenerator().w(function (
|
|
380
|
-
while (1) switch (
|
|
639
|
+
downloadBtn.onClick = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
640
|
+
var fileUrl, response, blob, urlPath, filename, blobUrl, anchor, _t2;
|
|
641
|
+
return _regenerator().w(function (_context2) {
|
|
642
|
+
while (1) switch (_context2.p = _context2.n) {
|
|
381
643
|
case 0:
|
|
382
644
|
if (!(_this4.options && _this4.options.filePath)) {
|
|
383
|
-
|
|
645
|
+
_context2.n = 7;
|
|
384
646
|
break;
|
|
385
647
|
}
|
|
386
|
-
|
|
648
|
+
_context2.p = 1;
|
|
387
649
|
fileUrl = _this4.options.filePath;
|
|
388
|
-
|
|
650
|
+
_context2.n = 2;
|
|
389
651
|
return fetch(fileUrl);
|
|
390
652
|
case 2:
|
|
391
|
-
response =
|
|
653
|
+
response = _context2.v;
|
|
392
654
|
if (response.ok) {
|
|
393
|
-
|
|
655
|
+
_context2.n = 3;
|
|
394
656
|
break;
|
|
395
657
|
}
|
|
396
658
|
throw new Error("HTTP error! status: ".concat(response.status));
|
|
397
659
|
case 3:
|
|
398
|
-
|
|
660
|
+
_context2.n = 4;
|
|
399
661
|
return response.blob();
|
|
400
662
|
case 4:
|
|
401
|
-
blob =
|
|
663
|
+
blob = _context2.v;
|
|
402
664
|
urlPath = new URL(fileUrl).pathname;
|
|
403
665
|
filename = decodeURIComponent(urlPath.split('/').pop()) || 'document.pdf';
|
|
404
666
|
blobUrl = URL.createObjectURL(blob);
|
|
@@ -410,23 +672,23 @@ function registerToolbarExtension(Autodesk) {
|
|
|
410
672
|
anchor.click();
|
|
411
673
|
document.body.removeChild(anchor);
|
|
412
674
|
URL.revokeObjectURL(blobUrl);
|
|
413
|
-
|
|
675
|
+
_context2.n = 6;
|
|
414
676
|
break;
|
|
415
677
|
case 5:
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
console.error('Download error:',
|
|
419
|
-
alert('Unable to download file: ' +
|
|
678
|
+
_context2.p = 5;
|
|
679
|
+
_t2 = _context2.v;
|
|
680
|
+
console.error('Download error:', _t2);
|
|
681
|
+
alert('Unable to download file: ' + _t2.message);
|
|
420
682
|
case 6:
|
|
421
|
-
|
|
683
|
+
_context2.n = 8;
|
|
422
684
|
break;
|
|
423
685
|
case 7:
|
|
424
686
|
console.warn('FilePath not available in extension options');
|
|
425
687
|
alert('File path not available for download');
|
|
426
688
|
case 8:
|
|
427
|
-
return
|
|
689
|
+
return _context2.a(2);
|
|
428
690
|
}
|
|
429
|
-
},
|
|
691
|
+
}, _callee2, null, [[1, 5]]);
|
|
430
692
|
}));
|
|
431
693
|
this.subToolbar.addControl(downloadBtn);
|
|
432
694
|
};
|
|
@@ -552,7 +814,7 @@ function styleInject(css, ref) {
|
|
|
552
814
|
}
|
|
553
815
|
}
|
|
554
816
|
|
|
555
|
-
var css_248z$1 = "#navTools,\n#modelTools,\n#settingsTools,\n#measureTools {\n display: none !important;\n visibility: hidden !important;\n}\n#guiviewer3d-toolbar {\n display: flex !important;\n align-items: center !important;\n justify-content: center !important;\n gap: 20px;\n position: fixed !important;\n bottom: 10px !important;\n left: 50% !important;\n transform: translateX(-50%) !important;\n width: auto !important;\n border-radius: 4px !important;\n padding: 8px 12px !important;\n}\n#custom-tool-group {\n display: flex !important;\n margin: 0 !important;\n padding: 0 !important;\n}\n#custom-pagination-group {\n display: flex
|
|
817
|
+
var css_248z$1 = "#navTools,\n#modelTools,\n#settingsTools,\n#measureTools {\n display: none !important;\n visibility: hidden !important;\n}\n#guiviewer3d-toolbar {\n display: flex !important;\n align-items: center !important;\n justify-content: center !important;\n gap: 20px;\n position: fixed !important;\n bottom: 10px !important;\n left: 50% !important;\n transform: translateX(-50%) !important;\n width: auto !important;\n border-radius: 4px !important;\n padding: 8px 12px !important;\n}\n#custom-tool-group {\n display: flex !important;\n margin: 0 !important;\n padding: 0 !important;\n}\n#custom-pagination-group {\n display: flex;\n position: relative !important;\n margin: 0 !important;\n padding: 0 !important;\n transform: none !important;\n left: auto !important;\n}\n\n/* Document Browser Panel Styling */\n.docking-panel.document-browser-panel,\n.adsk-viewing-viewer .docking-panel.document-browser-panel {\n min-height: 400px !important;\n height: 80% !important;\n max-height: 80vh !important;\n}\n\n/* Ensure thumbnail container has proper height */\n.docking-panel.document-browser-panel .docking-panel-container-solid-color-a,\n.document-browser-panel .treeview,\n.document-browser-panel .thumbnails-container {\n height: calc(100% - 50px) !important;\n min-height: 350px !important;\n overflow-y: auto !important;\n}\n\n/* Thumbnail cards styling */\n.document-browser-panel .thumbnail-item,\n.document-browser-panel .thumbnail {\n display: flex !important;\n visibility: visible !important;\n}\n\n/* Ensure thumbnail images are visible */\n.document-browser-panel .thumbnail img,\n.document-browser-panel .thumbnail-item img {\n display: block !important;\n visibility: visible !important;\n max-width: 100% !important;\n height: auto !important;\n}\n";
|
|
556
818
|
styleInject(css_248z$1);
|
|
557
819
|
|
|
558
820
|
var css_248z = "/* Custom icon styles for toolbar using SVG */\n\n/* Download icon - custom SVG */\n.adsk-icon-custom-download::before {\n content: '';\n display: inline-block;\n width: 24px;\n height: 24px;\n background-image: url('data:image/svg+xml;utf8,\\\n<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\\\n<path fill=\"%23FFFFFF\" d=\"M9.293 0H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4.707A1 1 0 0 0 13.707 4L10 .293A1 1 0 0 0 9.293 0M9.5 3.5v-2l3 3h-2a1 1 0 0 1-1-1m-1 4v3.793l1.146-1.147a.5.5 0 0 1 .708.708l-2 2a.5.5 0 0 1-.708 0l-2-2a.5.5 0 0 1 .708-.708L7.5 11.293V7.5a.5.5 0 0 1 1 0\"/>\\\n</svg>');\n background-repeat: no-repeat;\n background-position: center;\n background-size: 16px 16px;\n}\n\n/* Previous page icon - Font Awesome chevron left */\n.adsk-icon-custom-prev::before {\n content: '';\n display: inline-block;\n width: 24px;\n height: 24px;\n background-image: url('data:image/svg+xml;utf8,\\\n<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\\\n<path fill=\"%23FFFFFF\" d=\"M16 14a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2zm-4.5-6.5H5.707l2.147-2.146a.5.5 0 1 0-.708-.708l-3 3a.5.5 0 0 0 0 .708l3 3a.5.5 0 0 0 .708-.708L5.707 8.5H11.5a.5.5 0 0 0 0-1\"/>\\\n</svg>');\n background-repeat: no-repeat;\n background-position: center;\n background-size: 16px 16px;\n}\n\n/* Next page icon - Font Awesome chevron right */\n.adsk-icon-custom-next::before {\n content: '';\n display: inline-block;\n width: 24px;\n height: 24px;\n background-image: url('data:image/svg+xml;utf8,\\\n<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\\\n<path fill=\"%23FFFFFF\" d=\"M0 14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2a2 2 0 0 0-2 2zm4.5-6.5h5.793L8.146 5.354a.5.5 0 1 1 .708-.708l3 3a.5.5 0 0 1 0 .708l-3 3a.5.5 0 0 1-.708-.708L10.293 8.5H4.5a.5.5 0 0 1 0-1\"/>\\\n</svg>');\n background-repeat: no-repeat;\n background-position: center;\n background-size: 16px 16px;\n}\n\n/* Fallback for adsk-icon-caret-left and adsk-icon-caret-right if not defined */\n.adsk-icon-caret-left::before {\n content: '[';\n font-family: 'adsk-viewing';\n}\n\n.adsk-icon-caret-right::before {\n content: ']';\n font-family: 'adsk-viewing';\n}\n\n/* Comment icon - custom SVG (Smiley) */\n.adsk-icon-custom-comment::before {\n content: '';\n display: inline-block;\n width: 24px;\n height: 24px;\n background-image: url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"%23FFFFFF\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\"></circle><path d=\"M8 14s1.5 2 4 2 4-2 4-2\"></path><line x1=\"9\" y1=\"9\" x2=\"9.01\" y2=\"9\"></line><line x1=\"15\" y1=\"9\" x2=\"15.01\" y2=\"9\"></line></svg>');\n background-repeat: no-repeat;\n background-position: center;\n background-size: contain;\n}\n\n/* Save icon - custom SVG */\n.adsk-icon-custom-save::before {\n content: '';\n display: inline-block;\n width: 24px;\n height: 24px;\n background-image: url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"%23FFFFFF\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z\"></path><polyline points=\"17 21 17 13 7 13 7 21\"></polyline><polyline points=\"7 3 7 8 15 8\"></polyline></svg>');\n background-repeat: no-repeat;\n background-position: center;\n background-size: contain;\n}\n";
|
|
@@ -625,16 +887,57 @@ var ViewerForgePDF = function ViewerForgePDF(_ref) {
|
|
|
625
887
|
viewer.toolbar.setVisible(true);
|
|
626
888
|
}
|
|
627
889
|
if (viewables.length > 1) {
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
890
|
+
// Auto-open Document Browser by clicking the original button
|
|
891
|
+
setTimeout(function () {
|
|
892
|
+
var originalDocBtn = document.getElementById('toolbar-documentModels');
|
|
893
|
+
if (originalDocBtn && !originalDocBtn.classList.contains('active')) {
|
|
894
|
+
originalDocBtn.click();
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
// Apply custom styling to the panel
|
|
898
|
+
var documentBrowser = viewer.getExtension('Autodesk.DocumentBrowser');
|
|
899
|
+
if (documentBrowser && documentBrowser.ui && documentBrowser.ui.panel) {
|
|
900
|
+
documentBrowser.ui.panel.container.style.top = '0';
|
|
632
901
|
documentBrowser.ui.panel.container.style.left = 'unset';
|
|
633
902
|
documentBrowser.ui.panel.container.style.right = '0px';
|
|
634
903
|
documentBrowser.ui.panel.container.style.width = '200px';
|
|
904
|
+
documentBrowser.ui.panel.container.style.height = '80%';
|
|
905
|
+
documentBrowser.ui.panel.container.style.minHeight = '400px';
|
|
635
906
|
}
|
|
636
|
-
|
|
907
|
+
|
|
908
|
+
// Switch to Thumbnail tab after a short delay
|
|
909
|
+
setTimeout(function () {
|
|
910
|
+
// Try multiple selectors to find the thumbnail tab button
|
|
911
|
+
var thumbnailTab = document.querySelector('.docking-panel-thumbnail-view') || document.querySelector('[data-i18n="Thumbnails"]') || Array.from(document.querySelectorAll('.adsk-control-group .adsk-button')).find(function (btn) {
|
|
912
|
+
return btn.textContent.includes('Thumbnails') || btn.title.includes('Thumbnails');
|
|
913
|
+
});
|
|
914
|
+
if (thumbnailTab && !thumbnailTab.classList.contains('active')) {
|
|
915
|
+
thumbnailTab.click();
|
|
916
|
+
}
|
|
917
|
+
}, 200);
|
|
918
|
+
}, 500);
|
|
637
919
|
}
|
|
920
|
+
|
|
921
|
+
// Ensure Custom Pan tool is active by default
|
|
922
|
+
setTimeout(function () {
|
|
923
|
+
var customPanBtn = document.getElementById('custom-pan-btn');
|
|
924
|
+
if (customPanBtn) {
|
|
925
|
+
customPanBtn.click();
|
|
926
|
+
// Double check visual state
|
|
927
|
+
if (!customPanBtn.classList.contains('active')) {
|
|
928
|
+
customPanBtn.classList.add('active');
|
|
929
|
+
customPanBtn.classList.remove('inactive');
|
|
930
|
+
}
|
|
931
|
+
} else {
|
|
932
|
+
var _viewer$toolbar;
|
|
933
|
+
// Fallback if custom button not found immediately, try accessing via viewer toolbar
|
|
934
|
+
var toolGroup = (_viewer$toolbar = viewer.toolbar) === null || _viewer$toolbar === void 0 ? void 0 : _viewer$toolbar.getControl('custom-tool-group');
|
|
935
|
+
var panBtnConf = toolGroup === null || toolGroup === void 0 ? void 0 : toolGroup.getControl('custom-pan-btn');
|
|
936
|
+
if (panBtnConf) {
|
|
937
|
+
panBtnConf.setState(1); // ACTIVE
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
}, 600);
|
|
638
941
|
if (setViewer) setViewer(viewer);
|
|
639
942
|
} catch (err) {
|
|
640
943
|
console.error('Error in handleLoadSuccess:', err);
|
|
@@ -661,7 +964,8 @@ var ViewerForgePDF = function ViewerForgePDF(_ref) {
|
|
|
661
964
|
}, _callee);
|
|
662
965
|
})));
|
|
663
966
|
}
|
|
664
|
-
|
|
967
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
968
|
+
}, [status, filePath, fileExt]);
|
|
665
969
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
666
970
|
style: {
|
|
667
971
|
position: 'relative',
|