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