@itwin/core-frontend 3.2.0-dev.72 → 3.3.0-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/lib/cjs/ViewportSync.d.ts +119 -0
  2. package/lib/cjs/ViewportSync.d.ts.map +1 -0
  3. package/lib/cjs/ViewportSync.js +187 -0
  4. package/lib/cjs/ViewportSync.js.map +1 -0
  5. package/lib/cjs/core-frontend.d.ts +1 -1
  6. package/lib/cjs/core-frontend.d.ts.map +1 -1
  7. package/lib/cjs/core-frontend.js +1 -1
  8. package/lib/cjs/core-frontend.js.map +1 -1
  9. package/lib/cjs/tile/ClassifierTileTree.d.ts.map +1 -1
  10. package/lib/cjs/tile/ClassifierTileTree.js +3 -4
  11. package/lib/cjs/tile/ClassifierTileTree.js.map +1 -1
  12. package/lib/cjs/tile/DynamicIModelTile.js +4 -2
  13. package/lib/cjs/tile/DynamicIModelTile.js.map +1 -1
  14. package/lib/cjs/tile/IModelTile.js +1 -1
  15. package/lib/cjs/tile/IModelTile.js.map +1 -1
  16. package/lib/cjs/tile/IModelTileTree.d.ts +3 -3
  17. package/lib/cjs/tile/IModelTileTree.d.ts.map +1 -1
  18. package/lib/cjs/tile/IModelTileTree.js +1 -1
  19. package/lib/cjs/tile/IModelTileTree.js.map +1 -1
  20. package/lib/cjs/tile/PrimaryTileTree.d.ts.map +1 -1
  21. package/lib/cjs/tile/PrimaryTileTree.js +4 -4
  22. package/lib/cjs/tile/PrimaryTileTree.js.map +1 -1
  23. package/lib/cjs/tile/TileAdmin.d.ts +15 -1
  24. package/lib/cjs/tile/TileAdmin.d.ts.map +1 -1
  25. package/lib/cjs/tile/TileAdmin.js +25 -14
  26. package/lib/cjs/tile/TileAdmin.js.map +1 -1
  27. package/lib/esm/ViewportSync.d.ts +119 -0
  28. package/lib/esm/ViewportSync.d.ts.map +1 -0
  29. package/lib/esm/ViewportSync.js +177 -0
  30. package/lib/esm/ViewportSync.js.map +1 -0
  31. package/lib/esm/core-frontend.d.ts +1 -1
  32. package/lib/esm/core-frontend.d.ts.map +1 -1
  33. package/lib/esm/core-frontend.js +1 -1
  34. package/lib/esm/core-frontend.js.map +1 -1
  35. package/lib/esm/tile/ClassifierTileTree.d.ts.map +1 -1
  36. package/lib/esm/tile/ClassifierTileTree.js +3 -4
  37. package/lib/esm/tile/ClassifierTileTree.js.map +1 -1
  38. package/lib/esm/tile/DynamicIModelTile.js +4 -2
  39. package/lib/esm/tile/DynamicIModelTile.js.map +1 -1
  40. package/lib/esm/tile/IModelTile.js +1 -1
  41. package/lib/esm/tile/IModelTile.js.map +1 -1
  42. package/lib/esm/tile/IModelTileTree.d.ts +3 -3
  43. package/lib/esm/tile/IModelTileTree.d.ts.map +1 -1
  44. package/lib/esm/tile/IModelTileTree.js +1 -1
  45. package/lib/esm/tile/IModelTileTree.js.map +1 -1
  46. package/lib/esm/tile/PrimaryTileTree.d.ts.map +1 -1
  47. package/lib/esm/tile/PrimaryTileTree.js +5 -5
  48. package/lib/esm/tile/PrimaryTileTree.js.map +1 -1
  49. package/lib/esm/tile/TileAdmin.d.ts +15 -1
  50. package/lib/esm/tile/TileAdmin.d.ts.map +1 -1
  51. package/lib/esm/tile/TileAdmin.js +26 -15
  52. package/lib/esm/tile/TileAdmin.js.map +1 -1
  53. package/package.json +21 -21
  54. package/lib/cjs/TwoWayViewportSync.d.ts +0 -51
  55. package/lib/cjs/TwoWayViewportSync.d.ts.map +0 -1
  56. package/lib/cjs/TwoWayViewportSync.js +0 -87
  57. package/lib/cjs/TwoWayViewportSync.js.map +0 -1
  58. package/lib/esm/TwoWayViewportSync.d.ts +0 -51
  59. package/lib/esm/TwoWayViewportSync.d.ts.map +0 -1
  60. package/lib/esm/TwoWayViewportSync.js +0 -82
  61. package/lib/esm/TwoWayViewportSync.js.map +0 -1
