@leapfrog/interactive-canvas 2.0.23-beta-8 → 2.0.24-beta-1

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,7 @@
1
1
  import _, { round, each, values, reduce, clone, max, isEqual } from 'lodash';
2
2
  import { BehaviorSubject, Subject } from 'rxjs';
3
- import { loadImage } from 'canvas';
4
3
  import * as fabric from 'fabric';
4
+ import { loadImage } from 'canvas';
5
5
 
6
6
  const PIXELS_PER_MM$2 = 3.937;
7
7
  class MillimeterDimensions {
@@ -3045,23 +3045,20 @@ class AbstractInteractiveCanvas {
3045
3045
  //const canvas = createCanvas(1, 1);
3046
3046
  //const ctx = canvas.getContext("2d");
3047
3047
  const image = yield loadImage(imageUrl);
3048
- const fabricImage = new this.fabric.Image(image, { src: imageUrl, crossOrigin: "anonymous" });
3048
+ const fabricImage = new this.fabric.Image(image, {
3049
+ src: imageUrl,
3050
+ crossOrigin: "anonymous",
3051
+ toObject: function () {
3052
+ return Object.assign(Object.assign({}, fabric.Object.prototype.toObject.call(this)), { src: this.src, crossOrigin: this.crossOrigin });
3053
+ },
3054
+ });
3055
+ //const fabricImage = new this.fabric.Image(image as any, { src: imageUrl, crossOrigin: "anonymous" });
3049
3056
  const id = this.randomId();
3050
3057
  let newScale = 1;
3051
3058
  const curWidth = newScale * fabricImage.width;
3052
3059
  if (curWidth > maxWidth) {
3053
3060
  newScale = maxWidth / curWidth;
3054
3061
  }
3055
- /*const fabricImage = new this.fabric.Image(image as any, {
3056
- src: imageUrl,
3057
- crossOrigin: "anonymous",
3058
- toObject: function () {
3059
- return {
3060
- ...this.callSuper("toObject"),
3061
- src: this.src,
3062
- };
3063
- },
3064
- });*/
3065
3062
  // Set image properties and add to the canvas
3066
3063
  // const fabricImage = new FabricImage(imageUrl, {
3067
3064
  //const fabricImage = new this.fabric.Image(image, {
@@ -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);
@@ -3066,23 +3066,20 @@ class AbstractInteractiveCanvas {
3066
3066
  //const canvas = createCanvas(1, 1);
3067
3067
  //const ctx = canvas.getContext("2d");
3068
3068
  const image = yield canvas.loadImage(imageUrl);
3069
- const fabricImage = new this.fabric.Image(image, { src: imageUrl, crossOrigin: "anonymous" });
3069
+ const fabricImage = new this.fabric.Image(image, {
3070
+ src: imageUrl,
3071
+ crossOrigin: "anonymous",
3072
+ toObject: function () {
3073
+ return Object.assign(Object.assign({}, fabric__namespace.Object.prototype.toObject.call(this)), { src: this.src, crossOrigin: this.crossOrigin });
3074
+ },
3075
+ });
3076
+ //const fabricImage = new this.fabric.Image(image as any, { src: imageUrl, crossOrigin: "anonymous" });
3070
3077
  const id = this.randomId();
3071
3078
  let newScale = 1;
3072
3079
  const curWidth = newScale * fabricImage.width;
3073
3080
  if (curWidth > maxWidth) {
3074
3081
  newScale = maxWidth / curWidth;
3075
3082
  }
3076
- /*const fabricImage = new this.fabric.Image(image as any, {
3077
- src: imageUrl,
3078
- crossOrigin: "anonymous",
3079
- toObject: function () {
3080
- return {
3081
- ...this.callSuper("toObject"),
3082
- src: this.src,
3083
- };
3084
- },
3085
- });*/
3086
3083
  // Set image properties and add to the canvas
3087
3084
  // const fabricImage = new FabricImage(imageUrl, {
3088
3085
  //const fabricImage = new this.fabric.Image(image, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leapfrog/interactive-canvas",
3
- "version": "2.0.23-beta-8",
3
+ "version": "2.0.24-beta-1",
4
4
  "description": "Leapfrog interactive canvas",
5
5
  "files": [
6
6
  "dist"