@postermywall/fabricjs-2 6.4.3-pmw-34 → 6.4.3-pmw-36

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.
Files changed (52) hide show
  1. package/dist/index.js +7 -66
  2. package/dist/index.js.map +1 -1
  3. package/dist/index.min.js +1 -1
  4. package/dist/index.min.js.map +1 -1
  5. package/dist/index.min.mjs +1 -1
  6. package/dist/index.min.mjs.map +1 -1
  7. package/dist/index.mjs +7 -66
  8. package/dist/index.mjs.map +1 -1
  9. package/dist/index.node.cjs +7 -66
  10. package/dist/index.node.cjs.map +1 -1
  11. package/dist/index.node.mjs +7 -66
  12. package/dist/index.node.mjs.map +1 -1
  13. package/dist/package.json.min.mjs +1 -1
  14. package/dist/package.json.mjs +1 -1
  15. package/dist/src/canvas/Canvas.d.ts.map +1 -1
  16. package/dist/src/canvas/Canvas.min.mjs +1 -1
  17. package/dist/src/canvas/Canvas.min.mjs.map +1 -1
  18. package/dist/src/canvas/Canvas.mjs +3 -13
  19. package/dist/src/canvas/Canvas.mjs.map +1 -1
  20. package/dist/src/canvas/StaticCanvas.d.ts.map +1 -1
  21. package/dist/src/canvas/StaticCanvas.min.mjs +1 -1
  22. package/dist/src/canvas/StaticCanvas.min.mjs.map +1 -1
  23. package/dist/src/canvas/StaticCanvas.mjs +0 -27
  24. package/dist/src/canvas/StaticCanvas.mjs.map +1 -1
  25. package/dist/src/shapes/Group.d.ts +1 -0
  26. package/dist/src/shapes/Group.d.ts.map +1 -1
  27. package/dist/src/shapes/Group.min.mjs +1 -1
  28. package/dist/src/shapes/Group.min.mjs.map +1 -1
  29. package/dist/src/shapes/Group.mjs +3 -0
  30. package/dist/src/shapes/Group.mjs.map +1 -1
  31. package/dist/src/shapes/Image.d.ts.map +1 -1
  32. package/dist/src/shapes/Image.min.mjs +1 -1
  33. package/dist/src/shapes/Image.min.mjs.map +1 -1
  34. package/dist/src/shapes/Image.mjs +0 -3
  35. package/dist/src/shapes/Image.mjs.map +1 -1
  36. package/dist/src/shapes/Object/Object.d.ts.map +1 -1
  37. package/dist/src/shapes/Object/Object.min.mjs +1 -1
  38. package/dist/src/shapes/Object/Object.min.mjs.map +1 -1
  39. package/dist/src/shapes/Object/Object.mjs +0 -22
  40. package/dist/src/shapes/Object/Object.mjs.map +1 -1
  41. package/dist-extensions/src/canvas/Canvas.d.ts.map +1 -1
  42. package/dist-extensions/src/canvas/StaticCanvas.d.ts.map +1 -1
  43. package/dist-extensions/src/shapes/Group.d.ts +1 -0
  44. package/dist-extensions/src/shapes/Group.d.ts.map +1 -1
  45. package/dist-extensions/src/shapes/Image.d.ts.map +1 -1
  46. package/dist-extensions/src/shapes/Object/Object.d.ts.map +1 -1
  47. package/package.json +1 -1
  48. package/src/canvas/Canvas.ts +3 -17
  49. package/src/canvas/StaticCanvas.ts +0 -27
  50. package/src/shapes/Group.ts +4 -0
  51. package/src/shapes/Image.ts +0 -3
  52. package/src/shapes/Object/Object.ts +0 -22
package/dist/index.js CHANGED
@@ -428,7 +428,7 @@
428
428
  }
429
429
  const cache = new Cache();
430
430
 
431
- var version = "6.4.3-pmw-34";
431
+ var version = "6.4.3-pmw-36";
432
432
 
