fabric 6.4.2 → 6.4.3

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "fabric",
3
3
  "description": "Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.",
4
4
  "homepage": "http://fabricjs.com/",
5
- "version": "6.4.2",
5
+ "version": "6.4.3",
6
6
  "author": "Juriy Zaytsev <kangax@gmail.com>",
7
7
  "contributors": [
8
8
  {
@@ -43,7 +43,6 @@
43
43
  "docs": "typedoc",
44
44
  "cli": "node ./scripts/index.mjs",
45
45
  "sandboxscript": "node ./scripts/sandbox.mjs",
46
- "changelog": "auto-changelog -o change-output.md --unreleased-only",
47
46
  "build": "npm run cli -- build",
48
47
  "build:fast": "npm run build -- -f",
49
48
  "dev": "npm run cli -- dev",
@@ -90,7 +89,6 @@
90
89
  "@types/node": "^17.0.21",
91
90
  "@typescript-eslint/eslint-plugin": "^8.1.0",
92
91
  "@typescript-eslint/parser": "^8.1.0",
93
- "auto-changelog": "^2.3.0",
94
92
  "axios": "^0.27.2",
95
93
  "babel-plugin-import-json-value": "^0.1.2",
96
94
  "babel-plugin-transform-imports": "git+https://git@github.com/fabricjs/babel-plugin-transform-imports.git",
package/rollup.config.mjs CHANGED
@@ -107,6 +107,7 @@ export default [
107
107
  }
108
108
  : null,
109
109
  // umd module in bundle, the cdn one for fiddles
110
+ // deprecated, this will be available only minified for cdn.
110
111
  {
111
112
  file: path.resolve(dirname, `${basename}.js`),
112
113
  name: 'fabric',
@@ -135,7 +136,7 @@ export default [
135
136
  format: 'es',
136
137
  sourcemap: true,
137
138
  },
138
- // todo remove
139
+ // deprecated remove
139
140
  {
140
141
  file: path.resolve(dirname, `${basename}.node.cjs`),
141
142
  name: 'fabric',
@@ -43,6 +43,15 @@ describe('changeWidth', () => {
43
43
  expect(target.top).toBe(0);
44
44
  });
45
45
 
46
+ test('changeWidth changes the width with decimals', () => {
47
+ expect(target.width).toBe(100);
48
+ const changed = changeWidth(eventData, transform, 200.2, 300);
49
+ expect(changed).toBe(true);
50
+ expect(target.width).toBe(199.2);
51
+ expect(target.left).toBe(0);
52
+ expect(target.top).toBe(0);
53
+ });
54
+
46
55
  test('changeWidth does not change the width', () => {
47
56
  const target = new Rect({ width: 100, height: 100, canvas });
48
57
  jest.spyOn(target, '_set').mockImplementation(function _set(this: Rect) {
@@ -40,10 +40,9 @@ export const changeObjectWidth: TransformActionHandler = (
40
40
  target.strokeWidth / (target.strokeUniform ? target.scaleX : 1),
41
41
  multiplier = isTransformCentered(transform) ? 2 : 1,
42
42
  oldWidth = target.width,
43
- newWidth = Math.ceil(
44
- Math.abs((localPoint.x * multiplier) / target.scaleX) - strokePadding,
45
- );
46
- target.set('width', Math.max(newWidth, 0));
43
+ newWidth =
44
+ Math.abs((localPoint.x * multiplier) / target.scaleX) - strokePadding;
45
+ target.set('width', Math.max(newWidth, 1));
47
46
  // check against actual target width in case `newWidth` was rejected
48
47
  return oldWidth !== target.width;
49
48
  }
@@ -1790,12 +1790,24 @@ export class FabricText<
1790
1790
  return 1;
1791
1791
  }
1792
1792
 
1793
+ /**
1794
+ * List of generic font families
1795
+ * @see https://developer.mozilla.org/en-US/docs/Web/CSS/font-family#generic-name
1796
+ */
1793
1797
  static genericFonts = [
1794
- 'sans-serif',
1795
1798
  'serif',
1799
+ 'sans-serif',
1800
+ 'monospace',
1796
1801
  'cursive',
1797
1802
  'fantasy',
1798
- 'monospace',
1803
+ 'system-ui',
1804
+ 'ui-serif',
1805
+ 'ui-sans-serif',
1806
+ 'ui-monospace',
1807
+ 'ui-rounded',
1808
+ 'math',
1809
+ 'emoji',
1810
+ 'fangsong',
1799
1811
  ];
1800
1812
 
1801
1813
  /* _FROM_SVG_START_ */