react-design-editor 0.0.55 → 0.0.56

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.
@@ -358,7 +358,7 @@ class Handler {
358
358
  obj.set('src', source);
359
359
  resolve(obj.setSrc(source, () => this.canvas.renderAll(), {
360
360
  dirty: true,
361
- crossOrigin: "anonymous"
361
+ crossOrigin: 'anonymous',
362
362
  }));
363
363
  }
364
364
  });
@@ -1,7 +1,7 @@
1
1
  /// <reference types="lodash" />
2
- import Handler from './Handler';
3
2
  import { FabricObject } from '../utils';
4
- export declare type TransactionType = 'add' | 'remove' | 'moved' | 'scaled' | 'rotated' | 'skewed' | 'group' | 'ungroup' | 'paste' | 'bringForward' | 'bringToFront' | 'sendBackwards' | 'sendToBack' | 'redo' | 'undo';
3
+ import Handler from './Handler';
4
+ export declare type TransactionType = 'add' | 'remove' | 'modified' | 'moved' | 'scaled' | 'rotated' | 'skewed' | 'group' | 'ungroup' | 'paste' | 'bringForward' | 'bringToFront' | 'sendBackwards' | 'sendToBack' | 'redo' | 'undo';
5
5
  export interface TransactionTransform {
6
6
  scaleX?: number;
7
7
  scaleY?: number;
@@ -2,33 +2,37 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const fabric_1 = require("fabric");
4
4
  require("gifler");
5
- const Gif = fabric_1.fabric.util.createClass(fabric_1.fabric.Object, {
5
+ const Gif = fabric_1.fabric.util.createClass(fabric_1.fabric.Image, {
6
6
  type: 'gif',
7
7
  superType: 'image',
8
8
  gifCanvas: null,
9
+ gifler: undefined,
9
10
  isStarted: false,
10
11
  initialize(options) {
11
12
  options = options || {};
12
- this.callSuper('initialize', options);
13
13
  this.gifCanvas = document.createElement('canvas');
14
+ this.callSuper('initialize', this.gifCanvas, options);
14
15
  },
15
16
  drawFrame(ctx, frame) {
16
17
  // update canvas size
17
18
  this.gifCanvas.width = frame.width;
18
19
  this.gifCanvas.height = frame.height;
19
20
  // update canvas that we are using for fabric.js
20
- ctx.drawImage(frame.buffer, -frame.width / 2, -frame.height / 2, frame.width, frame.height);
21
+ ctx.drawImage(frame.buffer, 0, 0);
22
+ this.canvas?.renderAll();
21
23
  },
22
24
  _render(ctx) {
23
25
  this.callSuper('_render', ctx);
26
+ this.dirty = true;
24
27
  if (!this.isStarted) {
25
28
  this.isStarted = true;
26
- window
29
+ this.gifler = window
27
30
  // @ts-ignore
28
- .gifler('./images/sample/earth.gif')
29
- .frames(this.gifCanvas, (_c, frame) => {
31
+ .gifler('https://themadcreator.github.io/gifler/assets/gif/nyan.gif')
32
+ // .gifler('./images/sample/earth.gif')
33
+ .frames(this.gifCanvas, (context, frame) => {
30
34
  this.isStarted = true;
31
- this.drawFrame(ctx, frame);
35
+ this.drawFrame(context, frame);
32
36
  });
33
37
  }
34
38
  },
@@ -43,8 +43,8 @@ const Svg = fabric_1.fabric.util.createClass(fabric_1.fabric.Group, {
43
43
  this.add(createdObj);
44
44
  }
45
45
  this.set({
46
- fill: options.fill || 'rgba(0, 0, 0, 1)',
47
- stroke: options.stroke || 'rgba(255, 255, 255, 0)',
46
+ fill: options.fill,
47
+ stroke: options.stroke,
48
48
  });
49
49
  this.setCoords();
50
50
  if (this.canvas) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-design-editor",
3
- "version": "0.0.55",
3
+ "version": "0.0.56",
4
4
  "description": "Design Editor Tools with React.js + ant.design + fabric.js",
5
5
  "main": "dist/react-design-editor.min.js",
6
6
  "typings": "lib/index.d.ts",