433
433
  // use this syntax so babel plugin see this import here
434
434
  const VERSION = version;
@@ -3469,7 +3469,6 @@
3469
3469
  if (this.destroyed) {
3470
3470
  return;
3471
3471
  }
3472
- const t1 = performance.now();
3473
3472
  const v = this.viewportTransform,
3474
3473
  path = this.clipPath;
3475
3474
  this.calcViewportBoundaries();
@@ -3480,20 +3479,15 @@
3480
3479
  this.fire('before:render', {
3481
3480
  ctx
3482
3481
  });
3483
- const t2 = performance.now();
3484
3482
  this._renderBackground(ctx);
3485
- const t3 = performance.now();
3486
3483
  ctx.save();
3487
3484
  //apply viewport transform once for all rendering process
3488
3485
  ctx.transform(v[0], v[1], v[2], v[3], v[4], v[5]);
3489
- const t4 = performance.now();
3490
3486
  this._renderObjects(ctx, objects);
3491
- const t5 = performance.now();
3492
3487
  ctx.restore();
3493
3488
  if (!this.controlsAboveOverlay && !this.skipControlsDrawing) {
3494
3489
  this.drawControls(ctx);
3495
3490
  }
3496
- const t6 = performance.now();
3497
3491
  if (path) {
3498
3492
  path._set('canvas', this);
3499
3493
  // needed to setup a couple of variables
@@ -3505,13 +3499,10 @@
3505
3499
  });
3506
3500
  this.drawClipPathOnCanvas(ctx, path);
3507
3501
  }
3508
- const t7 = performance.now();
3509
3502
  this._renderOverlay(ctx);
3510
- const t8 = performance.now();
3511
3503
  if (this.controlsAboveOverlay && !this.skipControlsDrawing) {
3512
3504
  this.drawControls(ctx);
3513
3505
  }
3514
- const t9 = performance.now();
3515
3506
  this.fire('after:render', {
3516
3507
  ctx
3517
3508
  });
@@ -3519,24 +3510,6 @@
3519
3510
  this.__cleanupTask();
3520
3511
  this.__cleanupTask = undefined;
3521
3512
  }
3522
- const t10 = performance.now();
3523
- const times = {
3524
- randomStartTime: t2 - t1,
3525
- renderBackground: t3 - t2,
3526
- transform: t4 - t3,
3527
- renderObjects: t5 - t4,
3528
- drawControls: t6 - t5,
3529
- pathThingy: t7 - t6,
3530
- renderOverlay: t8 - t7,
3531
- drawControlsOverlay: t9 - t8,
3532
- cleanup: t10 - t9,
3533
- totalTime: t10 - t1
3534
- };
3535
- let logMessage = '';
3536
- for (const [key, value] of Object.entries(times)) {
3537
- logMessage += "".concat(key, " ").concat(String(Math.round(value)), "ms ");
3538
- }
3539
- console.log(logMessage);
3540
3513
  }
3541
3514
 
