@leapfrog/interactive-canvas 2.0.22-beta-6 → 2.0.22-beta-7

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.
@@ -319,7 +319,7 @@ export declare abstract class AbstractInteractiveCanvas implements IInteractiveC
319
319
  * @override
320
320
  * @inheritDoc
321
321
  */
322
- createPNGStream(multiplier?: number): any;
322
+ createPNGStream(): any;
323
323
  /**
324
324
  * @override
325
325
  * @inheritDoc
@@ -2,7 +2,6 @@ import _, { round, each, values, reduce, clone, max, isEqual } from 'lodash';
2
2
  import { BehaviorSubject, Subject } from 'rxjs';
3
3
  import * as fabric from 'fabric';
4
4
  import { JSDOM } from 'jsdom';
5
- import { createCanvas } from 'canvas';
6
5
 
7
6
  const PIXELS_PER_MM$2 = 3.937;
8
7
  class MillimeterDimensions {
@@ -3489,9 +3488,7 @@ class AbstractInteractiveCanvas {
3489
3488
  * @override
3490
3489
  * @inheritDoc
3491
3490
  */
3492
- createPNGStream(multiplier) {
3493
- ({
3494
- multiplier: multiplier || this.IMAGE_CAPTURE_COEFFICIENT});
3491
+ createPNGStream() {
3495
3492
  return this.fabricCanvas.toDataURL();
3496
3493
  }
3497
3494
  /**
@@ -3737,6 +3734,7 @@ class SelectionData {
3737
3734
  }
3738
3735
  }
3739
3736
 
3737
+ //import { createCanvas, loadImage } from 'canvas';
3740
3738
  class HeadlessInteractiveCanvas extends AbstractInteractiveCanvas {
3741
3739
  constructor() {
3742
3740
  let canvas;
@@ -3752,13 +3750,13 @@ class HeadlessInteractiveCanvas extends AbstractInteractiveCanvas {
3752
3750
  global.window.cancelAnimationFrame = (id) => {
3753
3751
  clearTimeout(id);
3754
3752
  };
3755
- const nodeCanvas = createCanvas(640, 480);
3756
- canvas = new fabric.StaticCanvas(nodeCanvas);
3753
+ // const nodeCanvas = createCanvas(640, 480);
3754
+ // canvas = new fabric.StaticCanvas(nodeCanvas as unknown as HTMLCanvasElement) as Canvas;
3757
3755
  }
3758
- else {
3759
- canvas = new fabric.StaticCanvas(undefined, { width: 640, height: 480 });
3760
- }
3761
- super(fabric, canvas, 0);
3756
+ //else {
3757
+ canvas = new fabric.StaticCanvas(undefined, { width: 640, height: 480 });
3758
+ // }
3759
+ super(fabric, canvas, 1);
3762
3760
  this.headless = true;
3763
3761
  }
3764
3762
  /**
@@ -302,7 +302,7 @@ export interface IInteractiveCanvas {
302
302
  /**
303
303
  * Create a PNG stream of the canvas. Only works on headless canvas.
304
304
  */
305
- createPNGStream(multiplier?: number): any;
305
+ createPNGStream(): any;
306
306
  /**
307
307
  * Save the current state as an undo point.
308
308
  */
@@ -4,7 +4,6 @@ var _ = require('lodash');
4
4
  var rxjs = require('rxjs');
5
5
  var fabric = require('fabric');
6
6
  var jsdom = require('jsdom');
7
- var canvas = require('canvas');
8
7
 
9
8
  function _interopNamespaceDefault(e) {
10
9
  var n = Object.create(null);
@@ -3510,9 +3509,7 @@ class AbstractInteractiveCanvas {
3510
3509
  * @override
3511
3510
  * @inheritDoc
3512
3511
  */
3513
- createPNGStream(multiplier) {
3514
- ({
3515
- multiplier: multiplier || this.IMAGE_CAPTURE_COEFFICIENT});
3512
+ createPNGStream() {
3516
3513
  return this.fabricCanvas.toDataURL();
3517
3514
  }
3518
3515
  /**
@@ -3758,9 +3755,10 @@ class SelectionData {
3758
3755
  }
3759
3756
  }
3760
3757
 
3758
+ //import { createCanvas, loadImage } from 'canvas';
3761
3759
  class HeadlessInteractiveCanvas extends AbstractInteractiveCanvas {
3762
3760
  constructor() {
3763
- let canvas$1;
3761
+ let canvas;
3764
3762
  if (typeof window === "undefined") {
3765
3763
  const { window } = new jsdom.JSDOM('<!DOCTYPE html><html><body></body></html>');
3766
3764
  global.window = window;
@@ -3773,13 +3771,13 @@ class HeadlessInteractiveCanvas extends AbstractInteractiveCanvas {
3773
3771
  global.window.cancelAnimationFrame = (id) => {
3774
3772
  clearTimeout(id);
3775
3773
  };
3776
- const nodeCanvas = canvas.createCanvas(640, 480);
3777
- canvas$1 = new fabric__namespace.StaticCanvas(nodeCanvas);
3774
+ // const nodeCanvas = createCanvas(640, 480);
3775
+ // canvas = new fabric.StaticCanvas(nodeCanvas as unknown as HTMLCanvasElement) as Canvas;
3778
3776
  }
3779
- else {
3780
- canvas$1 = new fabric__namespace.StaticCanvas(undefined, { width: 640, height: 480 });
3781
- }
3782
- super(fabric__namespace, canvas$1, 0);
3777
+ //else {
3778
+ canvas = new fabric__namespace.StaticCanvas(undefined, { width: 640, height: 480 });
3779
+ // }
3780
+ super(fabric__namespace, canvas, 1);
3783
3781
  this.headless = true;
3784
3782
  }
3785
3783
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leapfrog/interactive-canvas",
3
- "version": "2.0.22-beta-6",
3
+ "version": "2.0.22-beta-7",
4
4
  "description": "Leapfrog interactive canvas",
5
5
  "files": [
6
6
  "dist"
@@ -19,7 +19,6 @@
19
19
  "typescript": "^6.0.3"
20
20
  },
21
21
  "dependencies": {
22
- "canvas": "^3.2.3",
23
22
  "fabric": "^7.2.0",
24
23
  "jsdom": "^29.0.2",
25
24
  "lodash": "^4.18.1",