@@ -1,87 +0,0 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
- /** @packageDocumentation
7
- * @module Views
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.TwoWayViewportFrustumSync = exports.TwoWayViewportSync = void 0;
11
- /** Forms a bidirectional connection between two [[Viewport]]s such that the [[ViewState]]s of each are synchronized with one another.
12
- * For example, panning in one viewport will cause the other viewport to pan by the same distance, and changing the [RenderMode]($common) of one viewport
13
- * will change it in the other viewport.
14
- * By default, all aspects of the views - display style, category and model selectors, frustum, etc - are synchronized, but this can be customized by
15
- * subclassing and overriding the [[syncViewports]] and [[connectViewports]] methods.
16
- * @see [Multiple Viewport Sample](https://www.itwinjs.org/sample-showcase/?group=Viewer+Features&sample=multi-viewport-sample&imodel=Metrostation+Sample)
17
- * for an interactive demonstration.
18
- * @see [[TwoWayViewportFrustumSync]] to synchronize only the frusta of the viewports.
19
- * @public
20
- */
21
- class TwoWayViewportSync {
22
- constructor() {
23
- this._disconnect = [];
24
- this._isEcho = false;
25
- }
26
- syncView(source, target) {
27
- if (this._isEcho)
28
- return;
29
- this._isEcho = true; // so we don't react to the echo of this sync
30
- this.syncViewports(source, target);
31
- this._isEcho = false;
32
- }
33
- /** Invoked from [[connect]] to set up the initial synchronization between the two viewports.
34
- * `target` should be modified to match `source`.
35
- * The default implementation applies a clone of `source`'s [[ViewState]] to `target`.
36
- * @see [[syncViewports]] to customize subsequent synchronization.
37
- */
38
- connectViewports(source, target) {
39
- const viewState = source.view.clone(target.iModel);
40
- target.applyViewState(viewState);
41
- }
42
- /** Invoked each time `source` changes to update `target` to match.
43
- * The default implementation applies a clone of `source`'s [[ViewState]] to `target`.
44
- * @param source The viewport that changed
45
- * @param target The viewport that should be updated to match `source`
46
- * @see [[connectViewports]] to set up the initial synchronization between the two viewports.
47
- */
48
- syncViewports(source, target) {
49
- target.applyViewState(source.view.clone(target.iModel));
50
- }
51
- /** Establish the connection between two Viewports. When this method is called, `viewport2` is initialized with the state of `viewport1` via [[connectViewports]].
52
- * Thereafter, any change to the frustum of either viewport will be reflected in the frustum of the other viewport via [[syncViewports]].
53
- */
54
- connect(viewport1, viewport2) {
55
- this.disconnect();
56
- this.connectViewports(viewport1, viewport2);
57
- // listen to the onViewChanged events from both views
58
- this._disconnect.push(viewport1.onViewChanged.addListener(() => this.syncView(viewport1, viewport2)));
59
- this._disconnect.push(viewport2.onViewChanged.addListener(() => this.syncView(viewport2, viewport1)));
60
- }
61
- /** Remove the connection between the two views. */
62
- disconnect() {
63
- this._disconnect.forEach((f) => f());
64
- this._disconnect.length = 0;
65
- }
66
- }
67
- exports.TwoWayViewportSync = TwoWayViewportSync;
68
- /** Forms a bidirectional connection between two [[Viewport]]s such that the [Frustum]($common)s of each are synchronized with one another.
69
- * For example, zooming out in one viewport will zoom out by the same distance in the other viewport.
70
- * No other aspects of the viewports are synchronized - they may have entirely different display styles, category/model selectors, etc.
71
- * @see [[TwoWayViewportSync]] to synchronize all aspects of the viewports.
72
- * @public
73
- */
74
- class TwoWayViewportFrustumSync extends TwoWayViewportSync {
75
- /** @internal override */
76
- syncViewports(source, target) {
77
- const pose = source.view.savePose();
78
- const view = target.view.applyPose(pose);
79
- target.applyViewState(view);
80
- }
81
- /** @internal override */
82
- connectViewports(source, target) {
83
- this.syncViewports(source, target);
84
- }
85
- }
86
- exports.TwoWayViewportFrustumSync = TwoWayViewportFrustumSync;
87
- //# sourceMappingURL=TwoWayViewportSync.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TwoWayViewportSync.js","sourceRoot":"","sources":["../../src/TwoWayViewportSync.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAIH;;;;;;;;;GASG;AACH,MAAa,kBAAkB;IAA/B;QACqB,gBAAW,GAAmB,EAAE,CAAC;QAC5C,YAAO,GAAG,KAAK,CAAC;IAiD1B,CAAC;IA/CS,QAAQ,CAAC,MAAgB,EAAE,MAAgB;QACj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AC,MAAM,GAAG,CAAC,CAAC;IAC9B,CAAC;CACF;AAnDD,gDAmDC;AAED;;;;;GAKG;AACH,MAAa,yBAA0B,SAAQ,kBAAkB;IAC/D,yBAAyB;IACN,aAAa,CAAC,MAAgB,EAAE,MAAgB;QACjE,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACpC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACzC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED,yBAAyB;IACN,gBAAgB,CAAC,MAAgB,EAAE,MAAgB;QACpE,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,CAAC;CACF;AAZD,8DAYC","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 Views\r\n */\r\n\r\nimport { Viewport } from \"./Viewport\";\r\n\r\n/** Forms a bidirectional connection between two [[Viewport]]s such that the [[ViewState]]s of each are synchronized with one another.\r\n * For example, panning in one viewport will cause the other viewport to pan by the same distance, and changing the [RenderMode]($common) of one viewport\r\n * will change it in the other viewport.\r\n * By default, all aspects of the views - display style, category and model selectors, frustum, etc - are synchronized, but this can be customized by\r\n * subclassing and overriding the [[syncViewports]] and [[connectViewports]] methods.\r\n * @see [Multiple Viewport Sample](https://www.itwinjs.org/sample-showcase/?group=Viewer+Features&sample=multi-viewport-sample&imodel=Metrostation+Sample)\r\n * for an interactive demonstration.\r\n * @see [[TwoWayViewportFrustumSync]] to synchronize only the frusta of the viewports.\r\n * @public\r\n */\r\nexport class TwoWayViewportSync {\r\n protected readonly _disconnect: VoidFunction[] = [];\r\n private _isEcho = false;\r\n\r\n private syncView(source: Viewport, target: Viewport) {\r\n if (this._isEcho)\r\n return;\r\n\r\n this._isEcho = true; // so we don't react to the echo of this sync\r\n this.syncViewports(source, target);\r\n this._isEcho = false;\r\n }\r\n\r\n /** Invoked from [[connect]] to set up the initial synchronization between the two viewports.\r\n * `target` should be modified to match `source`.\r\n * The default implementation applies a clone of `source`'s [[ViewState]] to `target`.\r\n * @see [[syncViewports]] to customize subsequent synchronization.\r\n */\r\n protected connectViewports(source: Viewport, target: Viewport): void {\r\n const viewState = source.view.clone(target.iModel);\r\n target.applyViewState(viewState);\r\n }\r\n\r\n /** Invoked each time `source` changes to update `target` to match.\r\n * The default implementation applies a clone of `source`'s [[ViewState]] to `target`.\r\n * @param source The viewport that changed\r\n * @param target The viewport that should be updated to match `source`\r\n * @see [[connectViewports]] to set up the initial synchronization between the two viewports.\r\n */\r\n protected syncViewports(source: Viewport, target: Viewport): void {\r\n target.applyViewState(source.view.clone(target.iModel));\r\n }\r\n\r\n /** Establish the connection between two Viewports. When this method is called, `viewport2` is initialized with the state of `viewport1` via [[connectViewports]].\r\n * Thereafter, any change to the frustum of either viewport will be reflected in the frustum of the other viewport via [[syncViewports]].\r\n */\r\n public connect(viewport1: Viewport, viewport2: Viewport) {\r\n this.disconnect();\r\n\r\n this.connectViewports(viewport1, viewport2);\r\n\r\n // listen to the onViewChanged events from both views\r\n this._disconnect.push(viewport1.onViewChanged.addListener(() => this.syncView(viewport1, viewport2)));\r\n this._disconnect.push(viewport2.onViewChanged.addListener(() => this.syncView(viewport2, viewport1)));\r\n }\r\n\r\n /** Remove the connection between the two views. */\r\n public disconnect() {\r\n this._disconnect.forEach((f) => f());\r\n this._disconnect.length = 0;\r\n }\r\n}\r\n\r\n/** Forms a bidirectional connection between two [[Viewport]]s such that the [Frustum]($common)s of each are synchronized with one another.\r\n * For example, zooming out in one viewport will zoom out by the same distance in the other viewport.\r\n * No other aspects of the viewports are synchronized - they may have entirely different display styles, category/model selectors, etc.\r\n * @see [[TwoWayViewportSync]] to synchronize all aspects of the viewports.\r\n * @public\r\n */\r\nexport class TwoWayViewportFrustumSync extends TwoWayViewportSync {\r\n /** @internal override */\r\n protected override syncViewports(source: Viewport, target: Viewport): void {\r\n const pose = source.view.savePose();\r\n const view = target.view.applyPose(pose);\r\n target.applyViewState(view);\r\n }\r\n\r\n /** @internal override */\r\n protected override connectViewports(source: Viewport, target: Viewport): void {\r\n this.syncViewports(source, target);\r\n }\r\n}\r\n"]}
@@ -1,51 +0,0 @@
1
- /** @packageDocumentation
2
- * @module Views
3
- */
4
- import { Viewport } from "./Viewport";
5
- /** Forms a bidirectional connection between two [[Viewport]]s such that the [[ViewState]]s of each are synchronized with one another.
6
- * For example, panning in one viewport will cause the other viewport to pan by the same distance, and changing the [RenderMode]($common) of one viewport
7
- * will change it in the other viewport.
8
- * By default, all aspects of the views - display style, category and model selectors, frustum, etc - are synchronized, but this can be customized by
9
- * subclassing and overriding the [[syncViewports]] and [[connectViewports]] methods.
10
- * @see [Multiple Viewport Sample](https://www.itwinjs.org/sample-showcase/?group=Viewer+Features&sample=multi-viewport-sample&imodel=Metrostation+Sample)
11
- * for an interactive demonstration.
12
- * @see [[TwoWayViewportFrustumSync]] to synchronize only the frusta of the viewports.
13
- * @public
14
- */
15
- export declare class TwoWayViewportSync {
16
- protected readonly _disconnect: VoidFunction[];
17
- private _isEcho;
18
- private syncView;
19
- /** Invoked from [[connect]] to set up the initial synchronization between the two viewports.
20
- * `target` should be modified to match `source`.
21
- * The default implementation applies a clone of `source`'s [[ViewState]] to `target`.
22
- * @see [[syncViewports]] to customize subsequent synchronization.
23
- */
24
- protected connectViewports(source: Viewport, target: Viewport): void;
25
- /** Invoked each time `source` changes to update `target` to match.
26
- * The default implementation applies a clone of `source`'s [[ViewState]] to `target`.
27
- * @param source The viewport that changed
28
- * @param target The viewport that should be updated to match `source`
29
- * @see [[connectViewports]] to set up the initial synchronization between the two viewports.
30
- */
31
- protected syncViewports(source: Viewport, target: Viewport): void;
32
- /** Establish the connection between two Viewports. When this method is called, `viewport2` is initialized with the state of `viewport1` via [[connectViewports]].
33
- * Thereafter, any change to the frustum of either viewport will be reflected in the frustum of the other viewport via [[syncViewports]].
34
- */
35
- connect(viewport1: Viewport, viewport2: Viewport): void;
36
- /** Remove the connection between the two views. */
37
- disconnect(): void;
38
- }
39
- /** Forms a bidirectional connection between two [[Viewport]]s such that the [Frustum]($common)s of each are synchronized with one another.
40
- * For example, zooming out in one viewport will zoom out by the same distance in the other viewport.
41
- * No other aspects of the viewports are synchronized - they may have entirely different display styles, category/model selectors, etc.
42
- * @see [[TwoWayViewportSync]] to synchronize all aspects of the viewports.
43
- * @public
44
- */
45
- export declare class TwoWayViewportFrustumSync extends TwoWayViewportSync {
46
- /** @internal override */
47
- protected syncViewports(source: Viewport, target: Viewport): void;
48
- /** @internal override */
49
- protected connectViewports(source: Viewport, target: Viewport): void;
50
- }
51
- //# sourceMappingURL=TwoWayViewportSync.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TwoWayViewportSync.d.ts","sourceRoot":"","sources":["../../src/TwoWayViewportSync.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;;;;;;;;GASG;AACH,qBAAa,kBAAkB;IAC7B,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,YAAY,EAAE,CAAM;IACpD,OAAO,CAAC,OAAO,CAAS;IAExB,OAAO,CAAC,QAAQ;IAShB;;;;OAIG;IACH,SAAS,CAAC,gBAAgB,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,GAAG,IAAI;IAKpE;;;;;OAKG;IACH,SAAS,CAAC,aAAa,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,GAAG,IAAI;IAIjE;;OAEG;IACI,OAAO,CAAC,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ;IAUvD,mDAAmD;IAC5C,UAAU;CAIlB;AAED;;;;;GAKG;AACH,qBAAa,yBAA0B,SAAQ,kBAAkB;IAC/D,yBAAyB;cACN,aAAa,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,GAAG,IAAI;IAM1E,yBAAyB;cACN,gBAAgB,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,GAAG,IAAI;CAG9E"}
@@ -1,82 +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
- /** @packageDocumentation
6
- * @module Views
7
- */
8
- /** Forms a bidirectional connection between two [[Viewport]]s such that the [[ViewState]]s of each are synchronized with one another.
9
- * For example, panning in one viewport will cause the other viewport to pan by the same distance, and changing the [RenderMode]($common) of one viewport
10
- * will change it in the other viewport.
11
- * By default, all aspects of the views - display style, category and model selectors, frustum, etc - are synchronized, but this can be customized by
12
- * subclassing and overriding the [[syncViewports]] and [[connectViewports]] methods.
13
- * @see [Multiple Viewport Sample](https://www.itwinjs.org/sample-showcase/?group=Viewer+Features&sample=multi-viewport-sample&imodel=Metrostation+Sample)
14
- * for an interactive demonstration.
15
- * @see [[TwoWayViewportFrustumSync]] to synchronize only the frusta of the viewports.
16
- * @public
17
- */
18
- export class TwoWayViewportSync {
19
- constructor() {
20
- this._disconnect = [];
21
- this._isEcho = false;
22
- }
23
- syncView(source, target) {
24
- if (this._isEcho)
25
- return;
26
- this._isEcho = true; // so we don't react to the echo of this sync
27
- this.syncViewports(source, target);
28
- this._isEcho = false;
29
- }
30
- /** Invoked from [[connect]] to set up the initial synchronization between the two viewports.
31
- * `target` should be modified to match `source`.
32
- * The default implementation applies a clone of `source`'s [[ViewState]] to `target`.
33
- * @see [[syncViewports]] to customize subsequent synchronization.
34
- */
35
- connectViewports(source, target) {
36
- const viewState = source.view.clone(target.iModel);
37
- target.applyViewState(viewState);
38
- }
39
- /** Invoked each time `source` changes to update `target` to match.
40
- * The default implementation applies a clone of `source`'s [[ViewState]] to `target`.
41
- * @param source The viewport that changed
42
- * @param target The viewport that should be updated to match `source`
43
- * @see [[connectViewports]] to set up the initial synchronization between the two viewports.
44
- */
45
- syncViewports(source, target) {
46
- target.applyViewState(source.view.clone(target.iModel));
47
- }
48
- /** Establish the connection between two Viewports. When this method is called, `viewport2` is initialized with the state of `viewport1` via [[connectViewports]].
49
- * Thereafter, any change to the frustum of either viewport will be reflected in the frustum of the other viewport via [[syncViewports]].
50
- */
51
- connect(viewport1, viewport2) {
52
- this.disconnect();
53
- this.connectViewports(viewport1, viewport2);
54
- // listen to the onViewChanged events from both views
55
- this._disconnect.push(viewport1.onViewChanged.addListener(() => this.syncView(viewport1, viewport2)));
56
- this._disconnect.push(viewport2.onViewChanged.addListener(() => this.syncView(viewport2, viewport1)));
57
- }
58
- /** Remove the connection between the two views. */
59
- disconnect() {
60
- this._disconnect.forEach((f) => f());
61
- this._disconnect.length = 0;
62
- }
63
- }
64
- /** Forms a bidirectional connection between two [[Viewport]]s such that the [Frustum]($common)s of each are synchronized with one another.
65
- * For example, zooming out in one viewport will zoom out by the same distance in the other viewport.
66
- * No other aspects of the viewports are synchronized - they may have entirely different display styles, category/model selectors, etc.
67
- * @see [[TwoWayViewportSync]] to synchronize all aspects of the viewports.
68
- * @public
69
- */
70
- export class TwoWayViewportFrustumSync extends TwoWayViewportSync {
71
- /** @internal override */
72
- syncViewports(source, target) {
73
- const pose = source.view.savePose();
74
- const view = target.view.applyPose(pose);
75
- target.applyViewState(view);
76
- }
77
- /** @internal override */
78
- connectViewports(source, target) {
79
- this.syncViewports(source, target);
80
- }
81
- }
82
- //# sourceMappingURL=TwoWayViewportSync.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TwoWayViewportSync.js","sourceRoot":"","sources":["../../src/TwoWayViewportSync.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAIH;;;;;;;;;GASG;AACH,MAAM,OA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DAAmD;IAC5C,UAAU;QACf,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QACrC,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC;IAC9B,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,OAAO,yBAA0B,SAAQ,kBAAkB;IAC/D,yBAAyB;IACN,aAAa,CAAC,MAAgB,EAAE,MAAgB;QACjE,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACpC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACzC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED,yBAAyB;IACN,gBAAgB,CAAC,MAAgB,EAAE,MAAgB;QACpE,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,CAAC;CACF","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 Views\r\n */\r\n\r\nimport { Viewport } from \"./Viewport\";\r\n\r\n/** Forms a bidirectional connection between two [[Viewport]]s such that the [[ViewState]]s of each are synchronized with one another.\r\n * For example, panning in one viewport will cause the other viewport to pan by the same distance, and changing the [RenderMode]($common) of one viewport\r\n * will change it in the other viewport.\r\n * By default, all aspects of the views - display style, category and model selectors, frustum, etc - are synchronized, but this can be customized by\r\n * subclassing and overriding the [[syncViewports]] and [[connectViewports]] methods.\r\n * @see [Multiple Viewport Sample](https://www.itwinjs.org/sample-showcase/?group=Viewer+Features&sample=multi-viewport-sample&imodel=Metrostation+Sample)\r\n * for an interactive demonstration.\r\n * @see [[TwoWayViewportFrustumSync]] to synchronize only the frusta of the viewports.\r\n * @public\r\n */\r\nexport class TwoWayViewportSync {\r\n protected readonly _disconnect: VoidFunction[] = [];\r\n private _isEcho = false;\r\n\r\n private syncView(source: Viewport, target: Viewport) {\r\n if (this._isEcho)\r\n return;\r\n\r\n this._isEcho = true; // so we don't react to the echo of this sync\r\n this.syncViewports(source, target);\r\n this._isEcho = false;\r\n }\r\n\r\n /** Invoked from [[connect]] to set up the initial synchronization between the two viewports.\r\n * `target` should be modified to match `source`.\r\n * The default implementation applies a clone of `source`'s [[ViewState]] to `target`.\r\n * @see [[syncViewports]] to customize subsequent synchronization.\r\n */\r\n protected connectViewports(source: Viewport, target: Viewport): void {\r\n const viewState = source.view.clone(target.iModel);\r\n target.applyViewState(viewState);\r\n }\r\n\r\n /** Invoked each time `source` changes to update `target` to match.\r\n * The default implementation applies a clone of `source`'s [[ViewState]] to `target`.\r\n * @param source The viewport that changed\r\n * @param target The viewport that should be updated to match `source`\r\n * @see [[connectViewports]] to set up the initial synchronization between the two viewports.\r\n */\r\n protected syncViewports(source: Viewport, target: Viewport): void {\r\n target.applyViewState(source.view.clone(target.iModel));\r\n }\r\n\r\n /** Establish the connection between two Viewports. When this method is called, `viewport2` is initialized with the state of `viewport1` via [[connectViewports]].\r\n * Thereafter, any change to the frustum of either viewport will be reflected in the frustum of the other viewport via [[syncViewports]].\r\n */\r\n public connect(viewport1: Viewport, viewport2: Viewport) {\r\n this.disconnect();\r\n\r\n this.connectViewports(viewport1, viewport2);\r\n\r\n // listen to the onViewChanged events from both views\r\n this._disconnect.push(viewport1.onViewChanged.addListener(() => this.syncView(viewport1, viewport2)));\r\n this._disconnect.push(viewport2.onViewChanged.addListener(() => this.syncView(viewport2, viewport1)));\r\n }\r\n\r\n /** Remove the connection between the two views. */\r\n public disconnect() {\r\n this._disconnect.forEach((f) => f());\r\n this._disconnect.length = 0;\r\n }\r\n}\r\n\r\n/** Forms a bidirectional connection between two [[Viewport]]s such that the [Frustum]($common)s of each are synchronized with one another.\r\n * For example, zooming out in one viewport will zoom out by the same distance in the other viewport.\r\n * No other aspects of the viewports are synchronized - they may have entirely different display styles, category/model selectors, etc.\r\n * @see [[TwoWayViewportSync]] to synchronize all aspects of the viewports.\r\n * @public\r\n */\r\nexport class TwoWayViewportFrustumSync extends TwoWayViewportSync {\r\n /** @internal override */\r\n protected override syncViewports(source: Viewport, target: Viewport): void {\r\n const pose = source.view.savePose();\r\n const view = target.view.applyPose(pose);\r\n target.applyViewState(view);\r\n }\r\n\r\n /** @internal override */\r\n protected override connectViewports(source: Viewport, target: Viewport): void {\r\n this.syncViewports(source, target);\r\n }\r\n}\r\n"]}