@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.
@@ -412,7 +412,7 @@ class Cache {
412
412
  }
413
413
  const cache = new Cache();
414
414
 
415
- var version = "7.0.1-beta21";
415
+ var version = "7.0.1-beta22";
416
416
 
417
417
  // use this syntax so babel plugin see this import here
418
418
  const VERSION = version;
@@ -31041,6 +31041,13 @@ class Frame extends Group {
31041
31041
  this._editModeObjectCaching = this.objectCaching;
31042
31042
  this.objectCaching = false;
31043
31043
 
31044
+ // Force clear any existing cache
31045
+ this.dirty = true;
31046
+ if (this._cacheCanvas) {
31047
+ this._cacheCanvas = null;
31048
+ this._cacheContext = null;
31049
+ }
31050
+
31044
31051
  // Enable sub-target interaction so clicks go through to content
31045
31052
  this.subTargetCheck = true;
31046
31053
  this.interactive = true;
@@ -31051,19 +31058,25 @@ class Frame extends Group {
31051
31058
  const minScale = this._calculateCoverScale(originalWidth, originalHeight);
31052
31059
 
31053
31060
  // Make content image interactive with scale constraint
31061
+ // Also disable its caching to ensure it renders fully
31054
31062
  this._contentImage.set({
31055
31063
  selectable: true,
31056
31064
  evented: true,
31057
31065
  hasControls: true,
31058
31066
  hasBorders: true,
31059
31067
  minScaleLimit: minScale,
31060
- lockScalingFlip: true
31068
+ lockScalingFlip: true,
31069
+ objectCaching: false
31061
31070
  });
31071
+ this._contentImage.dirty = true;
31062
31072
 
31063
- // Store clip path but keep rendering it for the overlay effect
31073
+ // Keep clipPath reference for the overlay effect rendering
31074
+ // NOTE: We do NOT set this.clipPath = undefined because that triggers
31075
+ // coordinate recalculations in Fabric that behave differently with
31076
+ // viewport transforms (autoZoom), causing visual position jumps.
31077
+ // Instead, we override drawObject() to skip clipPath rendering in edit mode.
31064
31078
  if (this.clipPath) {
31065
31079
  this._editModeClipPath = this.clipPath;
31066
- this.clipPath = undefined;
31067
31080
  }
31068
31081
 
31069
31082
  // Add constraint handlers for moving/scaling
@@ -31155,6 +31168,38 @@ class Frame extends Group {
31155
31168
  this._boundConstrainScale = undefined;
31156
31169
  }
31157
31170
  }
31171
+ /**
31172
+ * Override shouldCache to prevent caching during edit mode.
31173
+ * This ensures the full image is rendered without cache-based clipping.
31174
+ * @override
31175
+ */
31176
+ shouldCache() {
31177
+ if (this.isEditMode) {
31178
+ this.ownCaching = false;
31179
+ return false;
31180
+ }
31181
+ return super.shouldCache();
31182
+ }
31183
+
31184
+ /**
31185
+ * Override drawObject to skip clipPath rendering during edit mode.
31186
+ * This prevents coordinate recalculation issues with viewport transforms.
31187
+ * @override
31188
+ */
31189
+ drawObject(ctx, forClipping, context) {
31190
+ this._renderBackground(ctx);
31191
+ for (let i = 0; i < this._objects.length; i++) {
31192
+ const obj = this._objects[i];
31193
+ if (obj.group === this) {
31194
+ obj.render(ctx);
31195
+ }
31196
+ }
31197
+ // Skip clipPath rendering in edit mode to show full image
31198
+ if (!this.isEditMode) {
31199
+ this._drawClipPath(ctx, this.clipPath, context);
31200
+ }
31201
+ }
31202
+
31158
31203
  /**
31159
31204
  * Custom render to show edit mode overlay
31160
31205
  * @override
@@ -31301,21 +31346,17 @@ class Frame extends Group {
31301
31346
  contentScale: currentScale
31302
31347
  };
31303
31348
 
31304
- // Make content non-interactive again
31349
+ // Make content non-interactive again and restore caching
31305
31350
  this._contentImage.set({
31306
31351
  selectable: false,
31307
31352
  evented: false,
31308
31353
  hasControls: false,
31309
- hasBorders: false
31354
+ hasBorders: false,
31355
+ objectCaching: true
31310
31356
  });
31311
31357
 
31312
- // Restore clip path
31313
- if (this._editModeClipPath) {
31314
- this.clipPath = this._editModeClipPath;
31315
- this._editModeClipPath = undefined;
31316
- } else {
31317
- this._updateClipPath();
31318
- }
31358
+ // Clear edit mode clip path reference (clipPath was never removed, just skipped during render)
31359
+ this._editModeClipPath = undefined;
31319
31360
 
31320
31361
  // Restore caching setting
31321
31362
  if (this._editModeObjectCaching !== undefined) {