build-dxf 0.1.11 → 0.1.13
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
package/src/build.js
CHANGED
|
@@ -3881,9 +3881,10 @@ class CAD {
|
|
|
3881
3881
|
/**
|
|
3882
3882
|
* 转为绘制数据
|
|
3883
3883
|
*/
|
|
3884
|
-
|
|
3884
|
+
_cachedDrawDataMap = /* @__PURE__ */ new Map();
|
|
3885
3885
|
toDrawData(unit = "Centimeters") {
|
|
3886
|
-
if (!this.needUpdate && this.
|
|
3886
|
+
if (!this.needUpdate && this._cachedDrawDataMap.has(unit)) return this._cachedDrawDataMap.get(unit);
|
|
3887
|
+
this._cachedDrawDataMap.clear();
|
|
3887
3888
|
this.needUpdate = false;
|
|
3888
3889
|
const lines = this.groups.flatMap((group2) => group2.lines), s = units[unit], expansionWidth = 2, box = Box2.fromByLineSegment(...lines).expansion(expansionWidth), center = box.center, data = {
|
|
3889
3890
|
unit,
|
|
@@ -3950,7 +3951,7 @@ class CAD {
|
|
|
3950
3951
|
drawDottedLine(p2C, p2, 0.04, 0.05, "line2");
|
|
3951
3952
|
drawLine2(p1C, p2C);
|
|
3952
3953
|
color = "white";
|
|
3953
|
-
drawText2((length *
|
|
3954
|
+
drawText2((length * 100).toFixed(2) + "cm", line.center);
|
|
3954
3955
|
}
|
|
3955
3956
|
function drawArc(pos, radius, startAngle, endAngle) {
|
|
3956
3957
|
data.arcs.push([
|
|
@@ -3970,7 +3971,7 @@ class CAD {
|
|
|
3970
3971
|
} };
|
|
3971
3972
|
set2.forEach((fun) => fun.handler(option));
|
|
3972
3973
|
});
|
|
3973
|
-
this.
|
|
3974
|
+
this._cachedDrawDataMap.set(unit, data);
|
|
3974
3975
|
return data;
|
|
3975
3976
|
}
|
|
3976
3977
|
/** 转为图片
|