@lijuhong1981/jsgif 1.0.6 → 1.0.8

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 (2) hide show
  1. package/index.js +12 -8
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -461,9 +461,13 @@ function GifPlayer(options = {}) {
461
461
  CANVAS_CTX.drawImage(TEMP_CANVAS, 0, 0);
462
462
  }
463
463
 
464
- function doCurrentFrame() {
464
+ function drawCurrentFrame() {
465
465
  const frame = FRAME_LIST[currentFrameIndex];
466
466
  drawFrame(frame);
467
+ }
468
+
469
+ function doFrame() {
470
+ drawCurrentFrame();
467
471
  if (typeof options.onFrameChanged === 'function') {
468
472
  options.onFrameChanged(currentFrameIndex, frame);
469
473
  }
@@ -471,7 +475,7 @@ function GifPlayer(options = {}) {
471
475
  if (!isPlaying)
472
476
  return;
473
477
  currentFrameIndex = getNextFrameIndex();
474
- doCurrentFrame();
478
+ doFrame();
475
479
  }, frame.delayTime * options.timeScale * 10);
476
480
  }
477
481
 
@@ -482,7 +486,7 @@ function GifPlayer(options = {}) {
482
486
 
483
487
  isPlaying = true;
484
488
 
485
- doCurrentFrame();
489
+ doFrame();
486
490
 
487
491
  return player;
488
492
  }
@@ -497,6 +501,7 @@ function GifPlayer(options = {}) {
497
501
  isPlaying = false;
498
502
 
499
503
  currentFrameIndex = 0;
504
+ drawCurrentFrame();
500
505
 
501
506
  return player;
502
507
  }
@@ -625,16 +630,15 @@ function GifPlayer(options = {}) {
625
630
  return options.onFrameChanged;
626
631
  }
627
632
  },
628
- isDestroyed: {
629
- value: function () {
630
- return false;
631
- },
632
- },
633
633
  destroy: {
634
634
  value: destroyGif,
635
635
  },
636
636
  });
637
637
 
638
+ player.isDestroyed = function () {
639
+ return false;
640
+ };
641
+
638
642
  return player;
639
643
  };
640
644
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lijuhong1981/jsgif",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "> TODO: description",
5
5
  "author": "lijuhong1981",
6
6
  "homepage": "https://github.com/lijuhong1981/jslibs#readme",
@@ -18,5 +18,5 @@
18
18
  "bugs": {
19
19
  "url": "https://github.com/lijuhong1981/jslibs/issues"
20
20
  },
21
- "gitHead": "0cd088b384359010fbe891a8242f16bcecc481ab"
21
+ "gitHead": "41eaaf2e07770b704c80b27f40b0f033e80dfe9e"
22
22
  }