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

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-beta22";
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,19 +31000,25 @@ 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
+ // Keep clipPath reference for the overlay effect rendering
31016
+ // NOTE: We do NOT set this.clipPath = undefined because that triggers
31017
+ // coordinate recalculations in Fabric that behave differently with
31018
+ // viewport transforms (autoZoom), causing visual position jumps.
31019
+ // Instead, we override drawObject() to skip clipPath rendering in edit mode.
31006
31020
  if (this.clipPath) {
31007
31021
  this._editModeClipPath = this.clipPath;
31008
- this.clipPath = undefined;
31009
31022
  }
31010
31023
 
31011
31024
  // Add constraint handlers for moving/scaling
@@ -31097,6 +31110,38 @@ class Frame extends Group {
31097
31110
  this._boundConstrainScale = undefined;
31098
31111
  }
31099
31112
  }
31113
+ /**
31114
+ * Override shouldCache to prevent caching during edit mode.
31115
+ * This ensures the full image is rendered without cache-based clipping.
31116
+ * @override
31117
+ */
31118
+ shouldCache() {
31119
+ if (this.isEditMode) {
31120
+ this.ownCaching = false;
31121
+ return false;
31122
+ }
31123
+ return super.shouldCache();
31124
+ }
31125
+
31126
+ /**
31127
+ * Override drawObject to skip clipPath rendering during edit mode.
31128
+ * This prevents coordinate recalculation issues with viewport transforms.
31129
+ * @override
31130
+ */
31131
+ drawObject(ctx, forClipping, context) {
31132
+ this._renderBackground(ctx);
31133
+ for (let i = 0; i < this._objects.length; i++) {
31134
+ const obj = this._objects[i];
31135
+ if (obj.group === this) {
31136
+ obj.render(ctx);
31137
+ }
31138
+ }
31139
+ // Skip clipPath rendering in edit mode to show full image
31140
+ if (!this.isEditMode) {
31141
+ this._drawClipPath(ctx, this.clipPath, context);
31142
+ }
31143
+ }
31144
+
31100
31145
  /**
31101
31146
  * Custom render to show edit mode overlay
31102
31147
  * @override
@@ -31243,21 +31288,17 @@ class Frame extends Group {
31243
31288
  contentScale: currentScale
31244
31289
  };
31245
31290
 
31246
- // Make content non-interactive again
31291
+ // Make content non-interactive again and restore caching
31247
31292
  this._contentImage.set({
31248
31293
  selectable: false,
31249
31294
  evented: false,
31250
31295
  hasControls: false,
31251
- hasBorders: false
31296
+ hasBorders: false,
31297
+ objectCaching: true
31252
31298
  });
31253
31299
 
31254
- // Restore clip path
31255
- if (this._editModeClipPath) {
31256
- this.clipPath = this._editModeClipPath;
31257
- this._editModeClipPath = undefined;
31258
- } else {
31259
- this._updateClipPath();
31260
- }
31300
+ // Clear edit mode clip path reference (clipPath was never removed, just skipped during render)
31301
+ this._editModeClipPath = undefined;
31261
31302
 
31262
31303
  // Restore caching setting
31263
31304
  if (this._editModeObjectCaching !== undefined) {