@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.
@@ -410,7 +410,7 @@ class Cache {
410
410
  }
411
411
  const cache = new Cache();
412
412
 
413
- var version = "7.0.1-beta21";
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,19 +31056,25 @@ 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
@@ -31153,6 +31166,38 @@ class Frame extends Group {
31153
31166
  this._boundConstrainScale = undefined;
31154
31167
  }
31155
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
+
31156
31201
  /**
31157
31202
  * Custom render to show edit mode overlay
31158
31203
  * @override
@@ -31299,21 +31344,17 @@ class Frame extends Group {
31299
31344
  contentScale: currentScale
31300
31345
  };
31301
31346
 
31302
- // Make content non-interactive again
31347
+ // Make content non-interactive again and restore caching
31303
31348
  this._contentImage.set({
31304
31349
  selectable: false,
31305
31350
  evented: false,
31306
31351
  hasControls: false,
31307
- hasBorders: false
31352
+ hasBorders: false,
31353
+ objectCaching: true
31308
31354
  });
31309
31355
 
31310
- // Restore clip path
31311
- if (this._editModeClipPath) {
31312
- this.clipPath = this._editModeClipPath;
31313
- this._editModeClipPath = undefined;
31314
- } else {
31315
- this._updateClipPath();
31316
- }
31356
+ // Clear edit mode clip path reference (clipPath was never removed, just skipped during render)
31357
+ this._editModeClipPath = undefined;
31317
31358
 
31318
31359
  // Restore caching setting
31319
31360
  if (this._editModeObjectCaching !== undefined) {