@nasser-sw/fabric 7.0.1-beta21 → 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-beta20";
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,28 +31058,35 @@ 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
31070
31083
  this._setupEditModeConstraints();
31071
31084
  this.set('dirty', true);
31072
31085
 
31073
- // Select the content image on the canvas
31086
+ // Just render - don't call setActiveObject() on the content image
31087
+ // because it causes position miscalculation with viewport transforms.
31088
+ // The content image is still interactive via subTargetCheck = true
31074
31089
  if (this.canvas) {
31075
- this.canvas.setActiveObject(this._contentImage);
31076
31090
  this.canvas.renderAll();
31077
31091
  }
31078
31092
 
@@ -31154,6 +31168,38 @@ class Frame extends Group {
31154
31168
  this._boundConstrainScale = undefined;
31155
31169
  }
31156
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
+
31157
31203
  /**
31158
31204
  * Custom render to show edit mode overlay
31159
31205
  * @override
@@ -31300,21 +31346,17 @@ class Frame extends Group {
31300
31346
  contentScale: currentScale
31301
31347
  };
31302
31348
 
31303
- // Make content non-interactive again
31349
+ // Make content non-interactive again and restore caching
31304
31350
  this._contentImage.set({
31305
31351
  selectable: false,
31306
31352
  evented: false,
31307
31353
  hasControls: false,
31308
- hasBorders: false
31354
+ hasBorders: false,
31355
+ objectCaching: true
31309
31356
  });
31310
31357
 
31311
- // Restore clip path
31312
- if (this._editModeClipPath) {
31313
- this.clipPath = this._editModeClipPath;
31314
- this._editModeClipPath = undefined;
31315
- } else {
31316
- this._updateClipPath();
31317
- }
31358
+ // Clear edit mode clip path reference (clipPath was never removed, just skipped during render)
31359
+ this._editModeClipPath = undefined;
31318
31360
 
31319
31361
  // Restore caching setting
31320
31362
  if (this._editModeObjectCaching !== undefined) {