3542
3515
  /**
@@ -7126,41 +7099,19 @@
7126
7099
  return;
7127
7100
  }
7128
7101
  ctx.save();
7129
- const t1 = performance.now();
7130
7102
  this._setupCompositeOperation(ctx);
7131
7103
  this.drawSelectionBackground(ctx);
7132
- const t2 = performance.now();
7133
7104
  this.transform(ctx);
7134
7105
  this._setOpacity(ctx);
7135
7106
  this._setShadow(ctx);
7136
- const t3 = performance.now();
7137
- let t4 = performance.now();
7138
- let t5 = performance.now();
7139
7107
  if (this.shouldCache()) {
7140
7108
  this.renderCache();
7141
- t4 = performance.now();
7142
7109
  this.drawCacheOnCanvas(ctx);
7143
- t5 = performance.now();
7144
7110
  } else {
7145
7111
  this._removeCacheCanvas();
7146
- t4 = performance.now();
7147
7112
  this.drawObject(ctx, false, {});
7148
- t5 = performance.now();
7149
7113
  this.dirty = false;
7150
7114
  }
7151
- const times = {
7152
- drawSelectonBackground: t2 - t1,
7153
- setBackgroundShadow: t3 - t2,
7154
- shoudCache: this.shouldCache() ? 1 : 0,
7155
- rendercacheOrRemoveCache: t4 - t3,
7156
- drawObject: t5 - t4,
7157
- total: t5 - t1
7158
- };
7159
- let logMessage = '';
7160
- for (const [key, value] of Object.entries(times)) {
7161
- logMessage += "".concat(key, " ").concat(String(Math.round(value)), "ms ");
7162
- }
7163
- console.log(logMessage);
7164
7115
  ctx.restore();
7165
7116
  }
7166
7117
  drawSelectionBackground(_ctx) {
@@ -11999,6 +11950,9 @@
11999
11950
  }
12000
11951
  return false;
12001
11952
  }
11953
+ isGroup() {
11954
+ return true;
11955
+ }
12002
11956
 
12003
11957
  /**
12004
11958
  * Check if instance or its group are caching, recursively up
@@ -15254,29 +15208,19 @@
15254
15208
  * @param {Event} e Event object fired on mousedown
15255
15209
  */
15256
15210
  _onTouchStart(e) {
15257
- // we will prevent scrolling if allowTouchScrolling is not enabled and
15258
- let shouldPreventScrolling = !this.allowTouchScrolling;
15259
- const currentActiveObject = this._activeObject;
15211
+ //*PMW* Multiple changes in 6.4.3 reverted from this function to fix contextual menu opening on mobile on touch hold. Investigate and add those back
15212
+ e.preventDefault();
15260
15213
  if (this.mainTouchId === undefined) {
15261
15214
  this.mainTouchId = this.getPointerId(e);
15262
15215
  }
15263
15216
  this.__onMouseDown(e);
15264
- // after executing fabric logic for mouse down let's see
15265
- // if we didn't change target or if we are drawing
15266
- // we want to prevent scrolling anyway
15267
- if (this.isDrawingMode || currentActiveObject && this._target === currentActiveObject) {
15268
- shouldPreventScrolling = true;
15269
- }
15270
- // prevent default, will block scrolling from start
15271
- shouldPreventScrolling && e.preventDefault();
15272
15217
  this._resetTransformEventData();
15273
15218
  const canvasElement = this.upperCanvasEl,
15274
15219
  eventTypePrefix = this._getEventPrefix();
15275
15220
  const doc = getDocumentFromElement(canvasElement);
15276
15221
  addListener(doc, 'touchend', this._onTouchEnd, addEventOptions);
15277
15222
  // *PMW* modified code. calling onTouchMove instead of _onMouseMove to handle drift deviance
15278
- // if we scroll don't register the touch move event
15279
- shouldPreventScrolling && addListener(doc, 'touchmove', this._onTouchMove, addEventOptions);
15223
+ addListener(doc, 'touchmove', this._onTouchMove, addEventOptions);
15280
15224
  // Unbind mousedown to prevent double triggers from touch devices
15281
15225
  removeListener(canvasElement, "".concat(eventTypePrefix, "down"), this._onMouseDown);
15282
15226
  //*PMW* added line
@@ -25564,10 +25508,7 @@
25564
25508
  if (this._element.nodeName === 'VIDEO') {
25565
25509
  elementToDraw = this._applyVideoFilter(this._element);
25566
25510
  }
25567
- const t1 = performance.now();
25568
25511
  elementToDraw && ctx.drawImage(elementToDraw, sX, sY, sW, sH, x, y, maxDestW, maxDestH);
25569
- const t2 = performance.now();
25570
- console.log('Draw image ctx', t2 - t1);
25571
25512
  }
25572
25513
 
25573
25514
  /**