@leapfrog/interactive-canvas 2.0.22-beta-6 → 2.0.22-beta-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.
|
@@ -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(
|
|
3493
|
-
({
|
|
3494
|
-
multiplier: multiplier || this.IMAGE_CAPTURE_COEFFICIENT});
|
|
3491
|
+
createPNGStream() {
|
|
3495
3492
|
return this.fabricCanvas.toDataURL();
|
|
3496
3493
|
}
|
|
3497
3494
|
/**
|
|
@@ -3739,7 +3736,6 @@ class SelectionData {
|
|
|
3739
3736
|
|
|
3740
3737
|
class HeadlessInteractiveCanvas extends AbstractInteractiveCanvas {
|
|
3741
3738
|
constructor() {
|
|
3742
|
-
let canvas;
|
|
3743
3739
|
if (typeof window === "undefined") {
|
|
3744
3740
|
const { window } = new JSDOM('<!DOCTYPE html><html><body></body></html>');
|
|
3745
3741
|
global.window = window;
|
|
@@ -3752,13 +3748,8 @@ class HeadlessInteractiveCanvas extends AbstractInteractiveCanvas {
|
|
|
3752
3748
|
global.window.cancelAnimationFrame = (id) => {
|
|
3753
3749
|
clearTimeout(id);
|
|
3754
3750
|
};
|
|
3755
|
-
const nodeCanvas = createCanvas(640, 480);
|
|
3756
|
-
canvas = new fabric.StaticCanvas(nodeCanvas);
|
|
3757
3751
|
}
|
|
3758
|
-
|
|
3759
|
-
canvas = new fabric.StaticCanvas(undefined, { width: 640, height: 480 });
|
|
3760
|
-
}
|
|
3761
|
-
super(fabric, canvas, 0);
|
|
3752
|
+
super(fabric, new fabric.StaticCanvas(undefined, { width: 640, height: 480 }), 1);
|
|
3762
3753
|
this.headless = true;
|
|
3763
3754
|
}
|
|
3764
3755
|
/**
|
|
@@ -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(
|
|
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(
|
|
3514
|
-
({
|
|
3515
|
-
multiplier: multiplier || this.IMAGE_CAPTURE_COEFFICIENT});
|
|
3512
|
+
createPNGStream() {
|
|
3516
3513
|
return this.fabricCanvas.toDataURL();
|
|
3517
3514
|
}
|
|
3518
3515
|
/**
|
|
@@ -3760,7 +3757,6 @@ class SelectionData {
|
|
|
3760
3757
|
|
|
3761
3758
|
class HeadlessInteractiveCanvas extends AbstractInteractiveCanvas {
|
|
3762
3759
|
constructor() {
|
|
3763
|
-
let canvas$1;
|
|
3764
3760
|
if (typeof window === "undefined") {
|
|
3765
3761
|
const { window } = new jsdom.JSDOM('<!DOCTYPE html><html><body></body></html>');
|
|
3766
3762
|
global.window = window;
|
|
@@ -3773,13 +3769,8 @@ class HeadlessInteractiveCanvas extends AbstractInteractiveCanvas {
|
|
|
3773
3769
|
global.window.cancelAnimationFrame = (id) => {
|
|
3774
3770
|
clearTimeout(id);
|
|
3775
3771
|
};
|
|
3776
|
-
const nodeCanvas = canvas.createCanvas(640, 480);
|
|
3777
|
-
canvas$1 = new fabric__namespace.StaticCanvas(nodeCanvas);
|
|
3778
3772
|
}
|
|
3779
|
-
|
|
3780
|
-
canvas$1 = new fabric__namespace.StaticCanvas(undefined, { width: 640, height: 480 });
|
|
3781
|
-
}
|
|
3782
|
-
super(fabric__namespace, canvas$1, 0);
|
|
3773
|
+
super(fabric__namespace, new fabric__namespace.StaticCanvas(undefined, { width: 640, height: 480 }), 1);
|
|
3783
3774
|
this.headless = true;
|
|
3784
3775
|
}
|
|
3785
3776
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leapfrog/interactive-canvas",
|
|
3
|
-
"version": "2.0.22-beta-
|
|
3
|
+
"version": "2.0.22-beta-8",
|
|
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",
|