feat(viewport): Added getter for presentation id provider. (#5053)
This commit is contained in:
parent
cf1018c779
commit
338bd865c3
@ -1,5 +1,10 @@
|
|||||||
import { PubSubService } from '../_shared/pubSubServiceInterface';
|
import { PubSubService } from '../_shared/pubSubServiceInterface';
|
||||||
|
|
||||||
|
type PresentationIdProvider = (
|
||||||
|
id: string,
|
||||||
|
{ viewport, viewports, isUpdatingSameViewport }
|
||||||
|
) => unknown;
|
||||||
|
|
||||||
class ViewportGridService extends PubSubService {
|
class ViewportGridService extends PubSubService {
|
||||||
public static readonly EVENTS = {
|
public static readonly EVENTS = {
|
||||||
ACTIVE_VIEWPORT_ID_CHANGED: 'event::activeviewportidchanged',
|
ACTIVE_VIEWPORT_ID_CHANGED: 'event::activeviewportidchanged',
|
||||||
@ -20,10 +25,7 @@ class ViewportGridService extends PubSubService {
|
|||||||
|
|
||||||
serviceImplementation = {};
|
serviceImplementation = {};
|
||||||
servicesManager: AppTypes.ServicesManager;
|
servicesManager: AppTypes.ServicesManager;
|
||||||
presentationIdProviders: Map<
|
presentationIdProviders: Map<string, PresentationIdProvider>;
|
||||||
string,
|
|
||||||
(id: string, { viewport, viewports, isUpdatingSameViewport, servicesManager }) => unknown
|
|
||||||
>;
|
|
||||||
|
|
||||||
constructor({ servicesManager }) {
|
constructor({ servicesManager }) {
|
||||||
super(ViewportGridService.EVENTS);
|
super(ViewportGridService.EVENTS);
|
||||||
@ -32,13 +34,17 @@ class ViewportGridService extends PubSubService {
|
|||||||
this.presentationIdProviders = new Map();
|
this.presentationIdProviders = new Map();
|
||||||
}
|
}
|
||||||
|
|
||||||
public addPresentationIdProvider(
|
public addPresentationIdProvider(id: string, provider: PresentationIdProvider): void {
|
||||||
id: string,
|
|
||||||
provider: (id: string, { viewport, viewports, isUpdatingSameViewport }) => unknown
|
|
||||||
): void {
|
|
||||||
this.presentationIdProviders.set(id, provider);
|
this.presentationIdProviders.set(id, provider);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the presentation provider with the given id.
|
||||||
|
*/
|
||||||
|
public getPresentationIdProvider(id: string): PresentationIdProvider {
|
||||||
|
return this.presentationIdProviders.get(id);
|
||||||
|
}
|
||||||
|
|
||||||
public setIsReferenceViewable(viewportId: string, isReferenceViewable: boolean): void {
|
public setIsReferenceViewable(viewportId: string, isReferenceViewable: boolean): void {
|
||||||
this.serviceImplementation._setIsReferenceViewable(viewportId, isReferenceViewable);
|
this.serviceImplementation._setIsReferenceViewable(viewportId, isReferenceViewable);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user