@leapfrog/interactive-canvas 2.0.23-beta-4 → 2.0.23-beta-5

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.
@@ -1,7 +1,8 @@
1
1
  import _, { round, each, values, reduce, clone, max, isEqual } from 'lodash';
2
2
  import { BehaviorSubject, Subject } from 'rxjs';
3
- import { createCanvas, loadImage } from 'canvas';
4
3
  import * as fabric from 'fabric';
4
+ import { FabricImage } from 'fabric';
5
+ import { loadImage } from 'canvas';
5
6
 
6
7
  const PIXELS_PER_MM$2 = 3.937;
7
8
  class MillimeterDimensions {
@@ -3042,7 +3043,7 @@ class AbstractInteractiveCanvas {
3042
3043
  const options = { crossOrigin: "anonymous" };
3043
3044
  if (this.headless) {
3044
3045
  // Server-side logic without mock DOM
3045
- createCanvas(1, 1);
3046
+ //const canvas = createCanvas(1, 1);
3046
3047
  //const ctx = canvas.getContext("2d");
3047
3048
  const image = yield loadImage(imageUrl);
3048
3049
  const id = this.randomId();
@@ -3052,7 +3053,7 @@ class AbstractInteractiveCanvas {
3052
3053
  newScale = maxWidth / curWidth;
3053
3054
  }
3054
3055
  // Set image properties and add to the canvas
3055
- const fabricImage = new this.fabric.Image(image, {
3056
+ const fabricImage = new FabricImage(imageUrl, {
3056
3057
  id: id,
3057
3058
  scaleX: newScale,
3058
3059
  scaleY: newScale,
@@ -2,8 +2,8 @@
2
2
 
3
3
  var _ = require('lodash');
4
4
  var rxjs = require('rxjs');
5
- var canvas = require('canvas');
6
5
  var fabric = require('fabric');
6
+ var canvas = require('canvas');
7
7
 
8
8
  function _interopNamespaceDefault(e) {
9
9
  var n = Object.create(null);
@@ -3063,7 +3063,7 @@ class AbstractInteractiveCanvas {
3063
3063
  const options = { crossOrigin: "anonymous" };
3064
3064
  if (this.headless) {
3065
3065
  // Server-side logic without mock DOM
3066
- canvas.createCanvas(1, 1);
3066
+ //const canvas = createCanvas(1, 1);
3067
3067
  //const ctx = canvas.getContext("2d");
3068
3068
  const image = yield canvas.loadImage(imageUrl);
3069
3069
  const id = this.randomId();
@@ -3073,7 +3073,7 @@ class AbstractInteractiveCanvas {
3073
3073
  newScale = maxWidth / curWidth;
3074
3074
  }
3075
3075
  // Set image properties and add to the canvas
3076
- const fabricImage = new this.fabric.Image(image, {
3076
+ const fabricImage = new fabric.FabricImage(imageUrl, {
3077
3077
  id: id,
3078
3078
  scaleX: newScale,
3079
3079
  scaleY: newScale,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leapfrog/interactive-canvas",
3
- "version": "2.0.23-beta-4",
3
+ "version": "2.0.23-beta-5",
4
4
  "description": "Leapfrog interactive canvas",
5
5
  "files": [
6
6
  "dist"