react-design-editor 0.0.54 → 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.
- package/dist/react-design-editor.js +47 -14
- package/dist/react-design-editor.min.js +1 -1
- package/lib/handlers/AlignmentHandler.d.ts +4 -0
- package/lib/handlers/AlignmentHandler.js +19 -3
- package/lib/handlers/Handler.js +10 -2
- package/lib/handlers/TransactionHandler.d.ts +2 -2
- package/lib/handlers/WorkareaHandler.js +1 -1
- package/lib/objects/Gif.js +11 -7
- package/lib/objects/Svg.js +2 -2
- package/package.json +1 -1
|
@@ -194261,6 +194261,8 @@ var WorkareaHandler_WorkareaHandler = /*#__PURE__*/function () {
|
|
|
194261
194261
|
|
|
194262
194262
|
canvas.renderAll();
|
|
194263
194263
|
resolve(workarea);
|
|
194264
|
+
}, {
|
|
194265
|
+
crossOrigin: 'anonymous'
|
|
194264
194266
|
});
|
|
194265
194267
|
}));
|
|
194266
194268
|
|
|
@@ -198267,35 +198269,41 @@ var gifler = __webpack_require__(1135);
|
|
|
198267
198269
|
// CONCATENATED MODULE: ./src/canvas/objects/Gif.ts
|
|
198268
198270
|
|
|
198269
198271
|
|
|
198270
|
-
var Gif = fabric["fabric"].util.createClass(fabric["fabric"].
|
|
198272
|
+
var Gif = fabric["fabric"].util.createClass(fabric["fabric"].Image, {
|
|
198271
198273
|
type: 'gif',
|
|
198272
198274
|
superType: 'image',
|
|
198273
198275
|
gifCanvas: null,
|
|
198276
|
+
gifler: undefined,
|
|
198274
198277
|
isStarted: false,
|
|
198275
198278
|
initialize: function initialize(options) {
|
|
198276
198279
|
options = options || {};
|
|
198277
|
-
this.callSuper('initialize', options);
|
|
198278
198280
|
this.gifCanvas = document.createElement('canvas');
|
|
198281
|
+
this.callSuper('initialize', this.gifCanvas, options);
|
|
198279
198282
|
},
|
|
198280
198283
|
drawFrame: function drawFrame(ctx, frame) {
|
|
198284
|
+
var _this$canvas;
|
|
198285
|
+
|
|
198281
198286
|
// update canvas size
|
|
198282
198287
|
this.gifCanvas.width = frame.width;
|
|
198283
198288
|
this.gifCanvas.height = frame.height; // update canvas that we are using for fabric.js
|
|
198284
198289
|
|
|
198285
|
-
ctx.drawImage(frame.buffer,
|
|
198290
|
+
ctx.drawImage(frame.buffer, 0, 0);
|
|
198291
|
+
(_this$canvas = this.canvas) === null || _this$canvas === void 0 ? void 0 : _this$canvas.renderAll();
|
|
198286
198292
|
},
|
|
198287
198293
|
_render: function _render(ctx) {
|
|
198288
198294
|
var _this = this;
|
|
198289
198295
|
|
|
198290
198296
|
this.callSuper('_render', ctx);
|
|
198297
|
+
this.dirty = true;
|
|
198291
198298
|
|
|
198292
198299
|
if (!this.isStarted) {
|
|
198293
198300
|
this.isStarted = true;
|
|
198294
|
-
window // @ts-ignore
|
|
198295
|
-
.gifler('./images/sample/earth.gif')
|
|
198301
|
+
this.gifler = window // @ts-ignore
|
|
198302
|
+
.gifler('https://themadcreator.github.io/gifler/assets/gif/nyan.gif') // .gifler('./images/sample/earth.gif')
|
|
198303
|
+
.frames(this.gifCanvas, function (context, frame) {
|
|
198296
198304
|
_this.isStarted = true;
|
|
198297
198305
|
|
|
198298
|
-
_this.drawFrame(
|
|
198306
|
+
_this.drawFrame(context, frame);
|
|
198299
198307
|
});
|
|
198300
198308
|
}
|
|
198301
198309
|
}
|
|
@@ -198559,8 +198567,8 @@ var Svg = fabric["fabric"].util.createClass(fabric["fabric"].Group, {
|
|
|
198559
198567
|
}
|
|
198560
198568
|
|
|
198561
198569
|
this.set({
|
|
198562
|
-
fill: options.fill
|
|
198563
|
-
stroke: options.stroke
|
|
198570
|
+
fill: options.fill,
|
|
198571
|
+
stroke: options.stroke
|
|
198564
198572
|
});
|
|
198565
198573
|
this.setCoords();
|
|
198566
198574
|
|
|
@@ -199439,6 +199447,22 @@ var AlignmentHandler_AlignmentHandler = /*#__PURE__*/createClass_default()(funct
|
|
|
199439
199447
|
}
|
|
199440
199448
|
};
|
|
199441
199449
|
|
|
199450
|
+
this.middle = function () {
|
|
199451
|
+
var activeObject = _this.handler.canvas.getActiveObject();
|
|
199452
|
+
|
|
199453
|
+
if (activeObject && activeObject.type === 'activeSelection') {
|
|
199454
|
+
var activeSelection = activeObject;
|
|
199455
|
+
activeSelection.forEachObject(function (obj) {
|
|
199456
|
+
obj.set({
|
|
199457
|
+
top: 0 - obj.width * obj.scaleX / 2
|
|
199458
|
+
});
|
|
199459
|
+
obj.setCoords();
|
|
199460
|
+
|
|
199461
|
+
_this.handler.canvas.renderAll();
|
|
199462
|
+
});
|
|
199463
|
+
}
|
|
199464
|
+
};
|
|
199465
|
+
|
|
199442
199466
|
this.right = function () {
|
|
199443
199467
|
var activeObject = _this.handler.canvas.getActiveObject();
|
|
199444
199468
|
|
|
@@ -202182,7 +202206,8 @@ var Handler_Handler = /*#__PURE__*/function () {
|
|
|
202182
202206
|
resolve(obj.setSrc(source, function () {
|
|
202183
202207
|
return _this.canvas.renderAll();
|
|
202184
202208
|
}, {
|
|
202185
|
-
dirty: true
|
|
202209
|
+
dirty: true,
|
|
202210
|
+
crossOrigin: 'anonymous'
|
|
202186
202211
|
}));
|
|
202187
202212
|
}
|
|
202188
202213
|
});
|
|
@@ -203463,16 +203488,21 @@ var Handler_Handler = /*#__PURE__*/function () {
|
|
|
203463
203488
|
format: 'png',
|
|
203464
203489
|
quality: 1
|
|
203465
203490
|
};
|
|
203466
|
-
|
|
203467
203491
|
// If it's zoomed out/in, the container will also include in the image
|
|
203468
203492
|
// hence need to reset the zoom level.
|
|
203469
|
-
_this.zoomHandler.zoomOneToOne();
|
|
203470
|
-
|
|
203471
203493
|
var _this$workarea2 = _this.workarea,
|
|
203472
203494
|
left = _this$workarea2.left,
|
|
203473
203495
|
top = _this$workarea2.top,
|
|
203474
203496
|
width = _this$workarea2.width,
|
|
203475
|
-
height = _this$workarea2.height
|
|
203497
|
+
height = _this$workarea2.height,
|
|
203498
|
+
scaleX = _this$workarea2.scaleX,
|
|
203499
|
+
scaleY = _this$workarea2.scaleY;
|
|
203500
|
+
width = Math.ceil(width * scaleX);
|
|
203501
|
+
height = Math.ceil(height * scaleY); // cachedVT is used to reset the viewportTransform after the image is saved.
|
|
203502
|
+
|
|
203503
|
+
var cachedVT = _this.canvas.viewportTransform; // reset the viewportTransform to default (no zoom)
|
|
203504
|
+
|
|
203505
|
+
_this.canvas.viewportTransform = [1, 0, 0, 1, 0, 0];
|
|
203476
203506
|
|
|
203477
203507
|
var dataUrl = _this.canvas.toDataURL(Handler_objectSpread(Handler_objectSpread({}, option), {}, {
|
|
203478
203508
|
left: left,
|
|
@@ -203489,7 +203519,10 @@ var Handler_Handler = /*#__PURE__*/function () {
|
|
|
203489
203519
|
document.body.appendChild(anchorEl);
|
|
203490
203520
|
anchorEl.click();
|
|
203491
203521
|
anchorEl.remove();
|
|
203492
|
-
}
|
|
203522
|
+
} // reset the viewportTransform to previous value.
|
|
203523
|
+
|
|
203524
|
+
|
|
203525
|
+
_this.canvas.viewportTransform = cachedVT;
|
|
203493
203526
|
};
|
|
203494
203527
|
|
|
203495
203528
|
this.rotate = function (angle) {
|