@vertexvis/viewer 0.22.0-canary.0 → 0.22.0-canary.2
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/cjs/loader.cjs.js +1 -1
- package/dist/cjs/multiElementInteractionHandler-93bd9593.js +324 -0
- package/dist/cjs/multiElementInteractionHandler-93bd9593.js.map +1 -0
- package/dist/cjs/vertex-viewer-dom-element_2.cjs.entry.js +37 -0
- package/dist/cjs/vertex-viewer-dom-element_2.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer-pin-group.cjs.entry.js +3 -4
- package/dist/cjs/vertex-viewer-pin-group.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer-pin-label_2.cjs.entry.js +20 -11
- package/dist/cjs/vertex-viewer-pin-label_2.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer.cjs.entry.js +17 -294
- package/dist/cjs/vertex-viewer.cjs.entry.js.map +1 -1
- package/dist/cjs/viewer.cjs.js +1 -1
- package/dist/collection/components/viewer-dom-renderer/viewer-dom-renderer.js +56 -1
- package/dist/collection/components/viewer-dom-renderer/viewer-dom-renderer.js.map +1 -1
- package/dist/collection/components/viewer-pin-group/viewer-pin-group.js +3 -4
- package/dist/collection/components/viewer-pin-group/viewer-pin-group.js.map +1 -1
- package/dist/collection/components/viewer-pin-label/viewer-pin-label.js +39 -11
- package/dist/collection/components/viewer-pin-label/viewer-pin-label.js.map +1 -1
- package/dist/collection/lib/interactions/multiElementInteractionHandler.js +26 -0
- package/dist/collection/lib/interactions/multiElementInteractionHandler.js.map +1 -0
- package/dist/collection/lib/interactions/pointerInteractionHandler.js +16 -4
- package/dist/collection/lib/interactions/pointerInteractionHandler.js.map +1 -1
- package/dist/components/multiElementInteractionHandler.js +321 -0
- package/dist/components/multiElementInteractionHandler.js.map +1 -0
- package/dist/components/vertex-viewer.js +16 -293
- package/dist/components/vertex-viewer.js.map +1 -1
- package/dist/components/viewer-dom-renderer.js +39 -1
- package/dist/components/viewer-dom-renderer.js.map +1 -1
- package/dist/components/viewer-pin-group.js +3 -4
- package/dist/components/viewer-pin-group.js.map +1 -1
- package/dist/components/viewer-pin-label.js +22 -12
- package/dist/components/viewer-pin-label.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/loader.mjs +1 -1
- package/dist/esm/multiElementInteractionHandler-8b48d16e.js +321 -0
- package/dist/esm/multiElementInteractionHandler-8b48d16e.js.map +1 -0
- package/dist/esm/vertex-viewer-dom-element_2.entry.js +37 -0
- package/dist/esm/vertex-viewer-dom-element_2.entry.js.map +1 -1
- package/dist/esm/vertex-viewer-pin-group.entry.js +3 -4
- package/dist/esm/vertex-viewer-pin-group.entry.js.map +1 -1
- package/dist/esm/vertex-viewer-pin-label_2.entry.js +20 -11
- package/dist/esm/vertex-viewer-pin-label_2.entry.js.map +1 -1
- package/dist/esm/vertex-viewer.entry.js +16 -293
- package/dist/esm/vertex-viewer.entry.js.map +1 -1
- package/dist/esm/viewer.js +1 -1
- package/dist/types/components/viewer-dom-renderer/viewer-dom-renderer.d.ts +16 -0
- package/dist/types/components/viewer-pin-label/viewer-pin-label.d.ts +5 -1
- package/dist/types/components.d.ts +9 -0
- package/dist/types/lib/interactions/multiElementInteractionHandler.d.ts +9 -0
- package/dist/types/lib/interactions/pointerInteractionHandler.d.ts +6 -3
- package/dist/viewer/p-b47a271c.entry.js +5 -0
- package/dist/viewer/p-b47a271c.entry.js.map +1 -0
- package/dist/viewer/p-b8dfa0c1.entry.js +5 -0
- package/dist/viewer/p-b8dfa0c1.entry.js.map +1 -0
- package/dist/viewer/p-bcb95808.entry.js +5 -0
- package/dist/viewer/p-bcb95808.entry.js.map +1 -0
- package/dist/viewer/p-bf67f570.js +5 -0
- package/dist/viewer/p-bf67f570.js.map +1 -0
- package/dist/viewer/p-d438d446.entry.js +5 -0
- package/dist/viewer/p-d438d446.entry.js.map +1 -0
- package/dist/viewer/viewer.esm.js +1 -1
- package/dist/viewer/viewer.esm.js.map +1 -1
- package/package.json +7 -7
- package/dist/viewer/p-05a07e6a.entry.js +0 -5
- package/dist/viewer/p-05a07e6a.entry.js.map +0 -1
- package/dist/viewer/p-4c2659df.entry.js +0 -5
- package/dist/viewer/p-4c2659df.entry.js.map +0 -1
- package/dist/viewer/p-5da9f68d.entry.js +0 -5
- package/dist/viewer/p-5da9f68d.entry.js.map +0 -1
- package/dist/viewer/p-c5402beb.entry.js +0 -5
- package/dist/viewer/p-c5402beb.entry.js.map +0 -1
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -20,7 +20,7 @@ const defineCustomElements = (win, options) => {
|
|
|
20
20
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
21
21
|
return patchEsm().then(() => {
|
|
22
22
|
appGlobals.globalScripts();
|
|
23
|
-
return index.bootstrapLazy(JSON.parse("[[\"vertex-viewer-pin-tool.cjs\",[[1,\"vertex-viewer-pin-tool\",{\"pinController\":[1040],\"pinModel\":[16],\"viewer\":[16],\"tool\":[1025],\"mode\":[1025],\"primaryColor\":[1025,\"primary-color\"],\"accentColor\":[1025,\"accent-color\"],\"pins\":[32],\"selectedPinId\":[32],\"elementBounds\":[32],\"projectionViewMatrix\":[32]}]]],[\"vertex-scene-tree.cjs\",[[1,\"vertex-scene-tree\",{\"overScanCount\":[2,\"over-scan-count\"],\"viewerSelector\":[1,\"viewer-selector\"],\"viewer\":[1040],\"rowData\":[16],\"config\":[1],\"configEnv\":[1,\"config-env\"],\"controller\":[1040],\"searchOptions\":[1040],\"metadataSearchExactMatch\":[1028,\"metadata-search-exact-match\"],\"metadataSearchKeys\":[1040],\"metadataKeys\":[16],\"rows\":[32],\"totalRows\":[32],\"showLoader\":[32],\"showEmptyResults\":[32],\"stateMap\":[32],\"errorDetails\":[32],\"attemptingRetry\":[32],\"invalidateRows\":[64],\"scrollToIndex\":[64],\"scrollToItem\":[64],\"expandAll\":[64],\"collapseAll\":[64],\"expandItem\":[64],\"collapseItem\":[64],\"toggleExpandItem\":[64],\"toggleItemVisibility\":[64],\"hideItem\":[64],\"showItem\":[64],\"selectItem\":[64],\"deselectItem\":[64],\"getRowAtIndex\":[64],\"getRowForEvent\":[64],\"getRowAtClientY\":[64],\"filterItems\":[64],\"selectFilteredItems\":[64],\"fetchMetadataKeys\":[64]},[[0,\"search\",\"handleSearch\"],[0,\"cellLoaded\",\"handleCellLoaded\"]]]]],[\"vertex-viewer-default-toolbar.cjs\",[[1,\"vertex-viewer-default-toolbar\",{\"viewer\":[16],\"placement\":[1],\"direction\":[1],\"animationsDisabled\":[4,\"animations-disabled\"],\"animationMs\":[2,\"animation-ms\"]}]]],[\"vertex-viewer-markup.cjs\",[[1,\"vertex-viewer-markup\",{\"arrowTemplateId\":[1,\"arrow-template-id\"],\"circleTemplateId\":[1,\"circle-template-id\"],\"freeformTemplateId\":[1,\"freeform-template-id\"],\"tool\":[1],\"disabled\":[4],\"viewer\":[16],\"selectedMarkupId\":[1025,\"selected-markup-id\"],\"selectNew\":[4,\"select-new\"],\"startLineAnchorStyle\":[1025,\"start-line-anchor-style\"],\"endLineAnchorStyle\":[1025,\"end-line-anchor-style\"],\"toSelectMarkupId\":[32],\"pointerDownPosition\":[32],\"addMarkup\":[64],\"removeMarkup\":[64],\"getMarkupElements\":[64],\"getMarkupElement\":[64]},[[0,\"markupEnd\",\"handleMarkupEnd\"],[0,\"interactionEnd\",\"handleMarkupUpdated\"],[1,\"pointerdown\",\"handleMarkupPointerDown\"]]]]],[\"vertex-viewer-markup-tool.cjs\",[[1,\"vertex-viewer-markup-tool\",{\"arrowTemplateId\":[1,\"arrow-template-id\"],\"circleTemplateId\":[1,\"circle-template-id\"],\"freeformTemplateId\":[1,\"freeform-template-id\"],\"tool\":[1],\"disabled\":[4],\"viewer\":[16],\"startLineAnchorStyle\":[1025,\"start-line-anchor-style\"],\"endLineAnchorStyle\":[1025,\"end-line-anchor-style\"],\"stateMap\":[32],\"reset\":[64]}]]],[\"vertex-viewer-view-cube.cjs\",[[1,\"vertex-viewer-view-cube\",{\"xPositiveLabel\":[1,\"x-positive-label\"],\"xNegativeLabel\":[1,\"x-negative-label\"],\"yPositiveLabel\":[1,\"y-positive-label\"],\"yNegativeLabel\":[1,\"y-negative-label\"],\"zPositiveLabel\":[1,\"z-positive-label\"],\"zNegativeLabel\":[1,\"z-negative-label\"],\"standardViewsOff\":[4,\"standard-views-off\"],\"viewAll\":[4,\"view-all\"],\"animationDuration\":[2,\"animation-duration\"],\"triadOff\":[4,\"triad-off\"],\"worldOrientation\":[1040],\"camera\":[1040],\"viewer\":[16],\"boxLength\":[32],\"triadPosition\":[32]}]]],[\"vertex-viewer-measurement-distance.cjs\",[[1,\"vertex-viewer-measurement-distance\",{\"start\":[1040],\"startJson\":[1,\"start-json\"],\"end\":[1040],\"endJson\":[1,\"end-json\"],\"distance\":[1026],\"showAxisReferenceLines\":[4,\"show-axis-reference-lines\"],\"snapDistance\":[2,\"snap-distance\"],\"units\":[1],\"fractionalDigits\":[2,\"fractional-digits\"],\"labelFormatter\":[16],\"anchorLabelOffset\":[2,\"anchor-label-offset\"],\"lineCapLength\":[2,\"line-cap-length\"],\"mode\":[513],\"interactingAnchor\":[1537,\"interacting-anchor\"],\"invalid\":[1540],\"camera\":[16],\"hitProvider\":[16],\"indicatorPt\":[1040],\"viewer\":[16],\"measurementModel\":[16],\"viewport\":[32],\"elementBounds\":[32],\"interactionCount\":[32],\"internalCamera\":[32],\"invalidateStateCounter\":[32],\"stateMap\":[32],\"measurementUnits\":[32],\"computeElementMetrics\":[64]}]]],[\"vertex-viewer-measurement-precise.cjs\",[[1,\"vertex-viewer-measurement-precise\",{\"measurementModel\":[16],\"measurementOverlays\":[16],\"measurementController\":[1040],\"measurableEntityTypes\":[16],\"viewer\":[16],\"configEnv\":[1,\"config-env\"],\"config\":[1]}]]],[\"vertex-viewer-annotation-callout.cjs\",[[1,\"vertex-viewer-annotation-callout\",{\"data\":[16],\"iconSize\":[1,\"icon-size\"]}]]],[\"vertex-viewer-box-query-tool.cjs\",[[1,\"vertex-viewer-box-query-tool\",{\"viewer\":[16],\"controller\":[1040],\"model\":[1040],\"operationType\":[1,\"operation-type\"],\"mode\":[1],\"details\":[32]}]]],[\"vertex-viewer-walk-mode-tool.cjs\",[[1,\"vertex-viewer-walk-mode-tool\",{\"viewer\":[16],\"controller\":[1040],\"model\":[1040],\"teleportMode\":[1,\"teleport-mode\"],\"enabled\":[4]}]]],[\"vertex-scene-tree-table-cell.cjs\",[[1,\"vertex-scene-tree-table-cell\",{\"node\":[16],\"tree\":[16],\"value\":[1],\"placeholder\":[1],\"hovered\":[1028],\"isScrolling\":[4,\"is-scrolling\"],\"expandToggle\":[4,\"expand-toggle\"],\"visibilityToggle\":[4,\"visibility-toggle\"],\"selectionHandler\":[16],\"visibilityHandler\":[16],\"expansionHandler\":[16],\"hoverController\":[16]}]]],[\"vertex-scene-tree-table-column.cjs\",[[1,\"vertex-scene-tree-table-column\",{\"initialWidth\":[2,\"initial-width\"],\"minWidth\":[2,\"min-width\"],\"maxWidth\":[2,\"max-width\"]}]]],[\"vertex-scene-tree-table-header.cjs\",[[1,\"vertex-scene-tree-table-header\"]]],[\"vertex-scene-tree-table-resize-divider.cjs\",[[1,\"vertex-scene-tree-table-resize-divider\",{\"dragging\":[32]}]]],[\"vertex-scene-tree-toolbar-group.cjs\",[[1,\"vertex-scene-tree-toolbar-group\"]]],[\"vertex-viewer.cjs\",[[1,\"vertex-viewer\",{\"src\":[1],\"clientId\":[1,\"client-id\"],\"deviceId\":[1025,\"device-id\"],\"config\":[1],\"configEnv\":[1,\"config-env\"],\"resolvedConfig\":[1040],\"cameraControls\":[4,\"camera-controls\"],\"cameraType\":[1537,\"camera-type\"],\"keyboardControls\":[4,\"keyboard-controls\"],\"rotateAroundTapPoint\":[4,\"rotate-around-tap-point\"],\"token\":[1025],\"depthBuffers\":[1,\"depth-buffers\"],\"phantom\":[16],\"noDefaultLights\":[4,\"no-default-lights\"],\"enableTemporalRefinement\":[4,\"enable-temporal-refinement\"],\"experimentalRenderingOptions\":[1,\"experimental-rendering-options\"],\"featureLines\":[16],\"selectionHighlighting\":[16],\"featureHighlighting\":[16],\"featureMaps\":[1,\"feature-maps\"],\"resizeDebounce\":[2,\"resize-debounce\"],\"frame\":[1040],\"stream\":[1040],\"stencilBuffer\":[1040],\"viewport\":[1040],\"annotations\":[1040],\"dimensions\":[32],\"hostDimensions\":[32],\"errorMessage\":[32],\"cursor\":[32],\"stateMap\":[32],\"dispatchFrameDrawn\":[64],\"registerInteractionHandler\":[64],\"registerTapKeyInteraction\":[64],\"getInteractionTarget_DEPRECATED\":[64],\"addCursor\":[64],\"getInteractionHandlers\":[64],\"getKeyInteractions\":[64],\"getBaseInteractionHandler\":[64],\"getJwt\":[64],\"load\":[64],\"unload\":[64],\"scene\":[64],\"isSceneReady\":[64]},[[0,\"tap\",\"handleTapEvent\"]]]]],[\"vertex-viewer-hit-result-indicator.cjs\",[[1,\"vertex-viewer-hit-result-indicator\",{\"viewer\":[16],\"position\":[1040],\"normal\":[1040]}]]],[\"vertex-viewer-measurement-details.cjs\",[[1,\"vertex-viewer-measurement-details\",{\"measurementModel\":[16],\"measurementOverlays\":[16],\"measurementOutcome\":[1040],\"distanceUnits\":[1,\"distance-units\"],\"angleUnits\":[1,\"angle-units\"],\"fractionalDigits\":[2,\"fractional-digits\"],\"distanceFormatter\":[16],\"angleFormatter\":[16],\"areaFormatter\":[16],\"resultTypes\":[16],\"overlay\":[32],\"distanceMeasurementUnits\":[32],\"angleMeasurementUnits\":[32],\"areaMeasurementUnits\":[32]}]]],[\"vertex-viewer-transform-widget.cjs\",[[1,\"vertex-viewer-transform-widget\",{\"viewer\":[16],\"position\":[1040],\"rotation\":[1040],\"controller\":[1040],\"xRotationDisabled\":[1028,\"x-rotation-disabled\"],\"yRotationDisabled\":[1028,\"y-rotation-disabled\"],\"zRotationDisabled\":[1028,\"z-rotation-disabled\"],\"xTranslationDisabled\":[1028,\"x-translation-disabled\"],\"yTranslationDisabled\":[1028,\"y-translation-disabled\"],\"zTranslationDisabled\":[1028,\"z-translation-disabled\"],\"showInputs\":[4,\"show-inputs\"],\"distanceUnit\":[1,\"distance-unit\"],\"angleUnit\":[1,\"angle-unit\"],\"decimalPlaces\":[2,\"decimal-places\"],\"EXPERIMENTAL_undoKeybindings\":[4,\"e-x-p-e-r-i-m-e-n-t-a-l_undo-keybindings\"],\"hovered\":[1040],\"inputPosition\":[32],\"inputValue\":[32],\"isEndingTransform\":[32],\"inputShouldFocus\":[32],\"EXPERIMENTAL_undo\":[64]}]]],[\"vertex-viewer-pin-group.cjs\",[[0,\"vertex-viewer-pin-group\",{\"pin\":[16],\"matrix\":[1040],\"projectionViewMatrix\":[16],\"elementBounds\":[1040],\"pinModel\":[16],\"pinController\":[16],\"selected\":[4],\"occluded\":[1540],\"detached\":[1540],\"invalidateStateCounter\":[32]},[[0,\"occlusionStateChanged\",\"handleOcclusionStateChanged\"],[0,\"detachedStateChanged\",\"handleDetachedStateChanged\"]]]]],[\"vertex-viewer-dom-group.cjs\",[[6,\"vertex-viewer-dom-group\",{\"position\":[1040],\"positionJson\":[1,\"position\"],\"rotation\":[1040],\"rotationJson\":[1,\"rotation\"],\"quaternion\":[1040],\"quaternionJson\":[1,\"quaternion\"],\"scale\":[1040],\"scaleJson\":[1,\"scale\"],\"matrix\":[1040]}]]],[\"vertex-viewer-teleport-tool.cjs\",[[1,\"vertex-viewer-teleport-tool\",{\"viewer\":[16],\"mode\":[1025],\"animationsDisabled\":[4,\"animations-disabled\"],\"animationMs\":[2,\"animation-ms\"],\"controller\":[1040],\"model\":[1040]}]]],[\"vertex-viewer-spinner.cjs\",[[1,\"vertex-viewer-spinner\",{\"size\":[1]}]]],[\"vertex-scene-tree-search_3.cjs\",[[1,\"vertex-scene-tree-search\",{\"debounce\":[2],\"disabled\":[4],\"placeholder\":[1],\"controller\":[16],\"value\":[1025],\"focused\":[32],\"isSearching\":[32],\"setFocus\":[64],\"clear\":[64]}],[1,\"vertex-scene-tree-table-layout\",{\"tree\":[16],\"controller\":[16],\"rows\":[16],\"totalRows\":[2,\"total-rows\"],\"rowHeight\":[1026,\"row-height\"],\"overScanCount\":[2,\"over-scan-count\"],\"rowData\":[16],\"layoutOffset\":[1026,\"layout-offset\"],\"scrollOffset\":[1026,\"scroll-offset\"],\"layoutHeight\":[1026,\"layout-height\"],\"layoutWidth\":[1026,\"layout-width\"],\"viewportStartIndex\":[1026,\"viewport-start-index\"],\"viewportEndIndex\":[1026,\"viewport-end-index\"],\"columnGridLayout\":[32],\"columnGridFixedLayout\":[32],\"isComputingCellHeight\":[32],\"lastDividerPointerPosition\":[32],\"resizingColumnIndex\":[32],\"isScrolling\":[32],\"scrollTimer\":[32],\"stateMap\":[32],\"scrollToPosition\":[64]}],[1,\"vertex-scene-tree-toolbar\"]]],[\"vertex-viewer-layer.cjs\",[[1,\"vertex-viewer-layer\",{\"stretchOff\":[516,\"stretch-off\"]}]]],[\"vertex-viewer-button_3.cjs\",[[1,\"vertex-viewer-toolbar\",{\"placement\":[1],\"direction\":[1]}],[1,\"vertex-viewer-button\"],[1,\"vertex-viewer-toolbar-group\",{\"direction\":[1]}]]],[\"vertex-viewer-pin-label_2.cjs\",[[0,\"vertex-viewer-pin-label\",{\"pin\":[16],\"elementBounds\":[16],\"value\":[1025],\"pinController\":[16],\"focused\":[32],\"computedScreenPosition\":[32],\"textareaRows\":[32],\"contentElBounds\":[32],\"setFocus\":[64]}],[0,\"vertex-viewer-pin-label-line\",{\"pinPoint\":[16],\"labelPoint\":[16],\"pin\":[16]}]]],[\"vertex-viewer-measurement-line_2.cjs\",[[1,\"vertex-viewer-measurement-overlays\",{\"measurementOverlays\":[16],\"camera\":[1040],\"viewer\":[16],\"overlays\":[32]}],[1,\"vertex-viewer-measurement-line\",{\"start\":[16],\"end\":[16],\"capLength\":[2,\"cap-length\"],\"pointerEvents\":[1,\"pointer-events\"]}]]],[\"vertex-viewer-dom-element_2.cjs\",[[6,\"vertex-viewer-dom-renderer\",{\"drawMode\":[1,\"draw-mode\"],\"viewer\":[16],\"camera\":[1040],\"depthBuffer\":[1040],\"viewport\":[32],\"invalidateFrameCounter\":[32]},[[0,\"propertyChange\",\"handlePropertyChange\"]]],[1,\"vertex-viewer-dom-element\",{\"position\":[1040],\"positionJson\":[1,\"position\"],\"rotation\":[1040],\"rotationJson\":[1,\"rotation\"],\"quaternion\":[1040],\"quaternionJson\":[1,\"quaternion\"],\"scale\":[1040],\"scaleJson\":[1,\"scale\"],\"matrix\":[1040],\"occlusionOff\":[4,\"occlusion-off\"],\"occluded\":[516],\"detachedOff\":[4,\"detached-off\"],\"detached\":[516],\"billboardOff\":[4,\"billboard-off\"],\"interactionsOff\":[516,\"interactions-off\"]}]]],[\"vertex-viewer-markup-arrow_3.cjs\",[[1,\"vertex-viewer-markup-arrow\",{\"start\":[1040],\"startJson\":[1,\"start\"],\"end\":[1040],\"endJson\":[1,\"end\"],\"startLineAnchorStyle\":[1025,\"start-line-anchor-style\"],\"endLineAnchorStyle\":[1025,\"end-line-anchor-style\"],\"mode\":[513],\"viewer\":[16],\"elementBounds\":[32],\"dispose\":[64]}],[1,\"vertex-viewer-markup-circle\",{\"bounds\":[1040],\"boundsJson\":[1,\"bounds\"],\"mode\":[513],\"viewer\":[16],\"elementBounds\":[32],\"dispose\":[64]}],[1,\"vertex-viewer-markup-freeform\",{\"points\":[1040],\"pointsJson\":[1,\"points\"],\"bounds\":[1040],\"boundsJson\":[1,\"bounds\"],\"mode\":[513],\"viewer\":[16],\"elementBounds\":[32],\"screenPoints\":[32],\"dispose\":[64]}]]],[\"vertex-viewer-icon.cjs\",[[1,\"vertex-viewer-icon\",{\"name\":[1],\"size\":[1]}]]]]"), options);
|
|
23
|
+
return index.bootstrapLazy(JSON.parse("[[\"vertex-viewer-pin-tool.cjs\",[[1,\"vertex-viewer-pin-tool\",{\"pinController\":[1040],\"pinModel\":[16],\"viewer\":[16],\"tool\":[1025],\"mode\":[1025],\"primaryColor\":[1025,\"primary-color\"],\"accentColor\":[1025,\"accent-color\"],\"pins\":[32],\"selectedPinId\":[32],\"elementBounds\":[32],\"projectionViewMatrix\":[32]}]]],[\"vertex-scene-tree.cjs\",[[1,\"vertex-scene-tree\",{\"overScanCount\":[2,\"over-scan-count\"],\"viewerSelector\":[1,\"viewer-selector\"],\"viewer\":[1040],\"rowData\":[16],\"config\":[1],\"configEnv\":[1,\"config-env\"],\"controller\":[1040],\"searchOptions\":[1040],\"metadataSearchExactMatch\":[1028,\"metadata-search-exact-match\"],\"metadataSearchKeys\":[1040],\"metadataKeys\":[16],\"rows\":[32],\"totalRows\":[32],\"showLoader\":[32],\"showEmptyResults\":[32],\"stateMap\":[32],\"errorDetails\":[32],\"attemptingRetry\":[32],\"invalidateRows\":[64],\"scrollToIndex\":[64],\"scrollToItem\":[64],\"expandAll\":[64],\"collapseAll\":[64],\"expandItem\":[64],\"collapseItem\":[64],\"toggleExpandItem\":[64],\"toggleItemVisibility\":[64],\"hideItem\":[64],\"showItem\":[64],\"selectItem\":[64],\"deselectItem\":[64],\"getRowAtIndex\":[64],\"getRowForEvent\":[64],\"getRowAtClientY\":[64],\"filterItems\":[64],\"selectFilteredItems\":[64],\"fetchMetadataKeys\":[64]},[[0,\"search\",\"handleSearch\"],[0,\"cellLoaded\",\"handleCellLoaded\"]]]]],[\"vertex-viewer-default-toolbar.cjs\",[[1,\"vertex-viewer-default-toolbar\",{\"viewer\":[16],\"placement\":[1],\"direction\":[1],\"animationsDisabled\":[4,\"animations-disabled\"],\"animationMs\":[2,\"animation-ms\"]}]]],[\"vertex-viewer-markup.cjs\",[[1,\"vertex-viewer-markup\",{\"arrowTemplateId\":[1,\"arrow-template-id\"],\"circleTemplateId\":[1,\"circle-template-id\"],\"freeformTemplateId\":[1,\"freeform-template-id\"],\"tool\":[1],\"disabled\":[4],\"viewer\":[16],\"selectedMarkupId\":[1025,\"selected-markup-id\"],\"selectNew\":[4,\"select-new\"],\"startLineAnchorStyle\":[1025,\"start-line-anchor-style\"],\"endLineAnchorStyle\":[1025,\"end-line-anchor-style\"],\"toSelectMarkupId\":[32],\"pointerDownPosition\":[32],\"addMarkup\":[64],\"removeMarkup\":[64],\"getMarkupElements\":[64],\"getMarkupElement\":[64]},[[0,\"markupEnd\",\"handleMarkupEnd\"],[0,\"interactionEnd\",\"handleMarkupUpdated\"],[1,\"pointerdown\",\"handleMarkupPointerDown\"]]]]],[\"vertex-viewer-markup-tool.cjs\",[[1,\"vertex-viewer-markup-tool\",{\"arrowTemplateId\":[1,\"arrow-template-id\"],\"circleTemplateId\":[1,\"circle-template-id\"],\"freeformTemplateId\":[1,\"freeform-template-id\"],\"tool\":[1],\"disabled\":[4],\"viewer\":[16],\"startLineAnchorStyle\":[1025,\"start-line-anchor-style\"],\"endLineAnchorStyle\":[1025,\"end-line-anchor-style\"],\"stateMap\":[32],\"reset\":[64]}]]],[\"vertex-viewer-view-cube.cjs\",[[1,\"vertex-viewer-view-cube\",{\"xPositiveLabel\":[1,\"x-positive-label\"],\"xNegativeLabel\":[1,\"x-negative-label\"],\"yPositiveLabel\":[1,\"y-positive-label\"],\"yNegativeLabel\":[1,\"y-negative-label\"],\"zPositiveLabel\":[1,\"z-positive-label\"],\"zNegativeLabel\":[1,\"z-negative-label\"],\"standardViewsOff\":[4,\"standard-views-off\"],\"viewAll\":[4,\"view-all\"],\"animationDuration\":[2,\"animation-duration\"],\"triadOff\":[4,\"triad-off\"],\"worldOrientation\":[1040],\"camera\":[1040],\"viewer\":[16],\"boxLength\":[32],\"triadPosition\":[32]}]]],[\"vertex-viewer-measurement-distance.cjs\",[[1,\"vertex-viewer-measurement-distance\",{\"start\":[1040],\"startJson\":[1,\"start-json\"],\"end\":[1040],\"endJson\":[1,\"end-json\"],\"distance\":[1026],\"showAxisReferenceLines\":[4,\"show-axis-reference-lines\"],\"snapDistance\":[2,\"snap-distance\"],\"units\":[1],\"fractionalDigits\":[2,\"fractional-digits\"],\"labelFormatter\":[16],\"anchorLabelOffset\":[2,\"anchor-label-offset\"],\"lineCapLength\":[2,\"line-cap-length\"],\"mode\":[513],\"interactingAnchor\":[1537,\"interacting-anchor\"],\"invalid\":[1540],\"camera\":[16],\"hitProvider\":[16],\"indicatorPt\":[1040],\"viewer\":[16],\"measurementModel\":[16],\"viewport\":[32],\"elementBounds\":[32],\"interactionCount\":[32],\"internalCamera\":[32],\"invalidateStateCounter\":[32],\"stateMap\":[32],\"measurementUnits\":[32],\"computeElementMetrics\":[64]}]]],[\"vertex-viewer-measurement-precise.cjs\",[[1,\"vertex-viewer-measurement-precise\",{\"measurementModel\":[16],\"measurementOverlays\":[16],\"measurementController\":[1040],\"measurableEntityTypes\":[16],\"viewer\":[16],\"configEnv\":[1,\"config-env\"],\"config\":[1]}]]],[\"vertex-viewer-annotation-callout.cjs\",[[1,\"vertex-viewer-annotation-callout\",{\"data\":[16],\"iconSize\":[1,\"icon-size\"]}]]],[\"vertex-viewer-box-query-tool.cjs\",[[1,\"vertex-viewer-box-query-tool\",{\"viewer\":[16],\"controller\":[1040],\"model\":[1040],\"operationType\":[1,\"operation-type\"],\"mode\":[1],\"details\":[32]}]]],[\"vertex-viewer-walk-mode-tool.cjs\",[[1,\"vertex-viewer-walk-mode-tool\",{\"viewer\":[16],\"controller\":[1040],\"model\":[1040],\"teleportMode\":[1,\"teleport-mode\"],\"enabled\":[4]}]]],[\"vertex-scene-tree-table-cell.cjs\",[[1,\"vertex-scene-tree-table-cell\",{\"node\":[16],\"tree\":[16],\"value\":[1],\"placeholder\":[1],\"hovered\":[1028],\"isScrolling\":[4,\"is-scrolling\"],\"expandToggle\":[4,\"expand-toggle\"],\"visibilityToggle\":[4,\"visibility-toggle\"],\"selectionHandler\":[16],\"visibilityHandler\":[16],\"expansionHandler\":[16],\"hoverController\":[16]}]]],[\"vertex-scene-tree-table-column.cjs\",[[1,\"vertex-scene-tree-table-column\",{\"initialWidth\":[2,\"initial-width\"],\"minWidth\":[2,\"min-width\"],\"maxWidth\":[2,\"max-width\"]}]]],[\"vertex-scene-tree-table-header.cjs\",[[1,\"vertex-scene-tree-table-header\"]]],[\"vertex-scene-tree-table-resize-divider.cjs\",[[1,\"vertex-scene-tree-table-resize-divider\",{\"dragging\":[32]}]]],[\"vertex-scene-tree-toolbar-group.cjs\",[[1,\"vertex-scene-tree-toolbar-group\"]]],[\"vertex-viewer.cjs\",[[1,\"vertex-viewer\",{\"src\":[1],\"clientId\":[1,\"client-id\"],\"deviceId\":[1025,\"device-id\"],\"config\":[1],\"configEnv\":[1,\"config-env\"],\"resolvedConfig\":[1040],\"cameraControls\":[4,\"camera-controls\"],\"cameraType\":[1537,\"camera-type\"],\"keyboardControls\":[4,\"keyboard-controls\"],\"rotateAroundTapPoint\":[4,\"rotate-around-tap-point\"],\"token\":[1025],\"depthBuffers\":[1,\"depth-buffers\"],\"phantom\":[16],\"noDefaultLights\":[4,\"no-default-lights\"],\"enableTemporalRefinement\":[4,\"enable-temporal-refinement\"],\"experimentalRenderingOptions\":[1,\"experimental-rendering-options\"],\"featureLines\":[16],\"selectionHighlighting\":[16],\"featureHighlighting\":[16],\"featureMaps\":[1,\"feature-maps\"],\"resizeDebounce\":[2,\"resize-debounce\"],\"frame\":[1040],\"stream\":[1040],\"stencilBuffer\":[1040],\"viewport\":[1040],\"annotations\":[1040],\"dimensions\":[32],\"hostDimensions\":[32],\"errorMessage\":[32],\"cursor\":[32],\"stateMap\":[32],\"dispatchFrameDrawn\":[64],\"registerInteractionHandler\":[64],\"registerTapKeyInteraction\":[64],\"getInteractionTarget_DEPRECATED\":[64],\"addCursor\":[64],\"getInteractionHandlers\":[64],\"getKeyInteractions\":[64],\"getBaseInteractionHandler\":[64],\"getJwt\":[64],\"load\":[64],\"unload\":[64],\"scene\":[64],\"isSceneReady\":[64]},[[0,\"tap\",\"handleTapEvent\"]]]]],[\"vertex-viewer-hit-result-indicator.cjs\",[[1,\"vertex-viewer-hit-result-indicator\",{\"viewer\":[16],\"position\":[1040],\"normal\":[1040]}]]],[\"vertex-viewer-measurement-details.cjs\",[[1,\"vertex-viewer-measurement-details\",{\"measurementModel\":[16],\"measurementOverlays\":[16],\"measurementOutcome\":[1040],\"distanceUnits\":[1,\"distance-units\"],\"angleUnits\":[1,\"angle-units\"],\"fractionalDigits\":[2,\"fractional-digits\"],\"distanceFormatter\":[16],\"angleFormatter\":[16],\"areaFormatter\":[16],\"resultTypes\":[16],\"overlay\":[32],\"distanceMeasurementUnits\":[32],\"angleMeasurementUnits\":[32],\"areaMeasurementUnits\":[32]}]]],[\"vertex-viewer-transform-widget.cjs\",[[1,\"vertex-viewer-transform-widget\",{\"viewer\":[16],\"position\":[1040],\"rotation\":[1040],\"controller\":[1040],\"xRotationDisabled\":[1028,\"x-rotation-disabled\"],\"yRotationDisabled\":[1028,\"y-rotation-disabled\"],\"zRotationDisabled\":[1028,\"z-rotation-disabled\"],\"xTranslationDisabled\":[1028,\"x-translation-disabled\"],\"yTranslationDisabled\":[1028,\"y-translation-disabled\"],\"zTranslationDisabled\":[1028,\"z-translation-disabled\"],\"showInputs\":[4,\"show-inputs\"],\"distanceUnit\":[1,\"distance-unit\"],\"angleUnit\":[1,\"angle-unit\"],\"decimalPlaces\":[2,\"decimal-places\"],\"EXPERIMENTAL_undoKeybindings\":[4,\"e-x-p-e-r-i-m-e-n-t-a-l_undo-keybindings\"],\"hovered\":[1040],\"inputPosition\":[32],\"inputValue\":[32],\"isEndingTransform\":[32],\"inputShouldFocus\":[32],\"EXPERIMENTAL_undo\":[64]}]]],[\"vertex-viewer-pin-group.cjs\",[[0,\"vertex-viewer-pin-group\",{\"pin\":[16],\"matrix\":[1040],\"projectionViewMatrix\":[16],\"elementBounds\":[1040],\"pinModel\":[16],\"pinController\":[16],\"selected\":[4],\"occluded\":[1540],\"detached\":[1540],\"invalidateStateCounter\":[32]},[[0,\"occlusionStateChanged\",\"handleOcclusionStateChanged\"],[0,\"detachedStateChanged\",\"handleDetachedStateChanged\"]]]]],[\"vertex-viewer-dom-group.cjs\",[[6,\"vertex-viewer-dom-group\",{\"position\":[1040],\"positionJson\":[1,\"position\"],\"rotation\":[1040],\"rotationJson\":[1,\"rotation\"],\"quaternion\":[1040],\"quaternionJson\":[1,\"quaternion\"],\"scale\":[1040],\"scaleJson\":[1,\"scale\"],\"matrix\":[1040]}]]],[\"vertex-viewer-teleport-tool.cjs\",[[1,\"vertex-viewer-teleport-tool\",{\"viewer\":[16],\"mode\":[1025],\"animationsDisabled\":[4,\"animations-disabled\"],\"animationMs\":[2,\"animation-ms\"],\"controller\":[1040],\"model\":[1040]}]]],[\"vertex-viewer-spinner.cjs\",[[1,\"vertex-viewer-spinner\",{\"size\":[1]}]]],[\"vertex-scene-tree-search_3.cjs\",[[1,\"vertex-scene-tree-search\",{\"debounce\":[2],\"disabled\":[4],\"placeholder\":[1],\"controller\":[16],\"value\":[1025],\"focused\":[32],\"isSearching\":[32],\"setFocus\":[64],\"clear\":[64]}],[1,\"vertex-scene-tree-table-layout\",{\"tree\":[16],\"controller\":[16],\"rows\":[16],\"totalRows\":[2,\"total-rows\"],\"rowHeight\":[1026,\"row-height\"],\"overScanCount\":[2,\"over-scan-count\"],\"rowData\":[16],\"layoutOffset\":[1026,\"layout-offset\"],\"scrollOffset\":[1026,\"scroll-offset\"],\"layoutHeight\":[1026,\"layout-height\"],\"layoutWidth\":[1026,\"layout-width\"],\"viewportStartIndex\":[1026,\"viewport-start-index\"],\"viewportEndIndex\":[1026,\"viewport-end-index\"],\"columnGridLayout\":[32],\"columnGridFixedLayout\":[32],\"isComputingCellHeight\":[32],\"lastDividerPointerPosition\":[32],\"resizingColumnIndex\":[32],\"isScrolling\":[32],\"scrollTimer\":[32],\"stateMap\":[32],\"scrollToPosition\":[64]}],[1,\"vertex-scene-tree-toolbar\"]]],[\"vertex-viewer-layer.cjs\",[[1,\"vertex-viewer-layer\",{\"stretchOff\":[516,\"stretch-off\"]}]]],[\"vertex-viewer-button_3.cjs\",[[1,\"vertex-viewer-toolbar\",{\"placement\":[1],\"direction\":[1]}],[1,\"vertex-viewer-button\"],[1,\"vertex-viewer-toolbar-group\",{\"direction\":[1]}]]],[\"vertex-viewer-pin-label_2.cjs\",[[0,\"vertex-viewer-pin-label\",{\"pin\":[16],\"elementBounds\":[16],\"value\":[1025],\"pinController\":[16],\"focused\":[32],\"computedScreenPosition\":[32],\"textareaRows\":[32],\"contentElBounds\":[32],\"setFocus\":[64],\"submit\":[64]}],[0,\"vertex-viewer-pin-label-line\",{\"pinPoint\":[16],\"labelPoint\":[16],\"pin\":[16]}]]],[\"vertex-viewer-measurement-line_2.cjs\",[[1,\"vertex-viewer-measurement-overlays\",{\"measurementOverlays\":[16],\"camera\":[1040],\"viewer\":[16],\"overlays\":[32]}],[1,\"vertex-viewer-measurement-line\",{\"start\":[16],\"end\":[16],\"capLength\":[2,\"cap-length\"],\"pointerEvents\":[1,\"pointer-events\"]}]]],[\"vertex-viewer-dom-element_2.cjs\",[[6,\"vertex-viewer-dom-renderer\",{\"drawMode\":[1,\"draw-mode\"],\"propagateEventsToViewer\":[4,\"propagate-events-to-viewer\"],\"viewer\":[16],\"camera\":[1040],\"depthBuffer\":[1040],\"viewport\":[32],\"invalidateFrameCounter\":[32],\"interactionDisposables\":[32]},[[0,\"propertyChange\",\"handlePropertyChange\"]]],[1,\"vertex-viewer-dom-element\",{\"position\":[1040],\"positionJson\":[1,\"position\"],\"rotation\":[1040],\"rotationJson\":[1,\"rotation\"],\"quaternion\":[1040],\"quaternionJson\":[1,\"quaternion\"],\"scale\":[1040],\"scaleJson\":[1,\"scale\"],\"matrix\":[1040],\"occlusionOff\":[4,\"occlusion-off\"],\"occluded\":[516],\"detachedOff\":[4,\"detached-off\"],\"detached\":[516],\"billboardOff\":[4,\"billboard-off\"],\"interactionsOff\":[516,\"interactions-off\"]}]]],[\"vertex-viewer-markup-arrow_3.cjs\",[[1,\"vertex-viewer-markup-arrow\",{\"start\":[1040],\"startJson\":[1,\"start\"],\"end\":[1040],\"endJson\":[1,\"end\"],\"startLineAnchorStyle\":[1025,\"start-line-anchor-style\"],\"endLineAnchorStyle\":[1025,\"end-line-anchor-style\"],\"mode\":[513],\"viewer\":[16],\"elementBounds\":[32],\"dispose\":[64]}],[1,\"vertex-viewer-markup-circle\",{\"bounds\":[1040],\"boundsJson\":[1,\"bounds\"],\"mode\":[513],\"viewer\":[16],\"elementBounds\":[32],\"dispose\":[64]}],[1,\"vertex-viewer-markup-freeform\",{\"points\":[1040],\"pointsJson\":[1,\"points\"],\"bounds\":[1040],\"boundsJson\":[1,\"bounds\"],\"mode\":[513],\"viewer\":[16],\"elementBounds\":[32],\"screenPoints\":[32],\"dispose\":[64]}]]],[\"vertex-viewer-icon.cjs\",[[1,\"vertex-viewer-icon\",{\"name\":[1],\"size\":[1]}]]]]"), options);
|
|
24
24
|
});
|
|
25
25
|
};
|
|
26
26
|
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2024 Vertex Software LLC. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
'use strict';
|
|
5
|
+
|
|
6
|
+
const browser_esm = require('./browser.esm-13ce8652.js');
|
|
7
|
+
const bundle_esm = require('./bundle.esm-b2145e44.js');
|
|
8
|
+
const dom = require('./dom-4344863c.js');
|
|
9
|
+
|
|
10
|
+
const SCROLL_WHEEL_DELTA_PERCENTAGES = [0.2, 0.15, 0.25, 0.25, 0.15];
|
|
11
|
+
const DEFAULT_FONT_SIZE = 16;
|
|
12
|
+
const DEFAULT_LINE_HEIGHT = 1.2;
|
|
13
|
+
class BaseInteractionHandler {
|
|
14
|
+
constructor(downEvent, upEvent, moveEvent, rotateInteraction, rotatePointInteraction, zoomInteraction, panInteraction, twistInteraction, pivotInteraction, getConfig) {
|
|
15
|
+
this.downEvent = downEvent;
|
|
16
|
+
this.upEvent = upEvent;
|
|
17
|
+
this.moveEvent = moveEvent;
|
|
18
|
+
this.rotateInteraction = rotateInteraction;
|
|
19
|
+
this.rotatePointInteraction = rotatePointInteraction;
|
|
20
|
+
this.zoomInteraction = zoomInteraction;
|
|
21
|
+
this.panInteraction = panInteraction;
|
|
22
|
+
this.twistInteraction = twistInteraction;
|
|
23
|
+
this.pivotInteraction = pivotInteraction;
|
|
24
|
+
this.getConfig = getConfig;
|
|
25
|
+
this.primaryInteraction = this.rotateInteraction;
|
|
26
|
+
this.isDragging = false;
|
|
27
|
+
this.keyboardControls = false;
|
|
28
|
+
this.disableIndividualInteractions = false;
|
|
29
|
+
this.primaryInteractionTypeChange = new browser_esm.EventDispatcher();
|
|
30
|
+
this.handleDownEvent = this.handleDownEvent.bind(this);
|
|
31
|
+
this.handleMouseWheel = this.handleMouseWheel.bind(this);
|
|
32
|
+
this.handleWindowMove = this.handleWindowMove.bind(this);
|
|
33
|
+
this.handleWindowUp = this.handleWindowUp.bind(this);
|
|
34
|
+
this.handleDoubleClick = this.handleDoubleClick.bind(this);
|
|
35
|
+
}
|
|
36
|
+
initialize(element, api) {
|
|
37
|
+
this.element = element;
|
|
38
|
+
this.interactionApi = api;
|
|
39
|
+
element.addEventListener(this.downEvent, this.handleDownEvent);
|
|
40
|
+
element.addEventListener('mousedown', this.handleDoubleClick);
|
|
41
|
+
element.addEventListener('wheel', this.handleMouseWheel, {
|
|
42
|
+
passive: false,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
dispose() {
|
|
46
|
+
var _a, _b, _c;
|
|
47
|
+
(_a = this.element) === null || _a === void 0 ? void 0 : _a.removeEventListener(this.downEvent, this.handleDownEvent);
|
|
48
|
+
(_b = this.element) === null || _b === void 0 ? void 0 : _b.removeEventListener('mousedown', this.handleDoubleClick);
|
|
49
|
+
(_c = this.element) === null || _c === void 0 ? void 0 : _c.removeEventListener('wheel', this.handleMouseWheel);
|
|
50
|
+
this.element = undefined;
|
|
51
|
+
}
|
|
52
|
+
onPrimaryInteractionTypeChange(listener) {
|
|
53
|
+
return this.primaryInteractionTypeChange.on(listener);
|
|
54
|
+
}
|
|
55
|
+
setCurrentInteractionType(type) {
|
|
56
|
+
var _a;
|
|
57
|
+
switch (type) {
|
|
58
|
+
case 'rotate':
|
|
59
|
+
this.currentInteraction = this.rotateInteraction;
|
|
60
|
+
break;
|
|
61
|
+
case 'zoom':
|
|
62
|
+
this.currentInteraction = this.zoomInteraction;
|
|
63
|
+
break;
|
|
64
|
+
case 'pan':
|
|
65
|
+
this.currentInteraction = this.panInteraction;
|
|
66
|
+
break;
|
|
67
|
+
case 'twist':
|
|
68
|
+
this.currentInteraction = this.twistInteraction;
|
|
69
|
+
break;
|
|
70
|
+
case 'rotate-point':
|
|
71
|
+
this.currentInteraction = this.rotatePointInteraction;
|
|
72
|
+
break;
|
|
73
|
+
case 'pivot':
|
|
74
|
+
this.currentInteraction = this.pivotInteraction;
|
|
75
|
+
break;
|
|
76
|
+
default:
|
|
77
|
+
this.currentInteraction = undefined;
|
|
78
|
+
}
|
|
79
|
+
if (this.draggingInteraction) {
|
|
80
|
+
const point = this.draggingInteraction.getPosition();
|
|
81
|
+
this.draggingInteraction =
|
|
82
|
+
this.currentInteraction || this.primaryInteraction;
|
|
83
|
+
(_a = this.interactionApi) === null || _a === void 0 ? void 0 : _a.resetLastAngle();
|
|
84
|
+
this.draggingInteraction.setPosition(point);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
getPrimaryInteractionType() {
|
|
88
|
+
return this.primaryInteraction.getType();
|
|
89
|
+
}
|
|
90
|
+
getCurrentInteractionType() {
|
|
91
|
+
return (this.currentInteraction || this.primaryInteraction).getType();
|
|
92
|
+
}
|
|
93
|
+
setPrimaryInteractionType(type) {
|
|
94
|
+
switch (type) {
|
|
95
|
+
case 'rotate':
|
|
96
|
+
this.primaryInteraction = this.rotateInteraction;
|
|
97
|
+
this.lastPrimaryRotateInteraction = this.rotateInteraction;
|
|
98
|
+
break;
|
|
99
|
+
case 'rotate-point':
|
|
100
|
+
this.primaryInteraction = this.rotatePointInteraction;
|
|
101
|
+
this.lastPrimaryRotateInteraction = this.rotatePointInteraction;
|
|
102
|
+
break;
|
|
103
|
+
case 'zoom':
|
|
104
|
+
this.primaryInteraction = this.zoomInteraction;
|
|
105
|
+
break;
|
|
106
|
+
case 'pan':
|
|
107
|
+
this.primaryInteraction = this.panInteraction;
|
|
108
|
+
break;
|
|
109
|
+
case 'pivot':
|
|
110
|
+
this.primaryInteraction = this.pivotInteraction;
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
this.primaryInteractionTypeChange.emit();
|
|
114
|
+
}
|
|
115
|
+
setDefaultKeyboardControls(keyboardControls) {
|
|
116
|
+
this.keyboardControls = keyboardControls;
|
|
117
|
+
}
|
|
118
|
+
handleDownEvent(event) {
|
|
119
|
+
// Prevent selection of any text while interacting with the model.
|
|
120
|
+
event.preventDefault();
|
|
121
|
+
this.interactionTimer = window.setTimeout(() => {
|
|
122
|
+
this.downPosition = bundle_esm.point.create(event.screenX, event.screenY);
|
|
123
|
+
this.downPositionCanvas = this.getCanvasPosition(event);
|
|
124
|
+
this.interactionTimer = undefined;
|
|
125
|
+
// Perform the current movement in the case that the interaction timer elapses
|
|
126
|
+
if (this.lastMoveEvent != null) {
|
|
127
|
+
this.handleWindowMove(this.lastMoveEvent);
|
|
128
|
+
}
|
|
129
|
+
}, this.getConfig().interactions.interactionDelay);
|
|
130
|
+
window.addEventListener(this.moveEvent, this.handleWindowMove);
|
|
131
|
+
window.addEventListener(this.upEvent, this.handleWindowUp);
|
|
132
|
+
}
|
|
133
|
+
handleWindowMove(event) {
|
|
134
|
+
if (this.interactionTimer == null) {
|
|
135
|
+
if (this.disableIndividualInteractions) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
const position = bundle_esm.point.create(event.screenX, event.screenY);
|
|
139
|
+
const pixelThreshold = this.interactionApi != null
|
|
140
|
+
? this.interactionApi.pixelThreshold(this.isTouch(event))
|
|
141
|
+
: 2;
|
|
142
|
+
if (this.downPosition != null &&
|
|
143
|
+
bundle_esm.point.distance(position, this.downPosition) >= pixelThreshold &&
|
|
144
|
+
!this.isDragging) {
|
|
145
|
+
this.beginDrag(event);
|
|
146
|
+
this.isDragging = true;
|
|
147
|
+
}
|
|
148
|
+
if (this.isDragging) {
|
|
149
|
+
this.drag(event);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
this.lastMoveEvent = event;
|
|
153
|
+
}
|
|
154
|
+
async handleWindowUp(event) {
|
|
155
|
+
if (this.isDragging) {
|
|
156
|
+
this.endDrag(event);
|
|
157
|
+
this.isDragging = false;
|
|
158
|
+
}
|
|
159
|
+
if (this.interactionTimer != null) {
|
|
160
|
+
window.clearTimeout(this.interactionTimer);
|
|
161
|
+
this.interactionTimer = undefined;
|
|
162
|
+
}
|
|
163
|
+
window.removeEventListener(this.moveEvent, this.handleWindowMove);
|
|
164
|
+
window.removeEventListener(this.upEvent, this.handleWindowUp);
|
|
165
|
+
this.lastMoveEvent = undefined;
|
|
166
|
+
}
|
|
167
|
+
async handleDoubleClick(event) {
|
|
168
|
+
// event.detail is the number of clicks that have happened recently. If the number is 2, then the user double clicked.
|
|
169
|
+
if (event.detail === 2 &&
|
|
170
|
+
event.buttons === 4 &&
|
|
171
|
+
this.interactionApi != null) {
|
|
172
|
+
this.interactionApi.viewAll();
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
beginDrag(event) {
|
|
176
|
+
var _a;
|
|
177
|
+
if (this.keyboardControls && event.metaKey && event.shiftKey) {
|
|
178
|
+
this.currentInteraction = this.rotatePointInteraction;
|
|
179
|
+
}
|
|
180
|
+
else if (this.keyboardControls && event.shiftKey && event.altKey) {
|
|
181
|
+
this.currentInteraction = this.twistInteraction;
|
|
182
|
+
}
|
|
183
|
+
else if (this.keyboardControls && event.shiftKey) {
|
|
184
|
+
this.currentInteraction = this.zoomInteraction;
|
|
185
|
+
}
|
|
186
|
+
else if (this.keyboardControls && (event.metaKey || event.ctrlKey)) {
|
|
187
|
+
this.currentInteraction = this.panInteraction;
|
|
188
|
+
}
|
|
189
|
+
else if (this.keyboardControls && event.altKey) {
|
|
190
|
+
this.currentInteraction = this.rotateInteraction;
|
|
191
|
+
}
|
|
192
|
+
if (event.buttons === 1) {
|
|
193
|
+
this.draggingInteraction =
|
|
194
|
+
this.currentInteraction || this.primaryInteraction;
|
|
195
|
+
}
|
|
196
|
+
else if (event.buttons === 2) {
|
|
197
|
+
this.draggingInteraction = this.panInteraction;
|
|
198
|
+
}
|
|
199
|
+
else if (event.buttons === 4) {
|
|
200
|
+
this.draggingInteraction =
|
|
201
|
+
(_a = this.lastPrimaryRotateInteraction) !== null && _a !== void 0 ? _a : this.rotateInteraction;
|
|
202
|
+
}
|
|
203
|
+
if (this.draggingInteraction != null &&
|
|
204
|
+
this.interactionApi != null &&
|
|
205
|
+
this.element != null) {
|
|
206
|
+
// Ensure any scroll wheel interactions have been ended prior to beginning
|
|
207
|
+
// another interaction to prevent the interaction from being ended early.
|
|
208
|
+
this.zoomInteraction.endDrag(event, this.interactionApi);
|
|
209
|
+
this.draggingInteraction.beginDrag(event, this.downPositionCanvas || bundle_esm.point.create(event.clientX, event.clientY), this.interactionApi, this.element);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
drag(event) {
|
|
213
|
+
if (this.keyboardControls && event.altKey && event.shiftKey) {
|
|
214
|
+
this.currentInteraction = this.twistInteraction;
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
this.currentInteraction = undefined;
|
|
218
|
+
}
|
|
219
|
+
this.draggingInteraction =
|
|
220
|
+
this.currentInteraction ||
|
|
221
|
+
this.draggingInteraction ||
|
|
222
|
+
this.primaryInteraction;
|
|
223
|
+
if (this.draggingInteraction != null && this.interactionApi != null) {
|
|
224
|
+
this.draggingInteraction.drag(event, this.interactionApi);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
endDrag(event) {
|
|
228
|
+
if (this.keyboardControls &&
|
|
229
|
+
this.currentInteraction === this.twistInteraction) {
|
|
230
|
+
this.currentInteraction = undefined;
|
|
231
|
+
}
|
|
232
|
+
if (this.draggingInteraction != null && this.interactionApi != null) {
|
|
233
|
+
this.draggingInteraction.endDrag(event, this.interactionApi);
|
|
234
|
+
this.draggingInteraction = undefined;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
handleMouseWheel(event) {
|
|
238
|
+
event.preventDefault();
|
|
239
|
+
if (this.element != null &&
|
|
240
|
+
this.interactionApi != null &&
|
|
241
|
+
event.buttons !== 4) {
|
|
242
|
+
const delta = -this.wheelDeltaToPixels(event.deltaY, event.deltaMode) / 10;
|
|
243
|
+
const rect = this.element.getBoundingClientRect();
|
|
244
|
+
const point = dom.getMouseClientPosition(event, rect);
|
|
245
|
+
SCROLL_WHEEL_DELTA_PERCENTAGES.forEach((percentage, index) => {
|
|
246
|
+
window.setTimeout(() => {
|
|
247
|
+
if (this.interactionApi != null) {
|
|
248
|
+
const zoomDelta = delta * percentage;
|
|
249
|
+
this.zoomInteraction.zoomToPoint(point, zoomDelta, this.interactionApi);
|
|
250
|
+
}
|
|
251
|
+
}, index * 2);
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
wheelDeltaToPixels(deltaY, deltaMode) {
|
|
256
|
+
if (this.computedBodyStyle == null) {
|
|
257
|
+
this.computedBodyStyle = window.getComputedStyle(document.body);
|
|
258
|
+
}
|
|
259
|
+
const defaultLineHeight = this.computedBodyStyle.fontSize != null &&
|
|
260
|
+
this.computedBodyStyle.fontSize !== '' &&
|
|
261
|
+
!isNaN(parseFloat(this.computedBodyStyle.fontSize))
|
|
262
|
+
? parseFloat(this.computedBodyStyle.fontSize) * DEFAULT_LINE_HEIGHT
|
|
263
|
+
: DEFAULT_FONT_SIZE * DEFAULT_LINE_HEIGHT;
|
|
264
|
+
if (deltaMode === 1) {
|
|
265
|
+
// deltaMode 1 corresponds to DOM_DELTA_LINE, which computes deltas in lines
|
|
266
|
+
return this.computedBodyStyle.lineHeight != null &&
|
|
267
|
+
this.computedBodyStyle.lineHeight !== '' &&
|
|
268
|
+
!isNaN(parseFloat(this.computedBodyStyle.lineHeight))
|
|
269
|
+
? deltaY * parseFloat(this.computedBodyStyle.lineHeight)
|
|
270
|
+
: deltaY * defaultLineHeight;
|
|
271
|
+
}
|
|
272
|
+
else if (deltaMode === 2) {
|
|
273
|
+
// deltaMode 2 corresponds to DOM_DELTA_PAGE, which computes deltas in pages
|
|
274
|
+
return this.computedBodyStyle.height != null &&
|
|
275
|
+
this.computedBodyStyle.height !== '' &&
|
|
276
|
+
!isNaN(parseFloat(this.computedBodyStyle.height))
|
|
277
|
+
? deltaY * parseFloat(this.computedBodyStyle.height)
|
|
278
|
+
: deltaY * window.innerHeight;
|
|
279
|
+
}
|
|
280
|
+
// deltaMode 0 corresponds to DOM_DELTA_PIXEL, which computes deltas in pixels
|
|
281
|
+
return deltaY;
|
|
282
|
+
}
|
|
283
|
+
getCanvasPosition(event) {
|
|
284
|
+
var _a;
|
|
285
|
+
const canvasBounds = (_a = this.element) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
286
|
+
const canvasOffset = canvasBounds != null
|
|
287
|
+
? bundle_esm.point.create(canvasBounds.left, canvasBounds.top)
|
|
288
|
+
: undefined;
|
|
289
|
+
return canvasOffset != null
|
|
290
|
+
? bundle_esm.point.subtract(bundle_esm.point.create(event.clientX, event.clientY), canvasOffset)
|
|
291
|
+
: undefined;
|
|
292
|
+
}
|
|
293
|
+
isTouch(event) {
|
|
294
|
+
return window.PointerEvent != null && event instanceof PointerEvent
|
|
295
|
+
? event.pointerType === 'touch'
|
|
296
|
+
: false;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
class MultiElementInteractionHandler extends BaseInteractionHandler {
|
|
301
|
+
constructor() {
|
|
302
|
+
super(...arguments);
|
|
303
|
+
this.registeredExternalElements = {};
|
|
304
|
+
}
|
|
305
|
+
registerAdditionalElement(external) {
|
|
306
|
+
const id = browser_esm.uuid.create();
|
|
307
|
+
const disposable = this.addEventListenersToElement(external);
|
|
308
|
+
this.registeredExternalElements[id] = disposable;
|
|
309
|
+
return disposable;
|
|
310
|
+
}
|
|
311
|
+
deregisterAdditionalElementById(id) {
|
|
312
|
+
const externalElement = this.registeredExternalElements[id];
|
|
313
|
+
externalElement.dispose();
|
|
314
|
+
this.registeredExternalElements = Object.fromEntries(Object.entries(this.registeredExternalElements).filter(([key]) => key !== id));
|
|
315
|
+
}
|
|
316
|
+
deregisterAllListeners() {
|
|
317
|
+
Object.keys(this.registeredExternalElements).forEach((id) => this.deregisterAdditionalElementById(id));
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
exports.BaseInteractionHandler = BaseInteractionHandler;
|
|
322
|
+
exports.MultiElementInteractionHandler = MultiElementInteractionHandler;
|
|
323
|
+
|
|
324
|
+
//# sourceMappingURL=multiElementInteractionHandler-93bd9593.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"multiElementInteractionHandler-93bd9593.js","mappings":";;;;;;;;;AA0BA,MAAM,8BAA8B,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACrE,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,MAAM,mBAAmB,GAAG,GAAG,CAAC;MAEV,sBAAsB;EAoB1C,YACY,SAAsC,EACtC,OAAgC,EAChC,SAAsC,EACxC,iBAAoC,EACpC,sBAA8C,EAC9C,eAAgC,EAChC,cAA8B,EAC9B,gBAAkC,EAClC,gBAAkC,EAClC,SAAyB;IATvB,cAAS,GAAT,SAAS,CAA6B;IACtC,YAAO,GAAP,OAAO,CAAyB;IAChC,cAAS,GAAT,SAAS,CAA6B;IACxC,sBAAiB,GAAjB,iBAAiB,CAAmB;IACpC,2BAAsB,GAAtB,sBAAsB,CAAwB;IAC9C,oBAAe,GAAf,eAAe,CAAiB;IAChC,mBAAc,GAAd,cAAc,CAAgB;IAC9B,qBAAgB,GAAhB,gBAAgB,CAAkB;IAClC,qBAAgB,GAAhB,gBAAgB,CAAkB;IAClC,cA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,CAAC;IACjD,OAAO,UAAU,CAAC;GACnB;EAEM,+BAA+B,CAAC,EAAa;IAClD,MAAM,eAAe,GAAG,IAAI,CAAC,0BAA0B,CAAC,EAAE,CAAC,CAAC;IAE5D,eAAe,CAAC,OAAO,EAAE,CAAC;IAE1B,IAAI,CAAC,0BAA0B,GAAG,MAAM,CAAC,WAAW,CAClD,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC,MAAM,CACpD,CAAC,CAAC,GAAG,CAAC,KAAK,GAAG,KAAK,EAAE,CACtB,CACF,CAAC;GACH;EAES,sBAAsB;IAC9B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,KACtD,IAAI,CAAC,+BAA+B,CAAC,EAAE,CAAC,CACzC,CAAC;GACH;;;;;;","names":["EventDispatcher","Point","getMouseClientPosition","UUID"],"sources":["./src/lib/interactions/baseInteractionHandler.ts","./src/lib/interactions/multiElementInteractionHandler.ts"],"sourcesContent":["import { Point } from '@vertexvis/geometry';\nimport { Disposable, EventDispatcher, Listener } from '@vertexvis/utils';\n\nimport { ConfigProvider } from '../config';\nimport { getMouseClientPosition } from '../dom';\nimport { InteractionApi } from './interactionApi';\nimport { BaseEvent } from './interactionEvent';\nimport { InteractionHandler } from './interactionHandler';\nimport {\n MouseInteraction,\n PanInteraction,\n PivotInteraction,\n RotateInteraction,\n RotatePointInteraction,\n TwistInteraction,\n ZoomInteraction,\n} from './mouseInteractions';\n\nexport type InteractionType =\n | 'rotate'\n | 'zoom'\n | 'pan'\n | 'twist'\n | 'rotate-point'\n | 'pivot';\n\nconst SCROLL_WHEEL_DELTA_PERCENTAGES = [0.2, 0.15, 0.25, 0.25, 0.15];\nconst DEFAULT_FONT_SIZE = 16;\nconst DEFAULT_LINE_HEIGHT = 1.2;\n\nexport abstract class BaseInteractionHandler implements InteractionHandler {\n protected interactionApi?: InteractionApi;\n protected element?: HTMLElement;\n protected downPosition?: Point.Point;\n private downPositionCanvas?: Point.Point;\n private primaryInteraction: MouseInteraction = this.rotateInteraction;\n private currentInteraction?: MouseInteraction;\n private draggingInteraction: MouseInteraction | undefined;\n private lastPrimaryRotateInteraction?: MouseInteraction;\n private isDragging = false;\n private lastMoveEvent?: BaseEvent;\n private interactionTimer?: number;\n private keyboardControls = false;\n\n protected disableIndividualInteractions = false;\n\n private computedBodyStyle?: CSSStyleDeclaration;\n\n private primaryInteractionTypeChange = new EventDispatcher<void>();\n\n public constructor(\n protected downEvent: 'mousedown' | 'pointerdown',\n protected upEvent: 'mouseup' | 'pointerup',\n protected moveEvent: 'mousemove' | 'pointermove',\n private rotateInteraction: RotateInteraction,\n private rotatePointInteraction: RotatePointInteraction,\n private zoomInteraction: ZoomInteraction,\n private panInteraction: PanInteraction,\n private twistInteraction: TwistInteraction,\n private pivotInteraction: PivotInteraction,\n private getConfig: ConfigProvider\n ) {\n this.handleDownEvent = this.handleDownEvent.bind(this);\n this.handleMouseWheel = this.handleMouseWheel.bind(this);\n this.handleWindowMove = this.handleWindowMove.bind(this);\n this.handleWindowUp = this.handleWindowUp.bind(this);\n this.handleDoubleClick = this.handleDoubleClick.bind(this);\n }\n\n public initialize(element: HTMLElement, api: InteractionApi): void {\n this.element = element;\n this.interactionApi = api;\n element.addEventListener(this.downEvent, this.handleDownEvent);\n element.addEventListener('mousedown', this.handleDoubleClick);\n element.addEventListener('wheel', this.handleMouseWheel, {\n passive: false,\n });\n }\n\n public dispose(): void {\n this.element?.removeEventListener(this.downEvent, this.handleDownEvent);\n this.element?.removeEventListener('mousedown', this.handleDoubleClick);\n this.element?.removeEventListener('wheel', this.handleMouseWheel);\n this.element = undefined;\n }\n\n public onPrimaryInteractionTypeChange(listener: Listener<void>): Disposable {\n return this.primaryInteractionTypeChange.on(listener);\n }\n\n public setCurrentInteractionType(type?: InteractionType): void {\n switch (type) {\n case 'rotate':\n this.currentInteraction = this.rotateInteraction;\n break;\n case 'zoom':\n this.currentInteraction = this.zoomInteraction;\n break;\n case 'pan':\n this.currentInteraction = this.panInteraction;\n break;\n case 'twist':\n this.currentInteraction = this.twistInteraction;\n break;\n case 'rotate-point':\n this.currentInteraction = this.rotatePointInteraction;\n break;\n case 'pivot':\n this.currentInteraction = this.pivotInteraction;\n break;\n default:\n this.currentInteraction = undefined;\n }\n\n if (this.draggingInteraction) {\n const point = this.draggingInteraction.getPosition();\n this.draggingInteraction =\n this.currentInteraction || this.primaryInteraction;\n this.interactionApi?.resetLastAngle();\n this.draggingInteraction.setPosition(point);\n }\n }\n\n public getPrimaryInteractionType(): InteractionType {\n return this.primaryInteraction.getType();\n }\n\n public getCurrentInteractionType(): InteractionType {\n return (this.currentInteraction || this.primaryInteraction).getType();\n }\n\n public setPrimaryInteractionType(type: InteractionType): void {\n switch (type) {\n case 'rotate':\n this.primaryInteraction = this.rotateInteraction;\n this.lastPrimaryRotateInteraction = this.rotateInteraction;\n break;\n case 'rotate-point':\n this.primaryInteraction = this.rotatePointInteraction;\n this.lastPrimaryRotateInteraction = this.rotatePointInteraction;\n break;\n case 'zoom':\n this.primaryInteraction = this.zoomInteraction;\n break;\n case 'pan':\n this.primaryInteraction = this.panInteraction;\n break;\n case 'pivot':\n this.primaryInteraction = this.pivotInteraction;\n break;\n }\n this.primaryInteractionTypeChange.emit();\n }\n\n public setDefaultKeyboardControls(keyboardControls: boolean): void {\n this.keyboardControls = keyboardControls;\n }\n\n protected handleDownEvent(event: BaseEvent): void {\n // Prevent selection of any text while interacting with the model.\n event.preventDefault();\n\n this.interactionTimer = window.setTimeout(() => {\n this.downPosition = Point.create(event.screenX, event.screenY);\n this.downPositionCanvas = this.getCanvasPosition(event);\n this.interactionTimer = undefined;\n\n // Perform the current movement in the case that the interaction timer elapses\n if (this.lastMoveEvent != null) {\n this.handleWindowMove(this.lastMoveEvent);\n }\n }, this.getConfig().interactions.interactionDelay);\n\n window.addEventListener(this.moveEvent, this.handleWindowMove);\n window.addEventListener(this.upEvent, this.handleWindowUp);\n }\n\n protected handleWindowMove(event: BaseEvent): void {\n if (this.interactionTimer == null) {\n if (this.disableIndividualInteractions) {\n return;\n }\n\n const position = Point.create(event.screenX, event.screenY);\n const pixelThreshold =\n this.interactionApi != null\n ? this.interactionApi.pixelThreshold(this.isTouch(event))\n : 2;\n if (\n this.downPosition != null &&\n Point.distance(position, this.downPosition) >= pixelThreshold &&\n !this.isDragging\n ) {\n this.beginDrag(event);\n this.isDragging = true;\n }\n\n if (this.isDragging) {\n this.drag(event);\n }\n }\n\n this.lastMoveEvent = event;\n }\n\n protected async handleWindowUp(event: BaseEvent): Promise<void> {\n if (this.isDragging) {\n this.endDrag(event);\n this.isDragging = false;\n }\n\n if (this.interactionTimer != null) {\n window.clearTimeout(this.interactionTimer);\n this.interactionTimer = undefined;\n }\n\n window.removeEventListener(this.moveEvent, this.handleWindowMove);\n window.removeEventListener(this.upEvent, this.handleWindowUp);\n this.lastMoveEvent = undefined;\n }\n\n protected async handleDoubleClick(event: BaseEvent): Promise<void> {\n // event.detail is the number of clicks that have happened recently. If the number is 2, then the user double clicked.\n if (\n event.detail === 2 &&\n event.buttons === 4 &&\n this.interactionApi != null\n ) {\n this.interactionApi.viewAll();\n }\n }\n\n protected beginDrag(event: BaseEvent): void {\n if (this.keyboardControls && event.metaKey && event.shiftKey) {\n this.currentInteraction = this.rotatePointInteraction;\n } else if (this.keyboardControls && event.shiftKey && event.altKey) {\n this.currentInteraction = this.twistInteraction;\n } else if (this.keyboardControls && event.shiftKey) {\n this.currentInteraction = this.zoomInteraction;\n } else if (this.keyboardControls && (event.metaKey || event.ctrlKey)) {\n this.currentInteraction = this.panInteraction;\n } else if (this.keyboardControls && event.altKey) {\n this.currentInteraction = this.rotateInteraction;\n }\n\n if (event.buttons === 1) {\n this.draggingInteraction =\n this.currentInteraction || this.primaryInteraction;\n } else if (event.buttons === 2) {\n this.draggingInteraction = this.panInteraction;\n } else if (event.buttons === 4) {\n this.draggingInteraction =\n this.lastPrimaryRotateInteraction ?? this.rotateInteraction;\n }\n\n if (\n this.draggingInteraction != null &&\n this.interactionApi != null &&\n this.element != null\n ) {\n // Ensure any scroll wheel interactions have been ended prior to beginning\n // another interaction to prevent the interaction from being ended early.\n this.zoomInteraction.endDrag(event, this.interactionApi);\n\n this.draggingInteraction.beginDrag(\n event,\n this.downPositionCanvas || Point.create(event.clientX, event.clientY),\n this.interactionApi,\n this.element\n );\n }\n }\n\n protected drag(event: BaseEvent): void {\n if (this.keyboardControls && event.altKey && event.shiftKey) {\n this.currentInteraction = this.twistInteraction;\n } else {\n this.currentInteraction = undefined;\n }\n this.draggingInteraction =\n this.currentInteraction ||\n this.draggingInteraction ||\n this.primaryInteraction;\n if (this.draggingInteraction != null && this.interactionApi != null) {\n this.draggingInteraction.drag(event, this.interactionApi);\n }\n }\n\n protected endDrag(event: BaseEvent): void {\n if (\n this.keyboardControls &&\n this.currentInteraction === this.twistInteraction\n ) {\n this.currentInteraction = undefined;\n }\n\n if (this.draggingInteraction != null && this.interactionApi != null) {\n this.draggingInteraction.endDrag(event, this.interactionApi);\n this.draggingInteraction = undefined;\n }\n }\n\n protected handleMouseWheel(event: WheelEvent): void {\n event.preventDefault();\n\n if (\n this.element != null &&\n this.interactionApi != null &&\n event.buttons !== 4\n ) {\n const delta =\n -this.wheelDeltaToPixels(event.deltaY, event.deltaMode) / 10;\n const rect = this.element.getBoundingClientRect();\n const point = getMouseClientPosition(event, rect);\n\n SCROLL_WHEEL_DELTA_PERCENTAGES.forEach((percentage, index) => {\n window.setTimeout(() => {\n if (this.interactionApi != null) {\n const zoomDelta = delta * percentage;\n this.zoomInteraction.zoomToPoint(\n point,\n zoomDelta,\n this.interactionApi\n );\n }\n }, index * 2);\n });\n }\n }\n\n protected wheelDeltaToPixels(deltaY: number, deltaMode: number): number {\n if (this.computedBodyStyle == null) {\n this.computedBodyStyle = window.getComputedStyle(document.body);\n }\n\n const defaultLineHeight =\n this.computedBodyStyle.fontSize != null &&\n this.computedBodyStyle.fontSize !== '' &&\n !isNaN(parseFloat(this.computedBodyStyle.fontSize))\n ? parseFloat(this.computedBodyStyle.fontSize) * DEFAULT_LINE_HEIGHT\n : DEFAULT_FONT_SIZE * DEFAULT_LINE_HEIGHT;\n\n if (deltaMode === 1) {\n // deltaMode 1 corresponds to DOM_DELTA_LINE, which computes deltas in lines\n return this.computedBodyStyle.lineHeight != null &&\n this.computedBodyStyle.lineHeight !== '' &&\n !isNaN(parseFloat(this.computedBodyStyle.lineHeight))\n ? deltaY * parseFloat(this.computedBodyStyle.lineHeight)\n : deltaY * defaultLineHeight;\n } else if (deltaMode === 2) {\n // deltaMode 2 corresponds to DOM_DELTA_PAGE, which computes deltas in pages\n return this.computedBodyStyle.height != null &&\n this.computedBodyStyle.height !== '' &&\n !isNaN(parseFloat(this.computedBodyStyle.height))\n ? deltaY * parseFloat(this.computedBodyStyle.height)\n : deltaY * window.innerHeight;\n }\n // deltaMode 0 corresponds to DOM_DELTA_PIXEL, which computes deltas in pixels\n return deltaY;\n }\n\n protected getCanvasPosition(event: BaseEvent): Point.Point | undefined {\n const canvasBounds = this.element?.getBoundingClientRect();\n const canvasOffset =\n canvasBounds != null\n ? Point.create(canvasBounds.left, canvasBounds.top)\n : undefined;\n\n return canvasOffset != null\n ? Point.subtract(Point.create(event.clientX, event.clientY), canvasOffset)\n : undefined;\n }\n\n protected isTouch(event: BaseEvent): boolean {\n return window.PointerEvent != null && event instanceof PointerEvent\n ? event.pointerType === 'touch'\n : false;\n }\n}\n","import { Disposable, UUID } from '@vertexvis/utils';\n\nimport { BaseInteractionHandler } from './baseInteractionHandler';\n\nexport abstract class MultiElementInteractionHandler extends BaseInteractionHandler {\n protected registeredExternalElements: Record<UUID.UUID, Disposable> = {};\n\n public registerAdditionalElement(external: HTMLElement): Disposable {\n const id = UUID.create();\n const disposable = this.addEventListenersToElement(external);\n\n this.registeredExternalElements[id] = disposable;\n return disposable;\n }\n\n public deregisterAdditionalElementById(id: UUID.UUID): void {\n const externalElement = this.registeredExternalElements[id];\n\n externalElement.dispose();\n\n this.registeredExternalElements = Object.fromEntries(\n Object.entries(this.registeredExternalElements).filter(\n ([key]) => key !== id\n )\n );\n }\n\n protected deregisterAllListeners(): void {\n Object.keys(this.registeredExternalElements).forEach((id) =>\n this.deregisterAdditionalElementById(id)\n );\n }\n\n public abstract addEventListenersToElement(element?: HTMLElement): Disposable;\n}\n"],"version":3}
|
|
@@ -8,9 +8,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
8
8
|
const index = require('./index-b4e503d5.js');
|
|
9
9
|
const bundle_esm = require('./bundle.esm-b2145e44.js');
|
|
10
10
|
const browser_esm = require('./browser.esm-13ce8652.js');
|
|
11
|
+
const multiElementInteractionHandler = require('./multiElementInteractionHandler-93bd9593.js');
|
|
11
12
|
require('./streamAttributes-a383ddd7.js');
|
|
12
13
|
require('./entities-551add54.js');
|
|
13
14
|
const viewport = require('./viewport-75a235f6.js');
|
|
15
|
+
require('./dom-4344863c.js');
|
|
14
16
|
require('./bundle.esm-013a8b84.js');
|
|
15
17
|
require('./_commonjsHelpers-756e53d6.js');
|
|
16
18
|
|
|
@@ -459,8 +461,19 @@ const ViewerDomRenderer = class {
|
|
|
459
461
|
* used, and elements will not scale or rotate with camera changes.
|
|
460
462
|
*/
|
|
461
463
|
this.drawMode = '3d';
|
|
464
|
+
/**
|
|
465
|
+
* Specifies whether to propagate events to the viewer's interaction handlers
|
|
466
|
+
*
|
|
467
|
+
* When `true` this <vertex-viewer-dom-renderer> will be registered as a valid event target
|
|
468
|
+
* for the viewer. This enables camera interactions to be initiated from elements within this renderer.
|
|
469
|
+
*
|
|
470
|
+
* When `false` this <vertex-viewer-dom-renderer> will *not* be registered as a target
|
|
471
|
+
* for the viewer.
|
|
472
|
+
*/
|
|
473
|
+
this.propagateEventsToViewer = true;
|
|
462
474
|
this.viewport = new viewport.Viewport(0, 0);
|
|
463
475
|
this.invalidateFrameCounter = 0;
|
|
476
|
+
this.interactionDisposables = [];
|
|
464
477
|
this.handleViewerFrameDrawn = async () => {
|
|
465
478
|
this.updatePropsFromViewer();
|
|
466
479
|
};
|
|
@@ -507,6 +520,9 @@ const ViewerDomRenderer = class {
|
|
|
507
520
|
handleViewerChange(newViewer, oldViewer) {
|
|
508
521
|
oldViewer === null || oldViewer === void 0 ? void 0 : oldViewer.removeEventListener('frameDrawn', this.handleViewerFrameDrawn);
|
|
509
522
|
newViewer === null || newViewer === void 0 ? void 0 : newViewer.addEventListener('frameDrawn', this.handleViewerFrameDrawn);
|
|
523
|
+
if (this.propagateEventsToViewer && newViewer != null) {
|
|
524
|
+
this.handleEventPropagationToViewer(newViewer);
|
|
525
|
+
}
|
|
510
526
|
}
|
|
511
527
|
/**
|
|
512
528
|
* @ignore
|
|
@@ -517,6 +533,27 @@ const ViewerDomRenderer = class {
|
|
|
517
533
|
invalidateFrame() {
|
|
518
534
|
this.invalidateFrameCounter = this.invalidateFrameCounter + 1;
|
|
519
535
|
}
|
|
536
|
+
/**
|
|
537
|
+
* disposes any existing disposables, and registers new handlers on the newly provided viewer.
|
|
538
|
+
* @param newViewer
|
|
539
|
+
*/
|
|
540
|
+
handleEventPropagationToViewer(newViewer) {
|
|
541
|
+
this.interactionDisposables.forEach((disposable) => {
|
|
542
|
+
disposable.dispose();
|
|
543
|
+
});
|
|
544
|
+
this.interactionDisposables = [];
|
|
545
|
+
newViewer.getInteractionHandlers().then((handlers) => {
|
|
546
|
+
handlers.forEach((handler) => {
|
|
547
|
+
if (handler instanceof multiElementInteractionHandler.MultiElementInteractionHandler) {
|
|
548
|
+
const disposable = handler.registerAdditionalElement(this.hostEl);
|
|
549
|
+
this.interactionDisposables = [
|
|
550
|
+
...this.interactionDisposables,
|
|
551
|
+
disposable,
|
|
552
|
+
];
|
|
553
|
+
}
|
|
554
|
+
});
|
|
555
|
+
});
|
|
556
|
+
}
|
|
520
557
|
async updateElements() {
|
|
521
558
|
const { viewport, camera } = this;
|
|
522
559
|
const worldMatrix = bundle_esm.matrix4.makeIdentity();
|