@postermywall/fabricjs-2 6.0.0-pmw-1 → 6.0.0-pmw-3

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 (66) hide show
  1. package/dist/index.js +53 -3
  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 +53 -3
  8. package/dist/index.mjs.map +1 -1
  9. package/dist/index.node.cjs +53 -3
  10. package/dist/index.node.cjs.map +1 -1
  11. package/dist/index.node.mjs +53 -3
  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 +9 -1
  19. package/dist/src/canvas/Canvas.mjs.map +1 -1
  20. package/dist/src/canvas/SelectableCanvas.d.ts.map +1 -1
  21. package/dist/src/canvas/SelectableCanvas.min.mjs +1 -1
  22. package/dist/src/canvas/SelectableCanvas.min.mjs.map +1 -1
  23. package/dist/src/canvas/SelectableCanvas.mjs +2 -1
  24. package/dist/src/canvas/SelectableCanvas.mjs.map +1 -1
  25. package/dist/src/canvas/StaticCanvas.d.ts.map +1 -1
  26. package/dist/src/canvas/StaticCanvas.min.mjs +1 -1
  27. package/dist/src/canvas/StaticCanvas.min.mjs.map +1 -1
  28. package/dist/src/canvas/StaticCanvas.mjs +10 -0
  29. package/dist/src/canvas/StaticCanvas.mjs.map +1 -1
  30. package/dist/src/config.d.ts +10 -0
  31. package/dist/src/config.d.ts.map +1 -1
  32. package/dist/src/config.min.mjs +1 -1
  33. package/dist/src/config.min.mjs.map +1 -1
  34. package/dist/src/config.mjs +10 -0
  35. package/dist/src/config.mjs.map +1 -1
  36. package/dist/src/controls/Control.d.ts +6 -0
  37. package/dist/src/controls/Control.d.ts.map +1 -1
  38. package/dist/src/controls/Control.min.mjs +1 -1
  39. package/dist/src/controls/Control.min.mjs.map +1 -1
  40. package/dist/src/controls/Control.mjs +6 -0
  41. package/dist/src/controls/Control.mjs.map +1 -1
  42. package/dist/src/shapes/Object/InteractiveObject.d.ts +1 -0
  43. package/dist/src/shapes/Object/InteractiveObject.d.ts.map +1 -1
  44. package/dist/src/shapes/Object/InteractiveObject.min.mjs +1 -1
  45. package/dist/src/shapes/Object/InteractiveObject.min.mjs.map +1 -1
  46. package/dist/src/shapes/Object/InteractiveObject.mjs +4 -0
  47. package/dist/src/shapes/Object/InteractiveObject.mjs.map +1 -1
  48. package/dist/src/shapes/Object/Object.d.ts +12 -0
  49. package/dist/src/shapes/Object/Object.d.ts.map +1 -1
  50. package/dist/src/shapes/Object/Object.min.mjs +1 -1
  51. package/dist/src/shapes/Object/Object.min.mjs.map +1 -1
  52. package/dist/src/shapes/Object/Object.mjs +13 -0
  53. package/dist/src/shapes/Object/Object.mjs.map +1 -1
  54. package/dist/src/shapes/Object/types/FabricObjectProps.d.ts +1 -0
  55. package/dist/src/shapes/Object/types/FabricObjectProps.d.ts.map +1 -1
  56. package/dist/src/shapes/Path.d.ts +1 -0
  57. package/dist/src/shapes/Path.d.ts.map +1 -1
  58. package/package.json +1 -1
  59. package/src/canvas/Canvas.ts +11 -0
  60. package/src/canvas/SelectableCanvas.ts +2 -1
  61. package/src/canvas/StaticCanvas.ts +10 -0
  62. package/src/config.ts +12 -0
  63. package/src/controls/Control.ts +7 -0
  64. package/src/shapes/Object/InteractiveObject.ts +6 -0
  65. package/src/shapes/Object/Object.ts +16 -1
  66. package/src/shapes/Object/types/FabricObjectProps.ts +2 -0
package/dist/index.js CHANGED
@@ -125,6 +125,16 @@
125
125
  * @default
126
126
  */
127
127
  _defineProperty(this, "perfLimitSizeTotal", 2097152);
128
+ /**
129
+ * *PMW* added property to disable the drag group selection.
130
+ * @default
131
+ */
132
+ _defineProperty(this, "disableGroupSelector", void 0);
133
+ /**
134
+ * *PMW* added variable to mark when canvas is being two-finger panned.
135
+ * @type Boolean
136
+ */
137
+ _defineProperty(this, "isCanvasTwoFingerPanning", void 0);
128
138
  /**
129
139
  * Pixel limit for cache canvases width or height. IE fixes the maximum at 5000
130
140
  * @since 1.7.14
@@ -423,7 +433,7 @@
423
433
  }
424
434
  const cache = new Cache();
425
435
 
426
- var version = "6.0.0-pmw-1";
436
+ var version = "6.0.0-pmw-3";
427
437
 
428
438
  // use this syntax so babel plugin see this import here
429
439
  const VERSION = version;
@@ -4006,10 +4016,20 @@
4006
4016
  */
