From 3f8e564c39dda76a21e045a0b02572e39306856c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Botelho=20Almeida?= Date: Mon, 4 Dec 2023 12:24:49 -0500 Subject: [PATCH] =?UTF-8?q?Changing=20Synchronizer=20properties=20visibili?= =?UTF-8?q?ty=20and=20exporting=20the=20sync=20ca=E2=80=A6=20(#3)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Changing Synchronizer properties visibility and exporting the sync callbacks to be used outside the library * Fixing PR comments * Renaming callback name --- .../src/store/SynchronizerManager/Synchronizer.ts | 8 ++++++-- packages/tools/src/synchronizers/callbacks/index.ts | 11 +++++++++++ packages/tools/src/synchronizers/index.ts | 2 ++ 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 packages/tools/src/synchronizers/callbacks/index.ts diff --git a/packages/tools/src/store/SynchronizerManager/Synchronizer.ts b/packages/tools/src/store/SynchronizerManager/Synchronizer.ts index b6d750e7d..30057980e 100644 --- a/packages/tools/src/store/SynchronizerManager/Synchronizer.ts +++ b/packages/tools/src/store/SynchronizerManager/Synchronizer.ts @@ -43,6 +43,10 @@ class Synchronizer { this.id = synchronizerId; } + public shouldIgnoreFiredEvents(): boolean { + return this._ignoreFiredEvents; + } + /** * "Returns true if the synchronizer is disabled." * @returns A boolean value. @@ -199,7 +203,7 @@ class Synchronizer { }); } - private fireEvent(sourceViewport: Types.IViewportId, sourceEvent: any): void { + public fireEvent(sourceViewport: Types.IViewportId, sourceEvent: any): void { if (this.isDisabled() || this._ignoreFiredEvents) { return; } @@ -238,7 +242,7 @@ class Synchronizer { } } - private _onEvent = (evt: any): void => { + public _onEvent(evt: any): void { if (this._ignoreFiredEvents === true) { return; } diff --git a/packages/tools/src/synchronizers/callbacks/index.ts b/packages/tools/src/synchronizers/callbacks/index.ts new file mode 100644 index 000000000..543127c96 --- /dev/null +++ b/packages/tools/src/synchronizers/callbacks/index.ts @@ -0,0 +1,11 @@ +import cameraSyncCallback from './cameraSyncCallback'; +import stackImageSyncCallback from './stackImageSyncCallback'; +import voiSyncCallback from './voiSyncCallback'; +import zoomPanSyncCallback from './zoomPanSyncCallback'; + +export { + cameraSyncCallback, + stackImageSyncCallback, + voiSyncCallback, + zoomPanSyncCallback, +}; diff --git a/packages/tools/src/synchronizers/index.ts b/packages/tools/src/synchronizers/index.ts index a349278bf..c44af21ed 100644 --- a/packages/tools/src/synchronizers/index.ts +++ b/packages/tools/src/synchronizers/index.ts @@ -2,10 +2,12 @@ import createCameraPositionSynchronizer from './synchronizers/createCameraPositi import createVOISynchronizer from './synchronizers/createVOISynchronizer'; import createZoomPanSynchronizer from './synchronizers/createZoomPanSynchronizer'; import createStackImageSynchronizer from './synchronizers/createStackImageSynchronizer'; +import * as synchronizerCallbacks from './callbacks'; export { createCameraPositionSynchronizer, createVOISynchronizer, createZoomPanSynchronizer, createStackImageSynchronizer, + synchronizerCallbacks, };