fabric-vectr 6.7.13 → 6.7.14

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.
Files changed (31) hide show
  1. package/dist/index.js +21 -14
  2. package/dist/index.js.map +1 -1
  3. package/dist/index.min.js +1 -1
  4. package/dist/index.min.js.map +1 -1
  5. package/dist/index.min.mjs +1 -1
  6. package/dist/index.min.mjs.map +1 -1
  7. package/dist/index.mjs +21 -14
  8. package/dist/index.mjs.map +1 -1
  9. package/dist/index.node.cjs +21 -14
  10. package/dist/index.node.cjs.map +1 -1
  11. package/dist/index.node.mjs +21 -14
  12. package/dist/index.node.mjs.map +1 -1
  13. package/dist/package.json.min.mjs +1 -1
  14. package/dist/package.json.mjs +1 -1
  15. package/dist/src/canvas/StaticCanvas.d.ts.map +1 -1
  16. package/dist/src/canvas/StaticCanvas.min.mjs +1 -1
  17. package/dist/src/canvas/StaticCanvas.min.mjs.map +1 -1
  18. package/dist/src/canvas/StaticCanvas.mjs +15 -12
  19. package/dist/src/canvas/StaticCanvas.mjs.map +1 -1
  20. package/dist/src/shapes/Object/FabricObjectSVGExportMixin.d.ts.map +1 -1
  21. package/dist/src/shapes/Object/FabricObjectSVGExportMixin.min.mjs +1 -1
  22. package/dist/src/shapes/Object/FabricObjectSVGExportMixin.min.mjs.map +1 -1
  23. package/dist/src/shapes/Object/FabricObjectSVGExportMixin.mjs +5 -1
  24. package/dist/src/shapes/Object/FabricObjectSVGExportMixin.mjs.map +1 -1
  25. package/dist-extensions/src/canvas/StaticCanvas.d.ts.map +1 -1
  26. package/dist-extensions/src/shapes/Object/FabricObjectSVGExportMixin.d.ts.map +1 -1
  27. package/package.json +33 -33
  28. package/src/canvas/StaticCanvas.spec.ts +23 -0
  29. package/src/canvas/StaticCanvas.ts +19 -12
  30. package/src/shapes/Object/FabricObjectSVGExportMixin.ts +5 -1
  31. package/src/shapes/Text/TextSVGExportMixin.spec.ts +16 -0
@@ -416,7 +416,7 @@ class Cache {
416
416
  }
417
417
  const cache = new Cache();
418
418
 
419
- var version = "6.7.13";
419
+ var version = "6.7.14";
420
420
 
421
421
  // use this syntax so babel plugin see this import here
422
422
  const VERSION = version;
@@ -3130,25 +3130,28 @@ let StaticCanvas$1 = class StaticCanvas extends createCollectionMixin(CommonMeth
3130
3130
  */
3131
3131
  _createPathForText() {
3132
3132
  const pathMarkups = [];
3133
- let instance,
3134
- i,
3135
- len,
3136
- objects = this._objects;
3137
- for (i = 0, len = objects.length; i < len; i++) {
3138
- instance = objects[i];
3133
+ const objects = [];
3134
+ this._objects.forEach(function add(object) {
3135
+ objects.push(object);
3136
+ if (isCollection(object)) {
3137
+ object._objects.forEach(add);
3138
+ }
3139
+ });
3140
+ objects.forEach(instance => {
3139
3141
  if (instance.excludeFromExport) {
3140
- continue;
3142
+ return;
3141
3143
  }
3142
3144
  if (!isTextObject(instance) || !instance.path) {
3143
- continue;
3145
+ return;
3144
3146
  }
3145
- let pathId = `TEXTPATH_${instance.id}`;
3146
- let pathMarkup = instance.path._toSVG();
3147
- let index = pathMarkup.indexOf('COMMON_PARTS');
3147
+ const pathId = `TEXTPATH_${instance.id}`;
3148
+ const pathMarkup = instance.path._toSVG();
3149
+ const index = pathMarkup.indexOf('COMMON_PARTS');
3150
+
3148
3151
  // 加上id, 和路径偏移
3149
3152
  pathMarkup[index] = ['id="' + pathId + '" ', 'transform="translate(' + -instance.path.pathOffset.x + ',' + -instance.path.pathOffset.y + ')" '].join('');
3150
3153
  pathMarkups.push(pathMarkup.join(''));
3151
- }
3154
+ });
3152
3155
  return pathMarkups.join('\n');
3153
3156
  }
3154
3157
  createSVGClipPathMarkup(options) {
@@ -5101,13 +5104,17 @@ class FabricObjectSVGExportMixin {
5101
5104
  commonPieces = [styleInfo, vectorEffect, noStyle ? '' : this.addPaintOrder(), ' ', additionalTransform ? `transform="${additionalTransform}" ` : ''].join('');
5102
5105
 
5103
5106
  // James added shadow 放在上面
5107
+ // 文本等调用方已经通过 withShadow 挂载 filter 时,避免再额外复制一份可见对象,
5108
+ // 但仍然需要输出 filter 定义,否则普通 SVG 会丢失阴影。
5104
5109
  if (shadow) {
5110
+ markup.push(shadow.toSVG(this));
5111
+ }
5112
+ if (shadow && !withShadow) {
5105
5113
  const styleInfoWithShadow = 'style="' + this.getSvgStyles(false) + '" ';
5106
5114
  const commonPiecesWithShadow = [styleInfoWithShadow, vectorEffect, noStyle ? '' : this.addPaintOrder(), ' ', additionalTransform ? 'transform="' + additionalTransform + '" ' : ''].join('');
5107
5115
  const objectMarkupCopy = JSON.parse(JSON.stringify(objectMarkup));
5108
5116
  objectMarkupCopy[index] = commonPiecesWithShadow;
5109
5117
  markup.push(objectMarkupCopy.join(''));
5110
- markup.push(shadow.toSVG(this));
5111
5118
  }
5112
5119
  // objectMarkup中是导出主对象(如path)的svg,index下标是style,放在commonPieces
5113
5120
  objectMarkup[index] = commonPieces;