Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | 5x 5x 5x 1x 1x 1x 1x 1x 1x 5x | import { state } from '../index';
import Synchronizer from './Synchronizer';
/**
* It returns all synchronizers that are not disabled and have a source viewport
* with the given rendering engine Id and viewport Id
* @param renderingEngineId - The Id of the rendering engine
* @param viewportId - The Id of the viewport
* @returns An array of synchronizers
*/
function getSynchronizersForViewport(
viewportId: string,
renderingEngineId: string
): Array<Synchronizer> {
const synchronizersFilteredByIds = [];
Iif (!renderingEngineId && !viewportId) {
throw new Error(
'At least one of renderingEngineId or viewportId should be given'
);
}
for (let i = 0; i < state.synchronizers.length; i++) {
const synchronizer = state.synchronizers[i];
const notDisabled = !synchronizer.isDisabled();
const hasSourceViewport = synchronizer.hasSourceViewport(
renderingEngineId,
viewportId
);
const hasTargetViewport = synchronizer.hasTargetViewport(
renderingEngineId,
viewportId
);
Eif (notDisabled && (hasSourceViewport || hasTargetViewport)) {
synchronizersFilteredByIds.push(synchronizer);
}
}
return synchronizersFilteredByIds;
}
export default getSynchronizersForViewport;
|