@cornerstonejs/core 1.80.0 → 1.80.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/core",
3
- "version": "1.80.0",
3
+ "version": "1.80.2",
4
4
  "description": "",
5
5
  "main": "src/index.ts",
6
6
  "types": "dist/types/index.d.ts",
@@ -47,5 +47,5 @@
47
47
  "type": "individual",
48
48
  "url": "https://ohif.org/donate"
49
49
  },
50
- "gitHead": "76a9f8014ec175f94193989b02a9be792bc9d41f"
50
+ "gitHead": "ec105a93611d3cbcdba011bb4681ae3dd501f0f0"
51
51
  }
@@ -335,9 +335,9 @@ class VideoViewport extends Viewport implements IVideoViewport {
335
335
  public async play() {
336
336
  try {
337
337
  if (!this.isPlaying) {
338
+ this.isPlaying = true;
338
339
  // Play returns a promise that is true when playing completes.
339
340
  await this.videoElement.play();
340
- this.isPlaying = true;
341
341
  this.renderWhilstPlaying();
342
342
  }
343
343
  } catch (e) {
@@ -346,10 +346,10 @@ class VideoViewport extends Viewport implements IVideoViewport {
346
346
  }
347
347
  }
348
348
 
349
- public async pause() {
349
+ public pause() {
350
350
  try {
351
- await this.videoElement.pause();
352
351
  this.isPlaying = false;
352
+ this.videoElement.pause();
353
353
  } catch (e) {
354
354
  // No-op - sometimes this happens on startup
355
355
  }
@@ -808,7 +808,7 @@ class VideoViewport extends Viewport implements IVideoViewport {
808
808
  }
809
809
 
810
810
  public getSliceIndex() {
811
- return this.getCurrentImageIdIndex();
811
+ return this.getCurrentImageIdIndex() / this.scrollSpeed;
812
812
  }
813
813
 
814
814
  public getCamera(): ICamera {
@@ -853,6 +853,10 @@ class VideoViewport extends Viewport implements IVideoViewport {
853
853
  return isNaN(computedSlices) ? this.numberOfFrames : computedSlices;
854
854
  };
855
855
 
856
+ public getFrameRate() {
857
+ return this.fps;
858
+ }
859
+
856
860
  public getFrameOfReferenceUID = (): string => {
857
861
  // The video itself is the frame of reference.
858
862
  return this.videoElement.src;
@@ -1110,6 +1114,8 @@ class VideoViewport extends Viewport implements IVideoViewport {
1110
1114
  element: this.element,
1111
1115
  viewportId: this.id,
1112
1116
  viewport: this,
1117
+ imageIndex: this.getCurrentImageIdIndex(),
1118
+ numberOfSlices: this.numberOfFrames,
1113
1119
  renderingEngineId: this.renderingEngineId,
1114
1120
  time: this.videoElement.currentTime,
1115
1121
  duration: this.videoElement.duration,
@@ -5,5 +5,8 @@
5
5
  * @returns a v4 compliant GUID
6
6
  */
7
7
  export default function uuidv4(): string {
8
- return crypto.randomUUID();
8
+ // @ts-ignore
9
+ return crypto.randomUUID?.() || ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c =>
10
+ (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
11
+ );
9
12
  }