4007
4017
  _setSVGObjects(markup, reviver) {
4008
4018
  this.forEachObject(fabricObject => {
4019
+ // *PMW*: Attaching pmw id
4020
+ const uid = fabricObject.__PMWID;
4009
4021
  if (fabricObject.excludeFromExport) {
4010
4022
  return;
4011
4023
  }
4024
+ // *PMW*
4025
+ if (uid) {
4026
+ markup.push("<g id=\"".concat(uid, "\">\n"));
4027
+ }
4012
4028
  this._setSVGObject(markup, fabricObject, reviver);
4029
+ // *PMW*
4030
+ if (uid) {
4031
+ markup.push("</g id=\"".concat(uid, "\">\n"));
4032
+ }
4013
4033
  });
4014
4034
  }
4015
4035
 
@@ -7001,6 +7021,7 @@
7001
7021
  */
7002
7022
  constructor(options) {
7003
7023
  super();
7024
+ _defineProperty(this, "__PMWID", '');
7004
7025
  /**
7005
7026
  * Quick access for the _cacheCanvas rendering context
7006
7027
  * This is part of the objectCaching feature
@@ -7010,6 +7031,18 @@
7010
7031
  * @private
7011
7032
  */
7012
7033
  _defineProperty(this, "_cacheContext", null);
7034
+ /**
7035
+ * *PMW* new property
7036
+ * PosterMyWall property for the default text of the button.
7037
+ * @default
7038
+ */
7039
+ _defineProperty(this, "pmwBmBtnText", '');
7040
+ /**
7041
+ * *PMW* new property
7042
+ * An svg of the icon place in the pmw bottom-middle button
7043
+ * @default
7044
+ */
7045
+ _defineProperty(this, "pmwBmBtnIcon", '');
7013
7046
  Object.assign(this, FabricObject.ownDefaults);
7014
7047
  this.setOptions(options);
7015
7048
  }
@@ -8368,6 +8401,12 @@
8368
8401
  * @default true
8369
8402
  */
8370
8403
  _defineProperty(this, "visible", true);
8404
+ /**
8405
+ * *PMW* added to use in cursor styling
8406
+ * Whether the control is disabled or not
8407
+ * @default false
8408
+ */
8409
+ _defineProperty(this, "disabled", false);
8371
8410
  /**
8372
8411
  * Name of the action that the control will likely execute.
8373
8412
  * This is optional. FabricJS uses to identify what the user is doing for some
@@ -9455,6 +9494,9 @@
9455
9494
  */
9456
9495
  _renderControls(ctx) {
9457
9496
  let styleOverride = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
9497
+ if (config.isCanvasTwoFingerPanning) {
9498
+ return;
9499
+ }
9458
9500
  const {
9459
9501
  hasBorders,
9460
9502
  hasControls
@@ -13420,7 +13462,8 @@
13420
13462
  * @return {Boolean}
13421
13463
  */
13422
13464
  isTargetTransparent(target, x, y) {
13423
- const tolerance = this.targetFindTolerance;
13465
+ // *PMW* Using item find tolerance instead of canvas
13466
+ const tolerance = target.targetFindTolerance;
13424
13467
  const ctx = this.pixelFindContext;
13425
13468
  this.clearContext(ctx);
13426
13469
  ctx.save();
@@ -15009,6 +15052,9 @@
15009
15052
  } else if (!isClick && !((_this$_activeObject = this._activeObject) !== null && _this$_activeObject !== void 0 && _this$_activeObject.isEditing)) {
15010
15053
  this.renderTop();
15011
15054
  }
15055
+ if (config.isCanvasTwoFingerPanning) {
15056
+ config.isCanvasTwoFingerPanning = false;
15057
+ }
15012
15058
  }
15013
15059
  _basicEventHandler(eventType, options) {
15014
15060
  const {
@@ -15115,6 +15161,10 @@
15115
15161
  * @param {Event} e Event object fired on mousedown
15116
15162
  */
15117
15163
  __onMouseDown(e) {
15164
+ // *PMW* added condition. Skip the object transformation while the canvas is being two-finger panned.
15165
+ if ('touches' in e && e.touches.length === 2 || config.isCanvasTwoFingerPanning) {
15166
+ return;
15167
+ }
15118
15168
  this._isClick = true;
15119
15169
  this._cacheTransformEventData(e);
15120
15170
  this._handleEvent(e, 'down:before');
@@ -15157,7 +15207,7 @@
15157
15207
  // target is not selectable ( otherwise we selected it )
15158
15208
  // target is not editing
15159
15209
  // target is not already selected ( otherwise we drag )
15160
- if (this.selection && (!target || !target.selectable && !target.isEditing && target !== this._activeObject)) {
15210
+ if (this.selection && !config.disableGroupSelector && (!target || !target.selectable && !target.isEditing && target !== this._activeObject)) {
15161
15211
  const p = this.getScenePoint(e);
15162
15212
  this._groupSelector = {
15163
15213
  x: p.x,