fabric 5.5.0 → 5.5.1-browser

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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## [5.5.1]
4
+
5
+ - fix(): Cache over invalidation bug backport from 6.x
6
+
3
7
  ## [5.5.0]
4
8
 
5
9
  - refactor() Possibly breaking: Include text line height in text on a path size calculation to avoid cut off from cache. [`#10355`](https://github.com/fabricjs/fabric.js/pull/10355)
package/dist/fabric.js CHANGED
@@ -15180,8 +15180,8 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.Stati
15180
15180
  // for sure this ALIASING_LIMIT is slightly creating problem
15181
15181
  // in situation in which the cache canvas gets an upper limit
15182
15182
  // also objectScale contains already scaleX and scaleY
15183
- width: neededX + ALIASING_LIMIT,
15184
- height: neededY + ALIASING_LIMIT,
15183
+ width: Math.ceil(neededX + ALIASING_LIMIT),
15184
+ height: Math.ceil(neededY + ALIASING_LIMIT),
15185
15185
  zoomX: objectScale.scaleX,
15186
15186
  zoomY: objectScale.scaleY,
15187
15187
  x: neededX,
@@ -15206,29 +15206,16 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.Stati
15206
15206
  }
15207
15207
  var canvas = this._cacheCanvas,
15208
15208
  dims = this._limitCacheSize(this._getCacheCanvasDimensions()),
15209
- minCacheSize = fabric.minCacheSideLimit,
15210
15209
  width = dims.width, height = dims.height, drawingWidth, drawingHeight,
15211
15210
  zoomX = dims.zoomX, zoomY = dims.zoomY,
15212
15211
  dimensionsChanged = width !== this.cacheWidth || height !== this.cacheHeight,
15213
15212
  zoomChanged = this.zoomX !== zoomX || this.zoomY !== zoomY,
15214
- shouldRedraw = dimensionsChanged || zoomChanged,
15215
- additionalWidth = 0, additionalHeight = 0, shouldResizeCanvas = false;
15216
- if (dimensionsChanged) {
15217
- var canvasWidth = this._cacheCanvas.width,
15218
- canvasHeight = this._cacheCanvas.height,
15219
- sizeGrowing = width > canvasWidth || height > canvasHeight,
15220
- sizeShrinking = (width < canvasWidth * 0.9 || height < canvasHeight * 0.9) &&
15221
- canvasWidth > minCacheSize && canvasHeight > minCacheSize;
15222
- shouldResizeCanvas = sizeGrowing || sizeShrinking;
15223
- if (sizeGrowing && !dims.capped && (width > minCacheSize || height > minCacheSize)) {
15224
- additionalWidth = width * 0.1;
15225
- additionalHeight = height * 0.1;
15226
- }
15227
- }
15213
+ shouldRedraw = dimensionsChanged || zoomChanged;
15214
+
15228
15215
  if (shouldRedraw) {
15229
- if (shouldResizeCanvas) {
15230
- canvas.width = Math.ceil(width + additionalWidth);
15231
- canvas.height = Math.ceil(height + additionalHeight);
15216
+ if (dimensionsChanged) {
15217
+ canvas.width = width;
15218
+ canvas.height = height;
15232
15219
  }
15233
15220
  else {
15234
15221
  this._cacheContext.setTransform(1, 0, 0, 1, 0, 0);