@nasser-sw/fabric 7.0.1-beta22 → 7.0.1-beta24

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/index.mjs CHANGED
@@ -354,7 +354,7 @@ class Cache {
354
354
  }
355
355
  const cache = new Cache();
356
356
 
357
- var version = "7.0.1-beta21";
357
+ var version = "7.0.1-beta23";
358
358
 
359
359
  // use this syntax so babel plugin see this import here
360
360
  const VERSION = version;
@@ -30983,6 +30983,13 @@ class Frame extends Group {
30983
30983
  this._editModeObjectCaching = this.objectCaching;
30984
30984
  this.objectCaching = false;
30985
30985
 
30986
+ // Force clear any existing cache
30987
+ this.dirty = true;
30988
+ if (this._cacheCanvas) {
30989
+ this._cacheCanvas = null;
30990
+ this._cacheContext = null;
30991
+ }
30992
+
30986
30993
  // Enable sub-target interaction so clicks go through to content
30987
30994
  this.subTargetCheck = true;
30988
30995
  this.interactive = true;
@@ -30993,16 +31000,21 @@ class Frame extends Group {
30993
31000
  const minScale = this._calculateCoverScale(originalWidth, originalHeight);
30994
31001
 
30995
31002
  // Make content image interactive with scale constraint
31003
+ // Also disable its caching to ensure it renders fully
30996
31004
  this._contentImage.set({
30997
31005
  selectable: true,
30998
31006
  evented: true,
30999
31007
  hasControls: true,
31000
31008
  hasBorders: true,
31001
31009
  minScaleLimit: minScale,
31002
- lockScalingFlip: true
31010
+ lockScalingFlip: true,
31011
+ objectCaching: false
31003
31012
  });
31013
+ this._contentImage.dirty = true;
31004
31014
 
31005
- // Store clip path but keep rendering it for the overlay effect
31015
+ // Store and remove clipPath to show full image
31016
+ // We must actually remove it (not just skip rendering) because Fabric's
31017
+ // rendering pipeline checks clipPath existence in multiple places
31006
31018
  if (this.clipPath) {
31007
31019
  this._editModeClipPath = this.clipPath;
31008
31020
  this.clipPath = undefined;
@@ -31097,6 +31109,38 @@ class Frame extends Group {
31097
31109
  this._boundConstrainScale = undefined;
31098
31110
  }
31099
31111
  }
31112
+ /**
31113
+ * Override shouldCache to prevent caching during edit mode.
31114
+ * This ensures the full image is rendered without cache-based clipping.
31115
+ * @override
31116
+ */
31117
+ shouldCache() {
31118
+ if (this.isEditMode) {
31119
+ this.ownCaching = false;
31120
+ return false;
31121
+ }
31122
+ return super.shouldCache();
31123
+ }
31124
+
31125
+ /**
31126
+ * Override drawObject to skip clipPath rendering during edit mode.
31127
+ * This prevents coordinate recalculation issues with viewport transforms.
31128
+ * @override
31129
+ */
31130
+ drawObject(ctx, forClipping, context) {
31131
+ this._renderBackground(ctx);
31132
+ for (let i = 0; i < this._objects.length; i++) {
31133
+ const obj = this._objects[i];
31134
+ if (obj.group === this) {
31135
+ obj.render(ctx);
31136
+ }
31137
+ }
31138
+ // Skip clipPath rendering in edit mode to show full image
31139
+ if (!this.isEditMode) {
31140
+ this._drawClipPath(ctx, this.clipPath, context);
31141
+ }
31142
+ }
31143
+
31100
31144
  /**
31101
31145
  * Custom render to show edit mode overlay
31102
31146
  * @override
@@ -31243,20 +31287,19 @@ class Frame extends Group {
31243
31287
  contentScale: currentScale
31244
31288
  };
31245
31289
 
31246
- // Make content non-interactive again
31290
+ // Make content non-interactive again and restore caching
31247
31291
  this._contentImage.set({
31248
31292
  selectable: false,
31249
31293
  evented: false,
31250
31294
  hasControls: false,
31251
- hasBorders: false
31295
+ hasBorders: false,
31296
+ objectCaching: true
31252
31297
  });
31253
31298
 
31254
31299
  // Restore clip path
31255
31300
  if (this._editModeClipPath) {
31256
31301
  this.clipPath = this._editModeClipPath;
31257
31302
  this._editModeClipPath = undefined;
31258
- } else {
31259
- this._updateClipPath();
31260
31303
  }
31261
31304
 
31262
31305
  // Restore caching setting