@itwin/imodel-components-react 3.1.0-dev.7 → 3.1.1
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/CHANGELOG.md +74 -0
- package/lib/cjs/imodel-components-react/color/ColorPickerButton.js +1 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerButton.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerPopup.js +1 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerPopup.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerPopup.scss +1 -0
- package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/FormatType.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/FormatType.js +3 -3
- package/lib/cjs/imodel-components-react/quantityformat/FormatType.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.js +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.js +6 -6
- package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/TimelineComponent.d.ts +0 -6
- package/lib/cjs/imodel-components-react/timeline/TimelineComponent.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js +37 -46
- package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
- package/lib/cjs/imodel-components-react/viewport/ViewportComponent.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js +10 -6
- package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
- package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.js +1 -0
- package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.js.map +1 -1
- package/lib/cjs/imodel-components-react.d.ts +0 -1
- package/lib/cjs/imodel-components-react.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react.js +0 -1
- package/lib/cjs/imodel-components-react.js.map +1 -1
- package/lib/esm/imodel-components-react/color/ColorPickerButton.js +1 -1
- package/lib/esm/imodel-components-react/color/ColorPickerButton.js.map +1 -1
- package/lib/esm/imodel-components-react/color/ColorPickerPopup.js +1 -1
- package/lib/esm/imodel-components-react/color/ColorPickerPopup.js.map +1 -1
- package/lib/esm/imodel-components-react/color/ColorPickerPopup.scss +1 -0
- package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.js +2 -2
- package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/FormatType.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/FormatType.js +4 -4
- package/lib/esm/imodel-components-react/quantityformat/FormatType.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.js +2 -2
- package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.js +7 -7
- package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js +2 -2
- package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/TimelineComponent.d.ts +0 -6
- package/lib/esm/imodel-components-react/timeline/TimelineComponent.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/timeline/TimelineComponent.js +37 -46
- package/lib/esm/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
- package/lib/esm/imodel-components-react/viewport/ViewportComponent.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/viewport/ViewportComponent.js +10 -6
- package/lib/esm/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
- package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.js +1 -0
- package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.js.map +1 -1
- package/lib/esm/imodel-components-react.d.ts +0 -1
- package/lib/esm/imodel-components-react.d.ts.map +1 -1
- package/lib/esm/imodel-components-react.js +0 -1
- package/lib/esm/imodel-components-react.js.map +1 -1
- package/package.json +21 -21
- package/lib/cjs/imodel-components-react/timeline/ContextMenu.d.ts +0 -55
- package/lib/cjs/imodel-components-react/timeline/ContextMenu.d.ts.map +0 -1
- package/lib/cjs/imodel-components-react/timeline/ContextMenu.js +0 -82
- package/lib/cjs/imodel-components-react/timeline/ContextMenu.js.map +0 -1
- package/lib/cjs/imodel-components-react/timeline/ContextMenu.scss +0 -81
- package/lib/esm/imodel-components-react/timeline/ContextMenu.d.ts +0 -55
- package/lib/esm/imodel-components-react/timeline/ContextMenu.d.ts.map +0 -1
- package/lib/esm/imodel-components-react/timeline/ContextMenu.js +0 -55
- package/lib/esm/imodel-components-react/timeline/ContextMenu.js.map +0 -1
- package/lib/esm/imodel-components-react/timeline/ContextMenu.scss +0 -81
|
@@ -26,16 +26,18 @@ export function ViewportComponent(props) {
|
|
|
26
26
|
const isMounted = React.useRef(false);
|
|
27
27
|
const viewClassFullName = React.useRef("");
|
|
28
28
|
const viewId = React.useRef("0");
|
|
29
|
+
// istanbul ignore next
|
|
29
30
|
const handleViewChanged = (vp) => {
|
|
31
|
+
// istanbul ignore next
|
|
32
|
+
if (!(vp.iModel.isOpen || vp.iModel.isBlank))
|
|
33
|
+
return;
|
|
30
34
|
ViewportComponentEvents.setViewMatrix(vp);
|
|
31
|
-
// istanbul ignore else
|
|
32
35
|
if (viewClassFullName.current !== vp.view.classFullName) {
|
|
33
36
|
setTimeout(() => {
|
|
34
37
|
ViewportComponentEvents.onViewClassFullNameChangedEvent.emit({ viewport: vp, oldName: viewClassFullName.current, newName: vp.view.classFullName });
|
|
35
38
|
viewClassFullName.current = vp.view.classFullName;
|
|
36
39
|
});
|
|
37
40
|
}
|
|
38
|
-
// istanbul ignore else
|
|
39
41
|
if (viewId.current !== vp.view.id) {
|
|
40
42
|
setTimeout(() => {
|
|
41
43
|
ViewportComponentEvents.onViewIdChangedEvent.emit({ viewport: vp, oldId: viewId.current, newId: vp.view.id });
|
|
@@ -115,13 +117,13 @@ export function ViewportComponent(props) {
|
|
|
115
117
|
const screenViewport = screenViewportRef.current;
|
|
116
118
|
if (screenViewport) {
|
|
117
119
|
const viewManager = IModelApp.viewManager;
|
|
118
|
-
viewManager.dropViewport(screenViewport, true);
|
|
119
120
|
screenViewport.onViewChanged.removeListener(handleViewChanged);
|
|
120
121
|
screenViewportRef.current = null;
|
|
121
122
|
screenViewportCreated.current = false;
|
|
122
123
|
ViewportComponentEvents.onDrawingViewportChangeEvent.removeListener(handleDrawingViewportChangeEvent);
|
|
123
124
|
ViewportComponentEvents.onCubeRotationChangeEvent.removeListener(handleCubeRotationChangeEvent);
|
|
124
125
|
ViewportComponentEvents.onStandardRotationChangeEvent.removeListener(handleStandardRotationChangeEvent);
|
|
126
|
+
viewManager.dropViewport(screenViewport, true);
|
|
125
127
|
}
|
|
126
128
|
};
|
|
127
129
|
const getScreenViewport = (parentDiv, inViewState) => {
|
|
@@ -187,9 +189,10 @@ export function ViewportComponent(props) {
|
|
|
187
189
|
else {
|
|
188
190
|
Logger.logError("ViewportComponent", `A Viewstate or a viewId and imodel must be provided`);
|
|
189
191
|
}
|
|
190
|
-
// istanbul ignore
|
|
191
|
-
if (isMounted.current)
|
|
192
|
+
// istanbul ignore next
|
|
193
|
+
if (isMounted.current && ((currentViewState === null || currentViewState === void 0 ? void 0 : currentViewState.iModel.isOpen) || (currentViewState === null || currentViewState === void 0 ? void 0 : currentViewState.iModel.isBlank))) {
|
|
192
194
|
setInitialViewState(currentViewState === null || currentViewState === void 0 ? void 0 : currentViewState.clone());
|
|
195
|
+
}
|
|
193
196
|
}
|
|
194
197
|
if (undefined === initialViewState)
|
|
195
198
|
fetchInitialViewstate(); // eslint-disable-line @typescript-eslint/no-floating-promises
|
|
@@ -200,7 +203,8 @@ export function ViewportComponent(props) {
|
|
|
200
203
|
var _a;
|
|
201
204
|
const parentDiv = viewportDiv.current;
|
|
202
205
|
const viewManager = viewManagerRef.current;
|
|
203
|
-
|
|
206
|
+
// istanbul ignore next
|
|
207
|
+
if (parentDiv && initialViewState && ((initialViewState === null || initialViewState === void 0 ? void 0 : initialViewState.iModel.isOpen) || (initialViewState === null || initialViewState === void 0 ? void 0 : initialViewState.iModel.isBlank))) {
|
|
204
208
|
if (!screenViewportCreated.current) {
|
|
205
209
|
const screenViewport = getScreenViewport(parentDiv, initialViewState);
|
|
206
210
|
screenViewportRef.current = screenViewport;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewportComponent.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/viewport/ViewportComponent.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;G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AC,WAAW,CAAC,CAAC,CAAmB,EAAE,EAAE;QAClE,CAAC,CAAC,cAAc,EAAE,CAAC;QACnB,IAAI,aAAa;YACf,aAAa,CAAC,CAAC,CAAC,CAAC;IACrB,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;IAEpB,MAAM,cAAc,GAAwB;QAC1C,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU;KACpD,CAAC;IAEF,MAAM,gBAAgB,GAAwB;QAC5C,GAAG,KAAK;QACR,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;KAC9B,CAAC;IAEF,OAAO,CACL,6BAAK,KAAK,EAAE,cAAc,kBAAgB,SAAS;QAEjD;YACE,6BACE,GAAG,EAAE,WAAW,iBACJ,oBAAoB,EAChC,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,gBAAgB,EACvB,aAAa,EAAE,iBAAiB,GAChC;YACD,WAAW,CACX,CACC,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Viewport\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { Id64String, Logger } from \"@itwin/core-bentley\";\r\nimport { Point3d, Transform } from \"@itwin/core-geometry\";\r\nimport { NpcCenter } from \"@itwin/core-common\";\r\nimport {\r\n IModelApp, IModelConnection, ScreenViewport,\r\n TentativePoint, ToolSettings, ViewManager,\r\n Viewport, ViewState,\r\n} from \"@itwin/core-frontend\";\r\n\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport {\r\n CubeRotationChangeEventArgs, DrawingViewportChangeEventArgs, StandardRotationChangeEventArgs, ViewportComponentEvents,\r\n} from \"./ViewportComponentEvents\";\r\n\r\n/** Type for a ViewState prop\r\n * @public\r\n */\r\nexport type ViewStateProp = ViewState | (() => ViewState);\r\n\r\n/**\r\n * Properties for [[ViewportComponent]] component.\r\n * @public\r\n */\r\nexport interface ViewportProps extends CommonProps {\r\n /** IModel to display */\r\n imodel: IModelConnection;\r\n /** Id of a default view definition to load as a starting point */\r\n viewDefinitionId?: Id64String;\r\n /** ViewState to use as a starting point */\r\n viewState?: ViewStateProp;\r\n /** Function to get a reference to the ScreenViewport */\r\n viewportRef?: (v: ScreenViewport) => void;\r\n /** controlId for this content component @internal */\r\n controlId?: string;\r\n /** @internal */\r\n onContextMenu?: (e: React.MouseEvent) => boolean;\r\n /** @internal */\r\n getViewOverlay?: (viewport: ScreenViewport) => React.ReactNode;\r\n /** @internal used only for testing */\r\n viewManagerOverride?: ViewManager;\r\n /** @internal used only for testing */\r\n screenViewportOverride?: typeof ScreenViewport;\r\n /** @internal used only for testing */\r\n tentativePointOverride?: TentativePoint;\r\n}\r\n\r\n/**\r\n * A viewport React component that creates a ScreenViewport.\r\n * @public\r\n */\r\nexport function ViewportComponent(props: ViewportProps) {\r\n const { viewState, imodel, viewDefinitionId, getViewOverlay, viewManagerOverride,\r\n tentativePointOverride, onContextMenu, style, className, screenViewportOverride, controlId, viewportRef } = props;\r\n // istanbul ignore next\r\n const viewManagerRef = React.useRef(viewManagerOverride ?? IModelApp.viewManager);\r\n const tentativePointOverrideRef = React.useRef(tentativePointOverride);\r\n const screenViewportCreated = React.useRef(false);\r\n const viewportDiv = React.useRef<HTMLDivElement>(null);\r\n const screenViewportRef = React.useRef<ScreenViewport | null>(null);\r\n const isMounted = React.useRef(false);\r\n const viewClassFullName = React.useRef(\"\");\r\n const viewId = React.useRef(\"0\");\r\n\r\n const handleViewChanged = (vp: Viewport) => {\r\n ViewportComponentEvents.setViewMatrix(vp);\r\n // istanbul ignore else\r\n if (viewClassFullName.current !== vp.view.classFullName) {\r\n setTimeout(() => {\r\n ViewportComponentEvents.onViewClassFullNameChangedEvent.emit({ viewport: vp, oldName: viewClassFullName.current, newName: vp.view.classFullName });\r\n viewClassFullName.current = vp.view.classFullName;\r\n });\r\n }\r\n // istanbul ignore else\r\n if (viewId.current !== vp.view.id) {\r\n setTimeout(() => {\r\n ViewportComponentEvents.onViewIdChangedEvent.emit({ viewport: vp, oldId: viewId.current, newId: vp.view.id });\r\n viewId.current = vp.view.id;\r\n });\r\n }\r\n };\r\n\r\n const handleStandardRotationChangeEvent = (args: StandardRotationChangeEventArgs) => {\r\n const viewManager = viewManagerRef.current;\r\n const currentScreenViewport = screenViewportRef.current;\r\n if (currentScreenViewport && viewManager.selectedView === currentScreenViewport) {\r\n currentScreenViewport.view.setRotationAboutPoint(ViewState.getStandardViewMatrix(args.standardRotation));\r\n currentScreenViewport.synchWithView();\r\n }\r\n };\r\n\r\n const handleDrawingViewportChangeEvent = (args: DrawingViewportChangeEventArgs) => {\r\n const viewManager = viewManagerRef.current;\r\n const currentScreenViewport = screenViewportRef.current;\r\n if (currentScreenViewport && viewManager.selectedView === currentScreenViewport) {\r\n currentScreenViewport.view.setOrigin(args.origin);\r\n currentScreenViewport.view.setRotation(args.rotation);\r\n currentScreenViewport.synchWithView({ noSaveInUndo: args.complete !== true });\r\n }\r\n };\r\n\r\n const targetPoint = React.useRef<Point3d | null>(null);\r\n\r\n const getRotatePoint = (vp: ScreenViewport): Point3d => {\r\n const lastTargetPoint = targetPoint.current;\r\n // istanbul ignore next\r\n const tentativePoint = tentativePointOverrideRef.current ?? IModelApp.tentativePoint;\r\n // istanbul ignore else\r\n if (tentativePoint.isActive)\r\n return tentativePoint.getPoint();\r\n\r\n // istanbul ignore else\r\n if (undefined !== vp.viewCmdTargetCenter) {\r\n const testPt = vp.worldToView(vp.viewCmdTargetCenter);\r\n const viewRect = vp.viewRect;\r\n if (viewRect.containsPoint(testPt))\r\n return vp.viewCmdTargetCenter;\r\n vp.viewCmdTargetCenter = undefined;\r\n }\r\n\r\n // istanbul ignore else\r\n if (null !== lastTargetPoint) {\r\n const testPt = vp.worldToView(lastTargetPoint);\r\n const viewRect = vp.viewRect.clone();\r\n viewRect.scaleAboutCenter(0.25, 0.25);\r\n // istanbul ignore next hard to reach because of mocks\r\n if (viewRect.containsPoint(testPt))\r\n return lastTargetPoint;\r\n targetPoint.current = null;\r\n }\r\n\r\n const visiblePoint = vp.pickNearestVisibleGeometry(vp.npcToWorld(NpcCenter), vp.pixelsFromInches(ToolSettings.viewToolPickRadiusInches));\r\n targetPoint.current = (undefined !== visiblePoint ? visiblePoint : vp.view.getTargetPoint());\r\n // istanbul ignore next\r\n return targetPoint.current ?? vp.view.getCenter();\r\n };\r\n\r\n const handleCubeRotationChangeEvent = (args: CubeRotationChangeEventArgs) => {\r\n const viewManager = viewManagerRef.current;\r\n const currentScreenViewport = screenViewportRef.current;\r\n // istanbul ignore else\r\n if (currentScreenViewport && viewManager.selectedView === currentScreenViewport) {\r\n const rotMatrix = args.rotMatrix;\r\n // istanbul ignore else\r\n if (currentScreenViewport.rotation !== rotMatrix) {\r\n const inverse = rotMatrix.transpose(); // rotation is from current nav cube state...\r\n const center = getRotatePoint(currentScreenViewport);\r\n const targetMatrix = inverse.multiplyMatrixMatrix(currentScreenViewport.view.getRotation());\r\n const worldTransform = Transform.createFixedPointAndMatrix(center, targetMatrix);\r\n const frustum = currentScreenViewport.getWorldFrustum();\r\n frustum.multiply(worldTransform);\r\n currentScreenViewport.view.setupFromFrustum(frustum);\r\n currentScreenViewport.synchWithView({ noSaveInUndo: !args.complete });\r\n }\r\n }\r\n };\r\n\r\n const handleDisconnectFromViewManager = () => {\r\n const screenViewport = screenViewportRef.current;\r\n if (screenViewport) {\r\n const viewManager = IModelApp.viewManager;\r\n viewManager.dropViewport(screenViewport, true);\r\n screenViewport.onViewChanged.removeListener(handleViewChanged);\r\n screenViewportRef.current = null;\r\n screenViewportCreated.current = false;\r\n\r\n ViewportComponentEvents.onDrawingViewportChangeEvent.removeListener(handleDrawingViewportChangeEvent);\r\n ViewportComponentEvents.onCubeRotationChangeEvent.removeListener(handleCubeRotationChangeEvent);\r\n ViewportComponentEvents.onStandardRotationChangeEvent.removeListener(handleStandardRotationChangeEvent);\r\n }\r\n };\r\n\r\n const getScreenViewport = (parentDiv: HTMLDivElement, inViewState: ViewState) => {\r\n // istanbul ignore next\r\n const screenViewportFactory = screenViewportOverride ? screenViewportOverride : ScreenViewport;\r\n const parentWindow = parentDiv.ownerDocument.defaultView as Window;\r\n parentWindow.addEventListener(\"beforeunload\", handleDisconnectFromViewManager, true); // listener clear after being called\r\n ViewportComponentEvents.initialize();\r\n ViewportComponentEvents.onDrawingViewportChangeEvent.addListener(handleDrawingViewportChangeEvent);\r\n ViewportComponentEvents.onCubeRotationChangeEvent.addListener(handleCubeRotationChangeEvent);\r\n ViewportComponentEvents.onStandardRotationChangeEvent.addListener(handleStandardRotationChangeEvent);\r\n const screenViewport = screenViewportFactory.create(parentDiv, inViewState);\r\n screenViewportCreated.current = true;\r\n viewClassFullName.current = screenViewport.view.classFullName;\r\n viewId.current = screenViewport.view.id;\r\n screenViewport.onViewChanged.addListener(handleViewChanged);\r\n return screenViewport;\r\n };\r\n\r\n React.useEffect(() => {\r\n isMounted.current = true;\r\n Logger.logInfo(\"ViewportComponent\", `mounting ViewportComponent for controlId=${controlId}`);\r\n\r\n return () => {\r\n isMounted.current = false;\r\n Logger.logInfo(\"ViewportComponent\", `un-mounting ViewportComponent for controlId=${controlId}`);\r\n handleDisconnectFromViewManager();\r\n };\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, []);\r\n\r\n const [initialViewState, setInitialViewState] = React.useState<ViewState | undefined>(() => {\r\n if (viewState) {\r\n if (typeof viewState === \"function\")\r\n return viewState().clone();\r\n else\r\n return viewState.clone();\r\n }\r\n return undefined;\r\n });\r\n\r\n React.useEffect(() => {\r\n setInitialViewState(undefined);\r\n }, [viewDefinitionId, viewState]);\r\n\r\n React.useEffect(() => {\r\n async function fetchInitialViewstate() {\r\n let currentViewState: ViewState | undefined;\r\n if (viewState) {\r\n if (typeof viewState === \"function\")\r\n currentViewState = viewState();\r\n else\r\n currentViewState = viewState;\r\n } else if (viewDefinitionId && imodel) {\r\n try {\r\n currentViewState = await imodel.views.load(viewDefinitionId);\r\n // istanbul ignore next\r\n if (!currentViewState) {\r\n Logger.logError(\"ViewportComponent\", `Viewstate failed to load`);\r\n }\r\n } catch (_e) {\r\n // istanbul ignore next\r\n Logger.logError(\"ViewportComponent\", `Viewstate failed to load`);\r\n }\r\n } else {\r\n Logger.logError(\"ViewportComponent\", `A Viewstate or a viewId and imodel must be provided`);\r\n }\r\n // istanbul ignore else\r\n if (isMounted.current)\r\n setInitialViewState(currentViewState?.clone());\r\n }\r\n if (undefined === initialViewState)\r\n fetchInitialViewstate(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n }, [imodel, initialViewState, viewDefinitionId, viewState]);\r\n\r\n const [viewOverlay, setViewOverlay] = React.useState<React.ReactNode>(null);\r\n\r\n // This useEffect connects to ViewManger as soon as initialViewState is available once component is mounted.\r\n React.useEffect(() => {\r\n const parentDiv = viewportDiv.current;\r\n const viewManager = viewManagerRef.current;\r\n if (parentDiv && initialViewState) {\r\n if (!screenViewportCreated.current) {\r\n const screenViewport = getScreenViewport(parentDiv, initialViewState);\r\n screenViewportRef.current = screenViewport;\r\n\r\n if (viewportRef)\r\n viewportRef(screenViewport);\r\n\r\n Logger.logInfo(\"ViewportComponent\", `processing viewManager.addViewport for controlId=${controlId}`);\r\n viewManager.addViewport(screenViewport);\r\n\r\n // overlay component is set up once a ScreenViewport is available. The overlay component must handle any view changes itself.\r\n setViewOverlay(getViewOverlay ? getViewOverlay(screenViewport) : null);\r\n } else {\r\n // istanbul ignore next\r\n screenViewportRef.current?.changeView(initialViewState);\r\n }\r\n }\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [controlId, initialViewState, viewportRef]);\r\n\r\n const handleContextMenu = React.useCallback((e: React.MouseEvent) => {\r\n e.preventDefault();\r\n if (onContextMenu)\r\n onContextMenu(e);\r\n }, [onContextMenu]);\r\n\r\n const parentDivStyle: React.CSSProperties = {\r\n height: \"100%\", width: \"100%\", position: \"relative\",\r\n };\r\n\r\n const viewportDivStyle: React.CSSProperties = {\r\n ...style,\r\n height: \"100%\", width: \"100%\",\r\n };\r\n\r\n return (\r\n <div style={parentDivStyle} data-item-id={controlId}\r\n >\r\n <>\r\n <div\r\n ref={viewportDiv}\r\n data-testid=\"viewport-component\"\r\n className={className}\r\n style={viewportDivStyle}\r\n onContextMenu={handleContextMenu}\r\n />\r\n {viewOverlay}\r\n </>\r\n </div>\r\n );\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"ViewportComponent.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/viewport/ViewportComponent.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAc,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAW,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EACL,SAAS,EAAoB,cAAc,EAC3B,YAAY,EAClB,SAAS,GACpB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACyF,uBAAuB,GACtH,MAAM,2BAA2B,CAAC;AAkCnC;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAoB;IACpD,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,gBAAgB,EAAE,cAAc,EAAE,mBAAmB,EAC9E,sBAAsB,EAAE,aAAa,EAAE,KAAK,EAAE,SAAS,EAAE,sBAAsB,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC;IACpH,uBAAuB;IACvB,MAAM,cAAc,GAAG,KAAK,CAAC,MAAM,CAAC,mBAAmB,aAAnB,mBAAmB,cAAnB,mBAAmB,GAAI,SAAS,CAAC,WAAW,CAAC,CAAC;IAClF,MAAM,yBAAyB,GAAG,KA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AEF,MAAM,gBAAgB,GAAwB;QAC5C,GAAG,KAAK;QACR,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;KAC9B,CAAC;IAEF,OAAO,CACL,6BAAK,KAAK,EAAE,cAAc,kBAAgB,SAAS;QAEjD;YACE,6BACE,GAAG,EAAE,WAAW,iBACJ,oBAAoB,EAChC,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,gBAAgB,EACvB,aAAa,EAAE,iBAAiB,GAChC;YACD,WAAW,CACX,CACC,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Viewport\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { Id64String, Logger } from \"@itwin/core-bentley\";\r\nimport { Point3d, Transform } from \"@itwin/core-geometry\";\r\nimport { NpcCenter } from \"@itwin/core-common\";\r\nimport {\r\n IModelApp, IModelConnection, ScreenViewport,\r\n TentativePoint, ToolSettings, ViewManager,\r\n Viewport, ViewState,\r\n} from \"@itwin/core-frontend\";\r\n\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport {\r\n CubeRotationChangeEventArgs, DrawingViewportChangeEventArgs, StandardRotationChangeEventArgs, ViewportComponentEvents,\r\n} from \"./ViewportComponentEvents\";\r\n\r\n/** Type for a ViewState prop\r\n * @public\r\n */\r\nexport type ViewStateProp = ViewState | (() => ViewState);\r\n\r\n/**\r\n * Properties for [[ViewportComponent]] component.\r\n * @public\r\n */\r\nexport interface ViewportProps extends CommonProps {\r\n /** IModel to display */\r\n imodel: IModelConnection;\r\n /** Id of a default view definition to load as a starting point */\r\n viewDefinitionId?: Id64String;\r\n /** ViewState to use as a starting point */\r\n viewState?: ViewStateProp;\r\n /** Function to get a reference to the ScreenViewport */\r\n viewportRef?: (v: ScreenViewport) => void;\r\n /** controlId for this content component @internal */\r\n controlId?: string;\r\n /** @internal */\r\n onContextMenu?: (e: React.MouseEvent) => boolean;\r\n /** @internal */\r\n getViewOverlay?: (viewport: ScreenViewport) => React.ReactNode;\r\n /** @internal used only for testing */\r\n viewManagerOverride?: ViewManager;\r\n /** @internal used only for testing */\r\n screenViewportOverride?: typeof ScreenViewport;\r\n /** @internal used only for testing */\r\n tentativePointOverride?: TentativePoint;\r\n}\r\n\r\n/**\r\n * A viewport React component that creates a ScreenViewport.\r\n * @public\r\n */\r\nexport function ViewportComponent(props: ViewportProps) {\r\n const { viewState, imodel, viewDefinitionId, getViewOverlay, viewManagerOverride,\r\n tentativePointOverride, onContextMenu, style, className, screenViewportOverride, controlId, viewportRef } = props;\r\n // istanbul ignore next\r\n const viewManagerRef = React.useRef(viewManagerOverride ?? IModelApp.viewManager);\r\n const tentativePointOverrideRef = React.useRef(tentativePointOverride);\r\n const screenViewportCreated = React.useRef(false);\r\n const viewportDiv = React.useRef<HTMLDivElement>(null);\r\n const screenViewportRef = React.useRef<ScreenViewport | null>(null);\r\n const isMounted = React.useRef(false);\r\n const viewClassFullName = React.useRef(\"\");\r\n const viewId = React.useRef(\"0\");\r\n\r\n // istanbul ignore next\r\n const handleViewChanged = (vp: Viewport) => {\r\n // istanbul ignore next\r\n if (!(vp.iModel.isOpen || vp.iModel.isBlank))\r\n return;\r\n ViewportComponentEvents.setViewMatrix(vp);\r\n if (viewClassFullName.current !== vp.view.classFullName) {\r\n setTimeout(() => {\r\n ViewportComponentEvents.onViewClassFullNameChangedEvent.emit({ viewport: vp, oldName: viewClassFullName.current, newName: vp.view.classFullName });\r\n viewClassFullName.current = vp.view.classFullName;\r\n });\r\n }\r\n if (viewId.current !== vp.view.id) {\r\n setTimeout(() => {\r\n ViewportComponentEvents.onViewIdChangedEvent.emit({ viewport: vp, oldId: viewId.current, newId: vp.view.id });\r\n viewId.current = vp.view.id;\r\n });\r\n }\r\n };\r\n\r\n const handleStandardRotationChangeEvent = (args: StandardRotationChangeEventArgs) => {\r\n const viewManager = viewManagerRef.current;\r\n const currentScreenViewport = screenViewportRef.current;\r\n if (currentScreenViewport && viewManager.selectedView === currentScreenViewport) {\r\n currentScreenViewport.view.setRotationAboutPoint(ViewState.getStandardViewMatrix(args.standardRotation));\r\n currentScreenViewport.synchWithView();\r\n }\r\n };\r\n\r\n const handleDrawingViewportChangeEvent = (args: DrawingViewportChangeEventArgs) => {\r\n const viewManager = viewManagerRef.current;\r\n const currentScreenViewport = screenViewportRef.current;\r\n if (currentScreenViewport && viewManager.selectedView === currentScreenViewport) {\r\n currentScreenViewport.view.setOrigin(args.origin);\r\n currentScreenViewport.view.setRotation(args.rotation);\r\n currentScreenViewport.synchWithView({ noSaveInUndo: args.complete !== true });\r\n }\r\n };\r\n\r\n const targetPoint = React.useRef<Point3d | null>(null);\r\n\r\n const getRotatePoint = (vp: ScreenViewport): Point3d => {\r\n const lastTargetPoint = targetPoint.current;\r\n // istanbul ignore next\r\n const tentativePoint = tentativePointOverrideRef.current ?? IModelApp.tentativePoint;\r\n // istanbul ignore else\r\n if (tentativePoint.isActive)\r\n return tentativePoint.getPoint();\r\n\r\n // istanbul ignore else\r\n if (undefined !== vp.viewCmdTargetCenter) {\r\n const testPt = vp.worldToView(vp.viewCmdTargetCenter);\r\n const viewRect = vp.viewRect;\r\n if (viewRect.containsPoint(testPt))\r\n return vp.viewCmdTargetCenter;\r\n vp.viewCmdTargetCenter = undefined;\r\n }\r\n\r\n // istanbul ignore else\r\n if (null !== lastTargetPoint) {\r\n const testPt = vp.worldToView(lastTargetPoint);\r\n const viewRect = vp.viewRect.clone();\r\n viewRect.scaleAboutCenter(0.25, 0.25);\r\n // istanbul ignore next hard to reach because of mocks\r\n if (viewRect.containsPoint(testPt))\r\n return lastTargetPoint;\r\n targetPoint.current = null;\r\n }\r\n\r\n const visiblePoint = vp.pickNearestVisibleGeometry(vp.npcToWorld(NpcCenter), vp.pixelsFromInches(ToolSettings.viewToolPickRadiusInches));\r\n targetPoint.current = (undefined !== visiblePoint ? visiblePoint : vp.view.getTargetPoint());\r\n // istanbul ignore next\r\n return targetPoint.current ?? vp.view.getCenter();\r\n };\r\n\r\n const handleCubeRotationChangeEvent = (args: CubeRotationChangeEventArgs) => {\r\n const viewManager = viewManagerRef.current;\r\n const currentScreenViewport = screenViewportRef.current;\r\n // istanbul ignore else\r\n if (currentScreenViewport && viewManager.selectedView === currentScreenViewport) {\r\n const rotMatrix = args.rotMatrix;\r\n // istanbul ignore else\r\n if (currentScreenViewport.rotation !== rotMatrix) {\r\n const inverse = rotMatrix.transpose(); // rotation is from current nav cube state...\r\n const center = getRotatePoint(currentScreenViewport);\r\n const targetMatrix = inverse.multiplyMatrixMatrix(currentScreenViewport.view.getRotation());\r\n const worldTransform = Transform.createFixedPointAndMatrix(center, targetMatrix);\r\n const frustum = currentScreenViewport.getWorldFrustum();\r\n frustum.multiply(worldTransform);\r\n currentScreenViewport.view.setupFromFrustum(frustum);\r\n currentScreenViewport.synchWithView({ noSaveInUndo: !args.complete });\r\n }\r\n }\r\n };\r\n\r\n const handleDisconnectFromViewManager = () => {\r\n const screenViewport = screenViewportRef.current;\r\n if (screenViewport) {\r\n const viewManager = IModelApp.viewManager;\r\n screenViewport.onViewChanged.removeListener(handleViewChanged);\r\n screenViewportRef.current = null;\r\n screenViewportCreated.current = false;\r\n ViewportComponentEvents.onDrawingViewportChangeEvent.removeListener(handleDrawingViewportChangeEvent);\r\n ViewportComponentEvents.onCubeRotationChangeEvent.removeListener(handleCubeRotationChangeEvent);\r\n ViewportComponentEvents.onStandardRotationChangeEvent.removeListener(handleStandardRotationChangeEvent);\r\n viewManager.dropViewport(screenViewport, true);\r\n }\r\n };\r\n\r\n const getScreenViewport = (parentDiv: HTMLDivElement, inViewState: ViewState) => {\r\n // istanbul ignore next\r\n const screenViewportFactory = screenViewportOverride ? screenViewportOverride : ScreenViewport;\r\n const parentWindow = parentDiv.ownerDocument.defaultView as Window;\r\n parentWindow.addEventListener(\"beforeunload\", handleDisconnectFromViewManager, true); // listener clear after being called\r\n ViewportComponentEvents.initialize();\r\n ViewportComponentEvents.onDrawingViewportChangeEvent.addListener(handleDrawingViewportChangeEvent);\r\n ViewportComponentEvents.onCubeRotationChangeEvent.addListener(handleCubeRotationChangeEvent);\r\n ViewportComponentEvents.onStandardRotationChangeEvent.addListener(handleStandardRotationChangeEvent);\r\n const screenViewport = screenViewportFactory.create(parentDiv, inViewState);\r\n screenViewportCreated.current = true;\r\n viewClassFullName.current = screenViewport.view.classFullName;\r\n viewId.current = screenViewport.view.id;\r\n screenViewport.onViewChanged.addListener(handleViewChanged);\r\n return screenViewport;\r\n };\r\n\r\n React.useEffect(() => {\r\n isMounted.current = true;\r\n Logger.logInfo(\"ViewportComponent\", `mounting ViewportComponent for controlId=${controlId}`);\r\n\r\n return () => {\r\n isMounted.current = false;\r\n Logger.logInfo(\"ViewportComponent\", `un-mounting ViewportComponent for controlId=${controlId}`);\r\n handleDisconnectFromViewManager();\r\n };\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, []);\r\n\r\n const [initialViewState, setInitialViewState] = React.useState<ViewState | undefined>(() => {\r\n if (viewState) {\r\n if (typeof viewState === \"function\")\r\n return viewState().clone();\r\n else\r\n return viewState.clone();\r\n }\r\n return undefined;\r\n });\r\n\r\n React.useEffect(() => {\r\n setInitialViewState(undefined);\r\n }, [viewDefinitionId, viewState]);\r\n React.useEffect(() => {\r\n async function fetchInitialViewstate() {\r\n let currentViewState: ViewState | undefined;\r\n if (viewState) {\r\n if (typeof viewState === \"function\")\r\n currentViewState = viewState();\r\n else\r\n currentViewState = viewState;\r\n } else if (viewDefinitionId && imodel) {\r\n try {\r\n currentViewState = await imodel.views.load(viewDefinitionId);\r\n // istanbul ignore next\r\n if (!currentViewState) {\r\n Logger.logError(\"ViewportComponent\", `Viewstate failed to load`);\r\n }\r\n } catch (_e) {\r\n // istanbul ignore next\r\n Logger.logError(\"ViewportComponent\", `Viewstate failed to load`);\r\n }\r\n } else {\r\n Logger.logError(\"ViewportComponent\", `A Viewstate or a viewId and imodel must be provided`);\r\n }\r\n // istanbul ignore next\r\n if (isMounted.current && (currentViewState?.iModel.isOpen || currentViewState?.iModel.isBlank)) {\r\n setInitialViewState(currentViewState?.clone());\r\n }\r\n }\r\n if (undefined === initialViewState)\r\n fetchInitialViewstate(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n }, [imodel, initialViewState, viewDefinitionId, viewState]);\r\n\r\n const [viewOverlay, setViewOverlay] = React.useState<React.ReactNode>(null);\r\n\r\n // This useEffect connects to ViewManger as soon as initialViewState is available once component is mounted.\r\n React.useEffect(() => {\r\n const parentDiv = viewportDiv.current;\r\n const viewManager = viewManagerRef.current;\r\n // istanbul ignore next\r\n if (parentDiv && initialViewState && (initialViewState?.iModel.isOpen || initialViewState?.iModel.isBlank) ) {\r\n if (!screenViewportCreated.current) {\r\n const screenViewport = getScreenViewport(parentDiv, initialViewState);\r\n screenViewportRef.current = screenViewport;\r\n\r\n if (viewportRef)\r\n viewportRef(screenViewport);\r\n\r\n Logger.logInfo(\"ViewportComponent\", `processing viewManager.addViewport for controlId=${controlId}`);\r\n viewManager.addViewport(screenViewport);\r\n\r\n // overlay component is set up once a ScreenViewport is available. The overlay component must handle any view changes itself.\r\n setViewOverlay(getViewOverlay ? getViewOverlay(screenViewport) : null);\r\n } else {\r\n // istanbul ignore next\r\n screenViewportRef.current?.changeView(initialViewState);\r\n }\r\n }\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [controlId, initialViewState, viewportRef]);\r\n\r\n const handleContextMenu = React.useCallback((e: React.MouseEvent) => {\r\n e.preventDefault();\r\n if (onContextMenu)\r\n onContextMenu(e);\r\n }, [onContextMenu]);\r\n\r\n const parentDivStyle: React.CSSProperties = {\r\n height: \"100%\", width: \"100%\", position: \"relative\",\r\n };\r\n\r\n const viewportDivStyle: React.CSSProperties = {\r\n ...style,\r\n height: \"100%\", width: \"100%\",\r\n };\r\n\r\n return (\r\n <div style={parentDivStyle} data-item-id={controlId}\r\n >\r\n <>\r\n <div\r\n ref={viewportDiv}\r\n data-testid=\"viewport-component\"\r\n className={className}\r\n style={viewportDivStyle}\r\n onContextMenu={handleContextMenu}\r\n />\r\n {viewOverlay}\r\n </>\r\n </div>\r\n );\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewportComponentEvents.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/viewport/ViewportComponentEvents.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAA0C,cAAc,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACxG,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,EAAE,QAAQ,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,qBAAa,0BAA2B,SAAQ,OAAO,CAAC,8BAA8B,CAAC;CAAI;AAE3F;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,SAAS,EAAE,QAAQ,CAAC;IACpB,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,OAAO,CAAC,2BAA2B,CAAC;CAAI;AAErF;;GAEG;AACH,MAAM,WAAW,+BAA+B;IAC9C,gBAAgB,EAAE,cAAc,CAAC;CAClC;AAED;;GAEG;AACH,qBAAa,2BAA4B,SAAQ,OAAO,CAAC,+BAA+B,CAAC;CAAI;AAE7F;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,EAAE,QAAQ,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,cAAc,GAAG,IAAI;WAI3D,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"ViewportComponentEvents.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/viewport/ViewportComponentEvents.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAA0C,cAAc,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACxG,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,EAAE,QAAQ,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,qBAAa,0BAA2B,SAAQ,OAAO,CAAC,8BAA8B,CAAC;CAAI;AAE3F;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,SAAS,EAAE,QAAQ,CAAC;IACpB,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,OAAO,CAAC,2BAA2B,CAAC;CAAI;AAErF;;GAEG;AACH,MAAM,WAAW,+BAA+B;IAC9C,gBAAgB,EAAE,cAAc,CAAC;CAClC;AAED;;GAEG;AACH,qBAAa,2BAA4B,SAAQ,OAAO,CAAC,+BAA+B,CAAC;CAAI;AAE7F;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,EAAE,QAAQ,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,OAAO,CAAC,2BAA2B,CAAC;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
@@ -73,6 +73,7 @@ export class ViewportComponentEvents {
|
|
|
73
73
|
static setViewMatrix(viewport, animationTime) {
|
|
74
74
|
// When handling onViewChanged, use setTimeout
|
|
75
75
|
setTimeout(() => {
|
|
76
|
+
// istanbul ignore next
|
|
76
77
|
if (viewport.view) {
|
|
77
78
|
this.origin.setFrom(viewport.view.getOrigin());
|
|
78
79
|
this.extents.setFrom(viewport.view.getExtents());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewportComponentEvents.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/viewport/ViewportComponentEvents.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAyD,MAAM,sBAAsB,CAAC;AACxG,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAW9C;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ,OAAuC;CAAI;AAW3F;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,OAAoC;CAAI;AASrF;;GAEG;AACH,MAAM,OAAO,2BAA4B,SAAQ,OAAwC;CAAI;AAU7F;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,OAAoC;CAAI;AAWrF;;GAEG;AACH,MAAM,OAAO,6BAA8B,SAAQ,OAA0C;CAAI;AAWjG;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,OAA+B;CAAI;AAE3E;;GAEG;AACH,MAAM,OAAO,uBAAuB;IAG3B,MAAM,CAAC,UAAU;QACtB,IAAI,SAAS,KAAK,IAAI,CAAC,eAAe;YACpC,OAAO;QAET,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC,WAAW,CAAC,yBAAyB,CAAC,WAAW,CAAC,uBAAuB,CAAC,6BAA6B,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AAQ,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;aAClD;YACD,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YAE/C,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC,CAAC;QACnE,CAAC,CAAC,CAAC;IACL,CAAC;;
|
|
1
|
+
{"version":3,"file":"ViewportComponentEvents.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/viewport/ViewportComponentEvents.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAyD,MAAM,sBAAsB,CAAC;AACxG,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAW9C;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ,OAAuC;CAAI;AAW3F;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,OAAoC;CAAI;AASrF;;GAEG;AACH,MAAM,OAAO,2BAA4B,SAAQ,OAAwC;CAAI;AAU7F;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,OAAoC;CAAI;AAWrF;;GAEG;AACH,MAAM,OAAO,6BAA8B,SAAQ,OAA0C;CAAI;AAWjG;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,OAA+B;CAAI;AAE3E;;GAEG;AACH,MAAM,OAAO,uBAAuB;IAG3B,MAAM,CAAC,UAAU;QACtB,IAAI,SAAS,KAAK,IAAI,CAAC,eAAe;YACpC,OAAO;QAET,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC,WAAW,CAAC,yBAAyB,CAAC,WAAW,CAAC,uBAAuB,CAAC,6BAA6B,CAAC,CAAC;IAC5I,CAAC;IA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AAI,CAAC,UAAU,EAAE,CAAC,CAAC;aAClD;YACD,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YAE/C,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC,CAAC;QACnE,CAAC,CAAC,CAAC;IACL,CAAC;;AA1Ca,4BAAI,GAAG,IAAI,CAAC,IAAI,CAAC;AACR,8BAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;AAC9B,+BAAO,GAAG,QAAQ,CAAC,UAAU,EAAE,CAAC;AAChC,sCAAc,GAAG,QAAQ,CAAC,cAAc,EAAE,CAAC;AAC3C,oDAA4B,GAAG,IAAI,0BAA0B,EAAE,CAAC;AAChE,iDAAyB,GAAG,IAAI,uBAAuB,EAAE,CAAC;AAC1D,qDAA6B,GAAG,IAAI,2BAA2B,EAAE,CAAC;AAClE,iDAAyB,GAAG,IAAI,uBAAuB,EAAE,CAAC;AAC1D,uDAA+B,GAAG,IAAI,6BAA6B,EAAE,CAAC;AACtE,4CAAoB,GAAG,IAAI,kBAAkB,EAAE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Viewport\r\n */\r\n\r\nimport { Matrix3d, Point3d, Vector3d } from \"@itwin/core-geometry\";\r\nimport { IModelApp, SelectedViewportChangedArgs, StandardViewId, Viewport } from \"@itwin/core-frontend\";\r\nimport { UiEvent } from \"@itwin/appui-abstract\";\r\nimport { Face } from \"../navigationaids/Cube\";\r\n\r\n/** Arguments for [[DrawingViewportChangeEvent]]\r\n * @public\r\n */\r\nexport interface DrawingViewportChangeEventArgs {\r\n rotation: Matrix3d;\r\n origin: Point3d;\r\n complete: boolean;\r\n}\r\n\r\n/** Drawing View Change event\r\n * @public\r\n */\r\nexport class DrawingViewportChangeEvent extends UiEvent<DrawingViewportChangeEventArgs> { }\r\n\r\n/** Arguments for [[CubeRotationChangeEvent]]\r\n * @public\r\n */\r\nexport interface CubeRotationChangeEventArgs {\r\n rotMatrix: Matrix3d;\r\n face: Face;\r\n complete?: boolean;\r\n}\r\n\r\n/** 3d Cube Rotation Change event\r\n * @public\r\n */\r\nexport class CubeRotationChangeEvent extends UiEvent<CubeRotationChangeEventArgs> { }\r\n\r\n/** Arguments for [[StandardRotationChangeEvent]]\r\n * @public\r\n */\r\nexport interface StandardRotationChangeEventArgs {\r\n standardRotation: StandardViewId;\r\n}\r\n\r\n/** Standard Rotation Change event\r\n * @public\r\n */\r\nexport class StandardRotationChangeEvent extends UiEvent<StandardRotationChangeEventArgs> { }\r\n\r\n/** Arguments for [[ViewRotationChangeEvent]]\r\n * @public\r\n */\r\nexport interface ViewRotationChangeEventArgs {\r\n viewport: Viewport;\r\n animationTime?: number;\r\n}\r\n\r\n/** View Rotation Change event\r\n * @public\r\n */\r\nexport class ViewRotationChangeEvent extends UiEvent<ViewRotationChangeEventArgs> { }\r\n\r\n/** Arguments for [[ViewClassFullNameChangedEvent]]\r\n * @public\r\n */\r\nexport interface ViewClassFullNameChangedEventArgs {\r\n viewport: Viewport;\r\n oldName: string;\r\n newName: string;\r\n}\r\n\r\n/** View Class Full Name Change event\r\n * @public\r\n */\r\nexport class ViewClassFullNameChangedEvent extends UiEvent<ViewClassFullNameChangedEventArgs> { }\r\n\r\n/** Arguments for [[ViewIdChangedEvent]]\r\n * @public\r\n */\r\nexport interface ViewIdChangedEventArgs {\r\n viewport: Viewport;\r\n oldId: string;\r\n newId: string;\r\n}\r\n\r\n/** View Id Change event\r\n * @public\r\n */\r\nexport class ViewIdChangedEvent extends UiEvent<ViewIdChangedEventArgs> { }\r\n\r\n/** Viewport Rotation events and methods\r\n * @public\r\n */\r\nexport class ViewportComponentEvents {\r\n private static _removeListener?: () => void;\r\n\r\n public static initialize() {\r\n if (undefined !== this._removeListener)\r\n return;\r\n\r\n this._removeListener = IModelApp.viewManager.onSelectedViewportChanged.addListener(ViewportComponentEvents.handleSelectedViewportChanged);\r\n }\r\n\r\n /** @internal - for unit testing */\r\n public static terminate() {\r\n if (this._removeListener) {\r\n this._removeListener();\r\n this._removeListener = undefined;\r\n }\r\n }\r\n\r\n public static face = Face.None;\r\n public static readonly origin = Point3d.createZero();\r\n public static readonly extents = Vector3d.createZero();\r\n public static readonly rotationMatrix = Matrix3d.createIdentity();\r\n public static readonly onDrawingViewportChangeEvent = new DrawingViewportChangeEvent();\r\n public static readonly onCubeRotationChangeEvent = new CubeRotationChangeEvent();\r\n public static readonly onStandardRotationChangeEvent = new StandardRotationChangeEvent();\r\n public static readonly onViewRotationChangeEvent = new ViewRotationChangeEvent();\r\n public static readonly onViewClassFullNameChangedEvent = new ViewClassFullNameChangedEvent();\r\n public static readonly onViewIdChangedEvent = new ViewIdChangedEvent();\r\n\r\n private static handleSelectedViewportChanged(args: SelectedViewportChangedArgs): void {\r\n if (args.current)\r\n ViewportComponentEvents.setViewMatrix(args.current);\r\n }\r\n\r\n public static setCubeMatrix(rotMatrix: Matrix3d, face = Face.None, complete: boolean = false): void {\r\n this.rotationMatrix.setFrom(rotMatrix);\r\n this.face = face;\r\n this.onCubeRotationChangeEvent.emit({ rotMatrix, complete, face });\r\n }\r\n\r\n public static setDrawingViewportState(origin: Point3d, rotation: Matrix3d, complete: boolean = false): void {\r\n this.onDrawingViewportChangeEvent.emit({ origin, rotation, complete });\r\n }\r\n\r\n public static setStandardRotation(standardRotation: StandardViewId): void {\r\n this.onStandardRotationChangeEvent.emit({ standardRotation });\r\n }\r\n\r\n public static setViewMatrix(viewport: Viewport, animationTime?: number): void {\r\n // When handling onViewChanged, use setTimeout\r\n setTimeout(() => {\r\n // istanbul ignore next\r\n if (viewport.view) {\r\n this.origin.setFrom(viewport.view.getOrigin());\r\n this.extents.setFrom(viewport.view.getExtents());\r\n }\r\n this.rotationMatrix.setFrom(viewport.rotation);\r\n\r\n this.onViewRotationChangeEvent.emit({ viewport, animationTime });\r\n });\r\n }\r\n}\r\n"]}
|
|
@@ -27,7 +27,6 @@ export * from "./imodel-components-react/quantityformat/MiscFormatOptions";
|
|
|
27
27
|
export * from "./imodel-components-react/quantityformat/QuantityFormatPanel";
|
|
28
28
|
export * from "./imodel-components-react/timeline/interfaces";
|
|
29
29
|
export * from "./imodel-components-react/timeline/BaseTimelineDataProvider";
|
|
30
|
-
export * from "./imodel-components-react/timeline/ContextMenu";
|
|
31
30
|
export * from "./imodel-components-react/timeline/InlineEdit";
|
|
32
31
|
export * from "./imodel-components-react/timeline/PlayerButton";
|
|
33
32
|
export * from "./imodel-components-react/timeline/Scrubber";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imodel-components-react.d.ts","sourceRoot":"","sources":["../../src/imodel-components-react.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAElF,cAAc,6CAA6C,CAAC;AAC5D,cAAc,mDAAmD,CAAC;AAClE,cAAc,mDAAmD,CAAC;AAClE,cAAc,kDAAkD,CAAC;AACjE,cAAc,kDAAkD,CAAC;AACjE,cAAc,oDAAoD,CAAC;AACnE,cAAc,2CAA2C,CAAC;AAC1D,cAAc,kDAAkD,CAAC;AACjE,cAAc,wCAAwC,CAAC;AAEvD,cAAc,+CAA+C,CAAC;AAC9D,cAAc,gDAAgD,CAAC;AAE/D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,sDAAsD,CAAC;AAErE,cAAc,6CAA6C,CAAC;AAC5D,cAAc,yDAAyD,CAAC;AAExE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,4DAA4D,CAAC;AAC3E,cAAc,+DAA+D,CAAC;AAE9E,cAAc,sDAAsD,CAAC;AACrE,cAAc,0DAA0D,CAAC;AACzE,cAAc,uDAAuD,CAAC;AACtE,cAAc,qDAAqD,CAAC;AACpE,cAAc,0DAA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sDAAsD,CAAC;AACrE,cAAc,4DAA4D,CAAC;AAE3E;;;;GAIG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG"}
|
|
@@ -32,7 +32,6 @@ export * from "./imodel-components-react/quantityformat/MiscFormatOptions";
|
|
|
32
32
|
export * from "./imodel-components-react/quantityformat/QuantityFormatPanel";
|
|
33
33
|
export * from "./imodel-components-react/timeline/interfaces";
|
|
34
34
|
export * from "./imodel-components-react/timeline/BaseTimelineDataProvider";
|
|
35
|
-
export * from "./imodel-components-react/timeline/ContextMenu";
|
|
36
35
|
export * from "./imodel-components-react/timeline/InlineEdit";
|
|
37
36
|
export * from "./imodel-components-react/timeline/PlayerButton";
|
|
38
37
|
export * from "./imodel-components-react/timeline/Scrubber";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imodel-components-react.js","sourceRoot":"","sources":["../../src/imodel-components-react.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,qEAAqE;AAErE,OAAO,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAElF,cAAc,6CAA6C,CAAC;AAC5D,cAAc,mDAAmD,CAAC;AAClE,cAAc,mDAAmD,CAAC;AAClE,cAAc,kDAAkD,CAAC;AACjE,cAAc,kDAAkD,CAAC;AACjE,cAAc,oDAAoD,CAAC;AACnE,cAAc,2CAA2C,CAAC;AAC1D,cAAc,kDAAkD,CAAC;AACjE,cAAc,wCAAwC,CAAC;AAEvD,cAAc,+CAA+C,CAAC;AAC9D,cAAc,gDAAgD,CAAC;AAE/D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,sDAAsD,CAAC;AAErE,cAAc,6CAA6C,CAAC;AAC5D,cAAc,yDAAyD,CAAC;AAExE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,4DAA4D,CAAC;AAC3E,cAAc,+DAA+D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AA+C,CAAC;AAC9D,cAAc,iDAAiD,CAAC;AAChE,cAAc,6CAA6C,CAAC;AAC5D,cAAc,sDAAsD,CAAC;AACrE,cAAc,kDAAkD,CAAC;AACjE,cAAc,0DAA0D,CAAC;AAEzE,cAAc,sDAAsD,CAAC;AACrE,cAAc,4DAA4D,CAAC;AAE3E;;;;GAIG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n// cSpell:ignore iconpicker lineweight hocs datepicker quantityformat\r\n\r\nexport { UiIModelComponents } from \"./imodel-components-react/UiIModelComponents\";\r\n\r\nexport * from \"./imodel-components-react/color/AlphaSlider\";\r\nexport * from \"./imodel-components-react/color/ColorPickerButton\";\r\nexport * from \"./imodel-components-react/color/ColorPickerDialog\";\r\nexport * from \"./imodel-components-react/color/ColorPickerPanel\";\r\nexport * from \"./imodel-components-react/color/ColorPickerPopup\";\r\nexport * from \"./imodel-components-react/color/getCSSColorFromDef\";\r\nexport * from \"./imodel-components-react/color/HueSlider\";\r\nexport * from \"./imodel-components-react/color/SaturationPicker\";\r\nexport * from \"./imodel-components-react/color/Swatch\";\r\n\r\nexport * from \"./imodel-components-react/editors/ColorEditor\";\r\nexport * from \"./imodel-components-react/editors/WeightEditor\";\r\n\r\nexport * from \"./imodel-components-react/inputs/QuantityInput\";\r\nexport * from \"./imodel-components-react/inputs/QuantityNumberInput\";\r\n\r\nexport * from \"./imodel-components-react/lineweight/Swatch\";\r\nexport * from \"./imodel-components-react/lineweight/WeightPickerButton\";\r\n\r\nexport * from \"./imodel-components-react/navigationaids/Cube\";\r\nexport * from \"./imodel-components-react/navigationaids/CubeNavigationAid\";\r\nexport * from \"./imodel-components-react/navigationaids/DrawingNavigationAid\";\r\n\r\nexport * from \"./imodel-components-react/quantityformat/FormatPanel\";\r\nexport * from \"./imodel-components-react/quantityformat/FormatPrecision\";\r\nexport * from \"./imodel-components-react/quantityformat/FormatSample\";\r\nexport * from \"./imodel-components-react/quantityformat/FormatType\";\r\nexport * from \"./imodel-components-react/quantityformat/FormatUnitLabel\";\r\nexport * from \"./imodel-components-react/quantityformat/FormatUnits\";\r\nexport * from \"./imodel-components-react/quantityformat/MiscFormatOptions\";\r\nexport * from \"./imodel-components-react/quantityformat/QuantityFormatPanel\";\r\n\r\nexport * from \"./imodel-components-react/timeline/interfaces\";\r\nexport * from \"./imodel-components-react/timeline/BaseTimelineDataProvider\";\r\nexport * from \"./imodel-components-react/timeline/InlineEdit\";\r\nexport * from \"./imodel-components-react/timeline/PlayerButton\";\r\nexport * from \"./imodel-components-react/timeline/Scrubber\";\r\nexport * from \"./imodel-components-react/timeline/TimelineComponent\";\r\nexport * from \"./imodel-components-react/timeline/SolarTimeline\";\r\nexport * from \"./imodel-components-react/timeline/BaseSolarDataProvider\";\r\n\r\nexport * from \"./imodel-components-react/viewport/ViewportComponent\";\r\nexport * from \"./imodel-components-react/viewport/ViewportComponentEvents\";\r\n\r\n/** @docs-package-description\r\n * The imodel-components-react package contains React components that depend on the core-frontend, core-common or core-quantity packages.\r\n * The components pertain to Color, Cube, LineWeight, Navigation Aids, Quantity Inputs, Timeline and Viewport.\r\n * For more information, see [learning about imodel-components-react]($docs/learning/ui/imodel-components/index.md).\r\n */\r\n/**\r\n * @docs-group-description Color\r\n * Classes and components for working with and picking a Color.\r\n */\r\n/**\r\n * @docs-group-description Common\r\n * Common classes used across various UI components.\r\n */\r\n/**\r\n * @docs-group-description Cube\r\n * Component for 3D Cube.\r\n */\r\n/**\r\n * @docs-group-description Inputs\r\n * Input Components that format and parse input for IModelApps.\r\n */\r\n/**\r\n * @docs-group-description LineWeight\r\n * Classes and components for working with and picking a Line Weight.\r\n */\r\n/**\r\n * @docs-group-description NavigationAids\r\n * Classes and components for working with Navigation Aids.\r\n */\r\n/**\r\n * @docs-group-description PropertyEditors\r\n * Classes and components for working with Property Editors.\r\n */\r\n/**\r\n * @docs-group-description QuantityFormat\r\n * Classes and components for working with a Quantity Formats.\r\n */\r\n/**\r\n * @docs-group-description Timeline\r\n * Classes and components that provide a timeline\r\n */\r\n/**\r\n * @docs-group-description Viewport\r\n * Classes and components for working with a Viewport.\r\n */\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/imodel-components-react",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"description": "iTwin.js UI IModel Components",
|
|
5
5
|
"main": "lib/cjs/imodel-components-react.js",
|
|
6
6
|
"module": "lib/esm/imodel-components-react.js",
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
"url": "http://www.bentley.com"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"@itwin/appui-abstract": "^3.1.
|
|
25
|
-
"@itwin/components-react": "^3.1.
|
|
26
|
-
"@itwin/core-bentley": "^3.1.
|
|
27
|
-
"@itwin/core-common": "^3.1.
|
|
28
|
-
"@itwin/core-frontend": "^3.1.
|
|
29
|
-
"@itwin/core-geometry": "^3.1.
|
|
30
|
-
"@itwin/core-quantity": "^3.1.
|
|
31
|
-
"@itwin/core-react": "^3.1.
|
|
24
|
+
"@itwin/appui-abstract": "^3.1.1",
|
|
25
|
+
"@itwin/components-react": "^3.1.1",
|
|
26
|
+
"@itwin/core-bentley": "^3.1.1",
|
|
27
|
+
"@itwin/core-common": "^3.1.1",
|
|
28
|
+
"@itwin/core-frontend": "^3.1.1",
|
|
29
|
+
"@itwin/core-geometry": "^3.1.1",
|
|
30
|
+
"@itwin/core-quantity": "^3.1.1",
|
|
31
|
+
"@itwin/core-react": "^3.1.1",
|
|
32
32
|
"react": "^17.0.0",
|
|
33
33
|
"react-dom": "^17.0.0"
|
|
34
34
|
},
|
|
@@ -37,16 +37,16 @@
|
|
|
37
37
|
"NOTE: All tools used by scripts in this package must be listed as devDependencies"
|
|
38
38
|
],
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@itwin/appui-abstract": "3.1.
|
|
41
|
-
"@itwin/build-tools": "3.1.
|
|
42
|
-
"@itwin/components-react": "3.1.
|
|
43
|
-
"@itwin/core-bentley": "3.1.
|
|
44
|
-
"@itwin/core-common": "3.1.
|
|
45
|
-
"@itwin/core-frontend": "3.1.
|
|
46
|
-
"@itwin/core-geometry": "3.1.
|
|
47
|
-
"@itwin/core-quantity": "3.1.
|
|
48
|
-
"@itwin/core-react": "3.1.
|
|
49
|
-
"@itwin/eslint-plugin": "3.1.
|
|
40
|
+
"@itwin/appui-abstract": "3.1.1",
|
|
41
|
+
"@itwin/build-tools": "3.1.1",
|
|
42
|
+
"@itwin/components-react": "3.1.1",
|
|
43
|
+
"@itwin/core-bentley": "3.1.1",
|
|
44
|
+
"@itwin/core-common": "3.1.1",
|
|
45
|
+
"@itwin/core-frontend": "3.1.1",
|
|
46
|
+
"@itwin/core-geometry": "3.1.1",
|
|
47
|
+
"@itwin/core-quantity": "3.1.1",
|
|
48
|
+
"@itwin/core-react": "3.1.1",
|
|
49
|
+
"@itwin/eslint-plugin": "3.1.1",
|
|
50
50
|
"@testing-library/react": "^12.0.0",
|
|
51
51
|
"@testing-library/react-hooks": "^7.0.2",
|
|
52
52
|
"@testing-library/user-event": "^13.2.1",
|
|
@@ -97,8 +97,8 @@
|
|
|
97
97
|
],
|
|
98
98
|
"dependencies": {
|
|
99
99
|
"@bentley/icons-generic-webfont": "^1.0.15",
|
|
100
|
-
"@itwin/itwinui-css": "
|
|
101
|
-
"@itwin/itwinui-react": "
|
|
100
|
+
"@itwin/itwinui-css": "0.44.2",
|
|
101
|
+
"@itwin/itwinui-react": "^1.32.0",
|
|
102
102
|
"callable-instance2": "1.0.0",
|
|
103
103
|
"classnames": "^2.3.1",
|
|
104
104
|
"eventemitter2": "^5.0.1",
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import "./ContextMenu.scss";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { RelativePosition } from "@itwin/appui-abstract";
|
|
4
|
-
import { CommonProps } from "@itwin/core-react";
|
|
5
|
-
/** Properties for [[ContextMenuItem]] component
|
|
6
|
-
* @internal
|
|
7
|
-
* @deprecated
|
|
8
|
-
*/
|
|
9
|
-
export interface MenuItem {
|
|
10
|
-
/** Name of the context menu item */
|
|
11
|
-
name?: string;
|
|
12
|
-
/** Optional icon */
|
|
13
|
-
icon?: string;
|
|
14
|
-
/** Disabled */
|
|
15
|
-
disabled?: boolean;
|
|
16
|
-
/** Checked or not */
|
|
17
|
-
checked?: boolean;
|
|
18
|
-
/** Separator */
|
|
19
|
-
isSeparator?: boolean;
|
|
20
|
-
/** Called when the item is clicked */
|
|
21
|
-
onClick?: () => void;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* A context menu item.
|
|
25
|
-
* @internal
|
|
26
|
-
* @deprecated
|
|
27
|
-
*/
|
|
28
|
-
export declare class ContextMenuItem extends React.Component<MenuItem> {
|
|
29
|
-
private _onClick;
|
|
30
|
-
render(): JSX.Element;
|
|
31
|
-
}
|
|
32
|
-
/** Properties for [[ContextMenu]] component
|
|
33
|
-
* @internal
|
|
34
|
-
* @deprecated
|
|
35
|
-
*/
|
|
36
|
-
export interface ContextMenuProps extends CommonProps {
|
|
37
|
-
/** Show or hide the context menu */
|
|
38
|
-
isOpened: boolean;
|
|
39
|
-
/** Position the context menu relative to the parent */
|
|
40
|
-
position: RelativePosition;
|
|
41
|
-
/** List of context menu items */
|
|
42
|
-
items?: MenuItem[];
|
|
43
|
-
/** Called when the mouse is clicked outside the context menu */
|
|
44
|
-
onClickOutside?: () => void;
|
|
45
|
-
/** parent element */
|
|
46
|
-
parent: HTMLElement | null;
|
|
47
|
-
}
|
|
48
|
-
/** Context menu for timeline component
|
|
49
|
-
* @internal
|
|
50
|
-
* @deprecated
|
|
51
|
-
*/
|
|
52
|
-
export declare class ContextMenu extends React.Component<ContextMenuProps> {
|
|
53
|
-
render(): JSX.Element;
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=ContextMenu.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenu.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/timeline/ContextMenu.tsx"],"names":[],"mappings":"AAIA,OAAO,oBAAoB,CAAC;AAE5B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAS,MAAM,mBAAmB,CAAC;AAIvD;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oBAAoB;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,eAAe;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qBAAqB;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gBAAgB;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,sCAAsC;IACtC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAGD;;;;GAIG;AACH,qBAAa,eAAgB,SAAQ,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC;IAE5D,OAAO,CAAC,QAAQ,CAMd;IAGc,MAAM;CAqBvB;AAGD;;;GAGG;AACH,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD,oCAAoC;IACpC,QAAQ,EAAE,OAAO,CAAC;IAClB,uDAAuD;IACvD,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,iCAAiC;IACjC,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;IACnB,gEAAgE;IAChE,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,qBAAqB;IACrB,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;CAC5B;AAGD;;;GAGG;AACH,qBAAa,WAAY,SAAQ,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAC;IAEhD,MAAM;CAgBvB"}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.ContextMenu = exports.ContextMenuItem = void 0;
|
|
26
|
-
/*---------------------------------------------------------------------------------------------
|
|
27
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
28
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
29
|
-
*--------------------------------------------------------------------------------------------*/
|
|
30
|
-
require("./ContextMenu.scss");
|
|
31
|
-
const classnames_1 = __importDefault(require("classnames"));
|
|
32
|
-
const React = __importStar(require("react"));
|
|
33
|
-
const core_react_1 = require("@itwin/core-react");
|
|
34
|
-
/* istanbul ignore next */
|
|
35
|
-
/**
|
|
36
|
-
* A context menu item.
|
|
37
|
-
* @internal
|
|
38
|
-
* @deprecated
|
|
39
|
-
*/
|
|
40
|
-
class ContextMenuItem extends React.Component {
|
|
41
|
-
constructor() {
|
|
42
|
-
super(...arguments);
|
|
43
|
-
this._onClick = (event) => {
|
|
44
|
-
event.stopPropagation();
|
|
45
|
-
// istanbul ignore else
|
|
46
|
-
if (!this.props.disabled && !this.props.isSeparator && this.props.onClick) {
|
|
47
|
-
this.props.onClick();
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
// istanbul ignore next - WIP
|
|
52
|
-
render() {
|
|
53
|
-
const menuClassName = (0, classnames_1.default)("contextmenu-item-wip", this.props.disabled && "disabled", this.props.checked && "checked");
|
|
54
|
-
return (React.createElement(React.Fragment, null,
|
|
55
|
-
this.props.isSeparator && React.createElement("div", { className: "separator", role: "separator" }),
|
|
56
|
-
!this.props.isSeparator &&
|
|
57
|
-
// eslint-disable-next-line jsx-a11y/click-events-have-key-events
|
|
58
|
-
React.createElement("li", { className: menuClassName, onClick: this._onClick, role: "menuitem" },
|
|
59
|
-
this.props.checked && React.createElement("span", { className: "icon icon-checkmark" }),
|
|
60
|
-
(this.props.icon && !this.props.checked) && React.createElement("span", { className: (0, classnames_1.default)("user-icon icon", this.props.icon) }),
|
|
61
|
-
React.createElement("span", null, this.props.name))));
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
exports.ContextMenuItem = ContextMenuItem;
|
|
65
|
-
/* istanbul ignore next */
|
|
66
|
-
/** Context menu for timeline component
|
|
67
|
-
* @internal
|
|
68
|
-
* @deprecated
|
|
69
|
-
*/
|
|
70
|
-
class ContextMenu extends React.Component {
|
|
71
|
-
// istanbul ignore next - WIP
|
|
72
|
-
render() {
|
|
73
|
-
const { items, parent, position, isOpened, onClickOutside } = this.props;
|
|
74
|
-
return (React.createElement(core_react_1.Popup, { isOpen: isOpened, target: parent, position: position, onClose: onClickOutside },
|
|
75
|
-
React.createElement("div", { "data-testid": "timeline-contextmenu-div", className: "contextmenu-wip" },
|
|
76
|
-
React.createElement("ul", null,
|
|
77
|
-
items && items.map((item, index) => (React.createElement(ContextMenuItem, { key: index, name: item.name, icon: item.icon, disabled: item.disabled, onClick: item.onClick, isSeparator: item.isSeparator }))),
|
|
78
|
-
this.props.children))));
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
exports.ContextMenu = ContextMenu;
|
|
82
|
-
//# sourceMappingURL=ContextMenu.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenu.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/timeline/ContextMenu.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,8BAA4B;AAC5B,4DAAoC;AACpC,6CAA+B;AAE/B,kDAAuD;AAuBvD,0BAA0B;AAC1B;;;;GAIG;AACH,MAAa,eAAgB,SAAQ,KAAK,CAAC,SAAmB;IAA9D;;QAEU,aAAQ,GAAG,CAAC,KAAU,EAAE,EAAE;YAChC,KAAK,CAAC,eAAe,EAAE,CAAC;YACxB,uBAAuB;YACvB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE;gBACzE,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;aACtB;QACH,CAAC,CAAC;IAwBJ,CAAC;IAtBC,6BAA6B;IACb,MAAM;QACpB,MAAM,aAAa,GAAG,IAAA,oBAAU,EAC9B,sBAAsB,EACtB,IAAI,CAAC,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,eAAe,IAAC,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,GAAI,CACjJ,CAAC;oBAED,IAAI,CAAC,KAAK,CAAC,QAAQ,CACjB,CACD,CACA,CACT,CAAC;IACJ,CAAC;CACF;AAlBD,kCAkBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport \"./ContextMenu.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { RelativePosition } from \"@itwin/appui-abstract\";\r\nimport { CommonProps, Popup } from \"@itwin/core-react\";\r\n/* eslint-disable deprecation/deprecation */\r\n\r\n/* istanbul ignore next */\r\n/** Properties for [[ContextMenuItem]] component\r\n * @internal\r\n * @deprecated\r\n */\r\nexport interface MenuItem {\r\n /** Name of the context menu item */\r\n name?: string;\r\n /** Optional icon */\r\n icon?: string;\r\n /** Disabled */\r\n disabled?: boolean;\r\n /** Checked or not */\r\n checked?: boolean;\r\n /** Separator */\r\n isSeparator?: boolean;\r\n /** Called when the item is clicked */\r\n onClick?: () => void;\r\n}\r\n\r\n/* istanbul ignore next */\r\n/**\r\n * A context menu item.\r\n * @internal\r\n * @deprecated\r\n */\r\nexport class ContextMenuItem extends React.Component<MenuItem> {\r\n\r\n private _onClick = (event: any) => {\r\n event.stopPropagation();\r\n // istanbul ignore else\r\n if (!this.props.disabled && !this.props.isSeparator && this.props.onClick) {\r\n this.props.onClick();\r\n }\r\n };\r\n\r\n // istanbul ignore next - WIP\r\n public override render() {\r\n const menuClassName = classnames(\r\n \"contextmenu-item-wip\",\r\n this.props.disabled && \"disabled\",\r\n this.props.checked && \"checked\",\r\n );\r\n\r\n return (\r\n <>\r\n {this.props.isSeparator && <div className=\"separator\" role=\"separator\" />}\r\n {!this.props.isSeparator &&\r\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events\r\n <li className={menuClassName} onClick={this._onClick} role=\"menuitem\">\r\n {this.props.checked && <span className=\"icon icon-checkmark\" />}\r\n {(this.props.icon && !this.props.checked) && <span className={classnames(\"user-icon icon\", this.props.icon)} />}\r\n <span>{this.props.name}</span>\r\n </li>\r\n }\r\n </>\r\n );\r\n }\r\n}\r\n\r\n/* istanbul ignore next */\r\n/** Properties for [[ContextMenu]] component\r\n * @internal\r\n * @deprecated\r\n */\r\nexport interface ContextMenuProps extends CommonProps {\r\n /** Show or hide the context menu */\r\n isOpened: boolean;\r\n /** Position the context menu relative to the parent */\r\n position: RelativePosition;\r\n /** List of context menu items */\r\n items?: MenuItem[];\r\n /** Called when the mouse is clicked outside the context menu */\r\n onClickOutside?: () => void;\r\n /** parent element */\r\n parent: HTMLElement | null;\r\n}\r\n\r\n/* istanbul ignore next */\r\n/** Context menu for timeline component\r\n * @internal\r\n * @deprecated\r\n */\r\nexport class ContextMenu extends React.Component<ContextMenuProps> {\r\n // istanbul ignore next - WIP\r\n public override render() {\r\n const { items, parent, position, isOpened, onClickOutside } = this.props;\r\n return (\r\n <Popup isOpen={isOpened} target={parent} position={position} onClose={onClickOutside}>\r\n <div data-testid=\"timeline-contextmenu-div\" className=\"contextmenu-wip\">\r\n <ul>\r\n {items && items.map((item: MenuItem, index: number) => (\r\n <ContextMenuItem key={index} name={item.name} icon={item.icon} disabled={item.disabled} onClick={item.onClick} isSeparator={item.isSeparator} />\r\n ))\r\n }\r\n {this.props.children}\r\n </ul>\r\n </div>\r\n </Popup>\r\n );\r\n }\r\n}\r\n"]}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
@import "~@itwin/core-react/lib/cjs/core-react/z-index";
|
|
6
|
-
@import "~@itwin/core-react/lib/cjs/core-react/style/themecolors";
|
|
7
|
-
|
|
8
|
-
// cspell:ignore contextmenu
|
|
9
|
-
|
|
10
|
-
.contextmenu-wip {
|
|
11
|
-
cursor: default;
|
|
12
|
-
box-sizing: border-box;
|
|
13
|
-
@include uicore-z-index(context-menu-z);
|
|
14
|
-
background: $buic-background-1;
|
|
15
|
-
border-radius: 3px;
|
|
16
|
-
max-width: 250px;
|
|
17
|
-
|
|
18
|
-
>ul {
|
|
19
|
-
margin: 0;
|
|
20
|
-
padding: 6px 0;
|
|
21
|
-
list-style: none;
|
|
22
|
-
|
|
23
|
-
>.separator {
|
|
24
|
-
padding: .5em 0;
|
|
25
|
-
position: relative;
|
|
26
|
-
|
|
27
|
-
&:before {
|
|
28
|
-
content: '';
|
|
29
|
-
position: absolute;
|
|
30
|
-
top: 50%;
|
|
31
|
-
left: 32px;
|
|
32
|
-
right: 4px;
|
|
33
|
-
width: auto;
|
|
34
|
-
height: 1px;
|
|
35
|
-
background: #dce0e3;
|
|
36
|
-
transform: translateY(-50%);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.contextmenu-item-wip {
|
|
43
|
-
display: flex;
|
|
44
|
-
align-items: center;
|
|
45
|
-
margin: 0;
|
|
46
|
-
padding: .5em 0;
|
|
47
|
-
color: $buic-foreground-body;
|
|
48
|
-
font-size: 14px;
|
|
49
|
-
position: relative;
|
|
50
|
-
user-select: none;
|
|
51
|
-
|
|
52
|
-
>.user-icon,
|
|
53
|
-
>.icon-checkmark {
|
|
54
|
-
position: absolute;
|
|
55
|
-
left: 10px;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// text
|
|
59
|
-
>span:last-child {
|
|
60
|
-
padding-left: 32px;
|
|
61
|
-
padding-right: 1em;
|
|
62
|
-
text-overflow: ellipsis;
|
|
63
|
-
white-space: nowrap;
|
|
64
|
-
overflow: hidden;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
&:hover:not(.disabled) {
|
|
68
|
-
background: $buic-row-hover;
|
|
69
|
-
color: $buic-foreground-activehover;
|
|
70
|
-
cursor: pointer;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
&.disabled {
|
|
74
|
-
color: $buic-foreground-disabled;
|
|
75
|
-
cursor: default;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
>.icon-checkmark {
|
|
79
|
-
color: $buic-foreground-primary;
|
|
80
|
-
}
|
|
81
|
-
}
|