circuitscript 0.0.38 → 0.1.2
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/dist/cjs/BaseVisitor.js +69 -46
- package/dist/cjs/SymbolValidatorVisitor.js +1 -1
- package/dist/cjs/antlr/CircuitScriptLexer.js +80 -80
- package/dist/cjs/antlr/CircuitScriptParser.js +580 -613
- package/dist/cjs/builtinMethods.js +32 -10
- package/dist/cjs/draw_symbols.js +375 -233
- package/dist/cjs/execute.js +142 -131
- package/dist/cjs/export.js +2 -4
- package/dist/cjs/geometry.js +52 -19
- package/dist/cjs/globals.js +14 -9
- package/dist/cjs/helpers.js +16 -3
- package/dist/cjs/layout.js +143 -151
- package/dist/cjs/logger.js +8 -1
- package/dist/cjs/objects/ClassComponent.js +22 -22
- package/dist/cjs/objects/ExecutionScope.js +10 -4
- package/dist/cjs/objects/Frame.js +4 -1
- package/dist/cjs/objects/ParamDefinition.js +120 -4
- package/dist/cjs/objects/PinDefinition.js +1 -4
- package/dist/cjs/objects/types.js +41 -0
- package/dist/cjs/render.js +41 -110
- package/dist/cjs/sizing.js +33 -7
- package/dist/cjs/utils.js +92 -2
- package/dist/cjs/visitor.js +279 -284
- package/dist/esm/BaseVisitor.mjs +70 -47
- package/dist/esm/SymbolValidatorVisitor.mjs +1 -1
- package/dist/esm/antlr/CircuitScriptLexer.mjs +80 -80
- package/dist/esm/antlr/CircuitScriptParser.mjs +580 -613
- package/dist/esm/builtinMethods.mjs +29 -10
- package/dist/esm/draw_symbols.mjs +381 -238
- package/dist/esm/execute.mjs +144 -133
- package/dist/esm/export.mjs +2 -4
- package/dist/esm/geometry.mjs +52 -19
- package/dist/esm/globals.mjs +13 -8
- package/dist/esm/helpers.mjs +17 -4
- package/dist/esm/layout.mjs +144 -153
- package/dist/esm/logger.mjs +8 -1
- package/dist/esm/objects/ClassComponent.mjs +21 -26
- package/dist/esm/objects/ExecutionScope.mjs +10 -4
- package/dist/esm/objects/Frame.mjs +4 -1
- package/dist/esm/objects/ParamDefinition.mjs +119 -3
- package/dist/esm/objects/PinDefinition.mjs +0 -2
- package/dist/esm/objects/types.mjs +42 -0
- package/dist/esm/render.mjs +44 -113
- package/dist/esm/sizing.mjs +34 -8
- package/dist/esm/utils.mjs +86 -1
- package/dist/esm/visitor.mjs +281 -286
- package/dist/types/BaseVisitor.d.ts +3 -2
- package/dist/types/antlr/CircuitScriptParser.d.ts +5 -3
- package/dist/types/draw_symbols.d.ts +81 -49
- package/dist/types/execute.d.ts +16 -11
- package/dist/types/geometry.d.ts +31 -19
- package/dist/types/globals.d.ts +15 -10
- package/dist/types/helpers.d.ts +2 -1
- package/dist/types/layout.d.ts +22 -21
- package/dist/types/logger.d.ts +1 -1
- package/dist/types/objects/ClassComponent.d.ts +19 -16
- package/dist/types/objects/ExecutionScope.d.ts +2 -1
- package/dist/types/objects/Frame.d.ts +5 -3
- package/dist/types/objects/ParamDefinition.d.ts +31 -2
- package/dist/types/objects/PinDefinition.d.ts +0 -2
- package/dist/types/objects/types.d.ts +7 -2
- package/dist/types/render.d.ts +2 -1
- package/dist/types/utils.d.ts +9 -1
- package/dist/types/visitor.d.ts +5 -5
- package/libs/lib.cst +102 -32
- package/package.json +7 -3
package/dist/cjs/geometry.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.VerticalAlign = exports.HorizontalAlign = exports.Geometry = exports.GeometryProp = exports.Textbox = void 0;
|
|
6
|
+
exports.VerticalAlignProp = exports.HorizontalAlignProp = exports.VerticalAlign = exports.HorizontalAlign = exports.Geometry = exports.GeometryProp = exports.Textbox = void 0;
|
|
7
7
|
const core_1 = __importDefault(require("@flatten-js/core"));
|
|
8
8
|
const sizing_js_1 = require("./sizing.js");
|
|
9
9
|
const globals_js_1 = require("./globals.js");
|
|
@@ -16,7 +16,9 @@ class Textbox extends core_1.default.Polygon {
|
|
|
16
16
|
}
|
|
17
17
|
constructor(id, text, anchorPoint, polygon, style, bounds, label) {
|
|
18
18
|
super(polygon.vertices);
|
|
19
|
-
this.anchorPoint = [
|
|
19
|
+
this.anchorPoint = [
|
|
20
|
+
(0, ParamDefinition_js_1.numeric)(0), (0, ParamDefinition_js_1.numeric)(0)
|
|
21
|
+
];
|
|
20
22
|
this.boundingBox = { width: -1, height: -1 };
|
|
21
23
|
this.font = 'default';
|
|
22
24
|
this.id = id;
|
|
@@ -43,8 +45,8 @@ class Textbox extends core_1.default.Polygon {
|
|
|
43
45
|
else {
|
|
44
46
|
throw 'Invalid string passed into textbox';
|
|
45
47
|
}
|
|
46
|
-
const { fontSize =
|
|
47
|
-
const {
|
|
48
|
+
const { fontSize = (0, ParamDefinition_js_1.numeric)(50), anchor = HorizontalAlign.Left, vanchor = VerticalAlign.Bottom, fontWeight = 'regular', portType = null, } = style ?? {};
|
|
49
|
+
const { box } = (0, sizing_js_1.measureTextSize2)(useText, globals_js_1.defaultFont, fontSize.mul(globals_js_1.fontDisplayScale).toNumber(), fontWeight, anchor, vanchor);
|
|
48
50
|
let polygonCoords = [];
|
|
49
51
|
let anchorOffsetX = 0;
|
|
50
52
|
let anchorOffsetY = 0;
|
|
@@ -103,20 +105,31 @@ class Textbox extends core_1.default.Polygon {
|
|
|
103
105
|
anchorOffsetY += paddingVert / 2;
|
|
104
106
|
}
|
|
105
107
|
const polygon = new core_1.default.Polygon(polygonCoords);
|
|
106
|
-
return new Textbox(id, useText, [x
|
|
108
|
+
return new Textbox(id, useText, [x.add(anchorOffsetX), y.add(anchorOffsetY)], polygon, style, box, label);
|
|
107
109
|
}
|
|
108
110
|
rotate(angle, origin) {
|
|
109
111
|
const feature = super.rotate(angle, origin);
|
|
110
112
|
const newAnchorPoint = this.transformAnchorPoint(segment => segment.rotate(angle, origin));
|
|
111
|
-
|
|
113
|
+
const tmpAnchorPoint = [
|
|
114
|
+
(0, ParamDefinition_js_1.numeric)(newAnchorPoint[0]),
|
|
115
|
+
(0, ParamDefinition_js_1.numeric)(newAnchorPoint[1])
|
|
116
|
+
];
|
|
117
|
+
return new Textbox(this.id, this.text, tmpAnchorPoint, feature, this.style, this.textMeasurementBounds, this.label);
|
|
112
118
|
}
|
|
113
119
|
transform(matrix) {
|
|
114
120
|
const feature = super.transform(matrix);
|
|
115
121
|
const newAnchorPoint = this.transformAnchorPoint(segment => segment.transform(matrix));
|
|
116
|
-
|
|
122
|
+
const tmpAnchorPoint = [
|
|
123
|
+
(0, ParamDefinition_js_1.numeric)(newAnchorPoint[0]),
|
|
124
|
+
(0, ParamDefinition_js_1.numeric)(newAnchorPoint[1])
|
|
125
|
+
];
|
|
126
|
+
return new Textbox(this.id, this.text, tmpAnchorPoint, feature, this.style, this.textMeasurementBounds, this.label);
|
|
117
127
|
}
|
|
118
128
|
transformAnchorPoint(callback) {
|
|
119
|
-
const anchorPointSegment = new core_1.default.Segment(new core_1.default.Point(0, 0), new core_1.default.Point(
|
|
129
|
+
const anchorPointSegment = new core_1.default.Segment(new core_1.default.Point(0, 0), new core_1.default.Point([
|
|
130
|
+
this.anchorPoint[0].toNumber(),
|
|
131
|
+
this.anchorPoint[1].toNumber(),
|
|
132
|
+
]));
|
|
120
133
|
const newSegment = callback(anchorPointSegment);
|
|
121
134
|
const lastPoint = newSegment.vertices[newSegment.vertices.length - 1];
|
|
122
135
|
return [
|
|
@@ -137,7 +150,7 @@ class GeometryProp {
|
|
|
137
150
|
exports.GeometryProp = GeometryProp;
|
|
138
151
|
class Geometry {
|
|
139
152
|
static point(x, y) {
|
|
140
|
-
return new core_1.default.Point(x, y);
|
|
153
|
+
return new core_1.default.Point(x.toNumber(), y.toNumber());
|
|
141
154
|
}
|
|
142
155
|
static line(x1, y1, x2, y2) {
|
|
143
156
|
return new core_1.default.Line(Geometry.point(x1, y1), Geometry.point(x2, y2));
|
|
@@ -152,7 +165,12 @@ class Geometry {
|
|
|
152
165
|
return new core_1.default.Segment(Geometry.point(start[0], start[1]), Geometry.point(end[0], end[1]));
|
|
153
166
|
}
|
|
154
167
|
static polygon(coords) {
|
|
155
|
-
return new core_1.default.Polygon(coords
|
|
168
|
+
return new core_1.default.Polygon(coords.map(item => {
|
|
169
|
+
return [
|
|
170
|
+
item[0].toNumber(),
|
|
171
|
+
item[1].toNumber(),
|
|
172
|
+
];
|
|
173
|
+
}));
|
|
156
174
|
}
|
|
157
175
|
static multiline(coords) {
|
|
158
176
|
const segments = [];
|
|
@@ -162,11 +180,13 @@ class Geometry {
|
|
|
162
180
|
return new core_1.default.Multiline(segments);
|
|
163
181
|
}
|
|
164
182
|
static arc(center, radius, startAngle, endAngle, sweepDirection) {
|
|
165
|
-
return new core_1.default.Arc(Geometry.point(center[0], center[1]), radius, startAngle, endAngle, sweepDirection);
|
|
183
|
+
return new core_1.default.Arc(Geometry.point(center[0], center[1]), radius.toNumber(), startAngle.toNumber(), endAngle.toNumber(), sweepDirection);
|
|
166
184
|
}
|
|
167
185
|
static getCoords(item) {
|
|
168
186
|
const points = item.vertices.map(vertex => {
|
|
169
|
-
return [
|
|
187
|
+
return [
|
|
188
|
+
(0, ParamDefinition_js_1.numeric)(vertex.x), (0, ParamDefinition_js_1.numeric)(vertex.y)
|
|
189
|
+
];
|
|
170
190
|
});
|
|
171
191
|
return points;
|
|
172
192
|
}
|
|
@@ -213,10 +233,10 @@ class Geometry {
|
|
|
213
233
|
if (feature instanceof Textbox) {
|
|
214
234
|
const [x, y] = feature.anchorPoint;
|
|
215
235
|
box = {
|
|
216
|
-
xmin: box.xmin + x,
|
|
217
|
-
ymin: box.ymin + y,
|
|
218
|
-
xmax: box.xmax + x,
|
|
219
|
-
ymax: box.ymax + y
|
|
236
|
+
xmin: box.xmin + x.toNumber(),
|
|
237
|
+
ymin: box.ymin + y.toNumber(),
|
|
238
|
+
xmax: box.xmax + x.toNumber(),
|
|
239
|
+
ymax: box.ymax + y.toNumber()
|
|
220
240
|
};
|
|
221
241
|
}
|
|
222
242
|
if (box.xmin === undefined) {
|
|
@@ -273,7 +293,7 @@ class Geometry {
|
|
|
273
293
|
for (let i = 0; i < coords.length; i++) {
|
|
274
294
|
const [x, y] = coords[i];
|
|
275
295
|
const command = (i === 0) ? 'M' : 'L';
|
|
276
|
-
path.push(`${command}`, x, y);
|
|
296
|
+
path.push(`${command}`, x.toNumber(), y.toNumber());
|
|
277
297
|
}
|
|
278
298
|
if (isClosedPolygon) {
|
|
279
299
|
path.push('Z');
|
|
@@ -306,8 +326,8 @@ class Geometry {
|
|
|
306
326
|
const existingSegments = [];
|
|
307
327
|
wirePoints.forEach(points => {
|
|
308
328
|
const tmpPoints = points.map(pt => {
|
|
309
|
-
const roundedX = (0, utils_js_1.roundValue)(pt.x);
|
|
310
|
-
const roundedY = (0, utils_js_1.roundValue)(pt.y);
|
|
329
|
+
const roundedX = (0, utils_js_1.roundValue)(pt.x).toNumber();
|
|
330
|
+
const roundedY = (0, utils_js_1.roundValue)(pt.y).toNumber();
|
|
311
331
|
return new core_1.default.Point(roundedX, roundedY);
|
|
312
332
|
});
|
|
313
333
|
for (let i = 0; i < tmpPoints.length - 1; i++) {
|
|
@@ -520,6 +540,19 @@ var VerticalAlign;
|
|
|
520
540
|
VerticalAlign["Middle"] = "middle";
|
|
521
541
|
VerticalAlign["Bottom"] = "bottom";
|
|
522
542
|
})(VerticalAlign || (exports.VerticalAlign = VerticalAlign = {}));
|
|
543
|
+
var HorizontalAlignProp;
|
|
544
|
+
(function (HorizontalAlignProp) {
|
|
545
|
+
HorizontalAlignProp["Start"] = "start";
|
|
546
|
+
HorizontalAlignProp["Middle"] = "middle";
|
|
547
|
+
HorizontalAlignProp["End"] = "end";
|
|
548
|
+
})(HorizontalAlignProp || (exports.HorizontalAlignProp = HorizontalAlignProp = {}));
|
|
549
|
+
var VerticalAlignProp;
|
|
550
|
+
(function (VerticalAlignProp) {
|
|
551
|
+
VerticalAlignProp["Hanging"] = "hanging";
|
|
552
|
+
VerticalAlignProp["Middle"] = "middle";
|
|
553
|
+
VerticalAlignProp["Central"] = "central";
|
|
554
|
+
VerticalAlignProp["TextTop"] = "text-top";
|
|
555
|
+
})(VerticalAlignProp || (exports.VerticalAlignProp = VerticalAlignProp = {}));
|
|
523
556
|
function getArcPointRadians(centerX, centerY, radius, angleRads) {
|
|
524
557
|
const dx = Math.cos(angleRads);
|
|
525
558
|
const dy = Math.sin(angleRads);
|
package/dist/cjs/globals.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RenderFlags = exports.GlobalDocumentName = exports.FrameType = exports.BlockTypes = exports.ReferenceTypes = exports.ComponentTypes = exports.ColorScheme = exports.PortPaddingVertical = exports.PortPaddingHorizontal = exports.PortArrowSize = exports.junctionSize = exports.defaultFontSize = exports.defaultFontBold = exports.defaultFont = exports.displayUnits = exports.defaultFrameTitleTextSize = exports.CustomSymbolParamTextSize = exports.CustomSymbolRefDesSize = exports.CustomSymbolPinIdSize = exports.CustomSymbolPinTextSize = exports.defaultPageSpacingMM = exports.defaultPageMarginMM = exports.defaultPinIdTextSize = exports.defaultPinNameTextSize = exports.defaultWireLineWidth = exports.defaultSymbolLineWidth = exports.fontDisplayScale = exports.defaultZoomScale = exports.defaultGridSizeUnits = exports.portHeight = exports.portWidth = exports.PxToMM = exports.MMToPt = exports.MMToPx = exports.MilsToMM = exports.WireAutoDirection = exports.LengthUnit = exports.SymbolPinSide = exports.LayoutDirection = exports.ParamKeys = exports.NoNetText = exports.GlobalNames = void 0;
|
|
3
|
+
exports.RenderFlags = exports.GlobalDocumentName = exports.ModuleContainsKeyword = exports.FrameType = exports.BlockTypes = exports.ReferenceTypes = exports.ComponentTypes = exports.ColorScheme = exports.PortPaddingVertical = exports.PortPaddingHorizontal = exports.PortArrowSize = exports.junctionSize = exports.defaultFontSize = exports.defaultFontBold = exports.defaultFont = exports.displayUnits = exports.defaultFrameTitleTextSize = exports.CustomSymbolParamTextSize = exports.CustomSymbolRefDesSize = exports.CustomSymbolPinIdSize = exports.CustomSymbolPinTextSize = exports.defaultPageSpacingMM = exports.defaultPageMarginMM = exports.defaultPinIdTextSize = exports.defaultPinNameTextSize = exports.defaultWireLineWidth = exports.defaultSymbolLineWidth = exports.fontDisplayScale = exports.defaultZoomScale = exports.defaultGridSizeUnits = exports.portHeight = exports.portWidth = exports.PxToMM = exports.MMToPt = exports.MMToPx = exports.MilsToMM = exports.WireAutoDirection = exports.LengthUnit = exports.SymbolPinSide = exports.LayoutDirection = exports.ParamKeys = exports.NoNetText = exports.GlobalNames = void 0;
|
|
4
4
|
var GlobalNames;
|
|
5
5
|
(function (GlobalNames) {
|
|
6
6
|
GlobalNames["__root"] = "__root";
|
|
7
|
-
GlobalNames["gnd"] = "gnd";
|
|
8
|
-
GlobalNames["DefaultResistor"] = "res";
|
|
9
|
-
GlobalNames["DefaultCapacitor"] = "cap";
|
|
10
|
-
GlobalNames["DefaultInductor"] = "ind";
|
|
11
7
|
GlobalNames["symbol"] = "symbol";
|
|
12
8
|
})(GlobalNames || (exports.GlobalNames = GlobalNames = {}));
|
|
13
9
|
exports.NoNetText = 'NO_NET';
|
|
@@ -15,6 +11,10 @@ var ParamKeys;
|
|
|
15
11
|
(function (ParamKeys) {
|
|
16
12
|
ParamKeys["priority"] = "priority";
|
|
17
13
|
ParamKeys["net_name"] = "net_name";
|
|
14
|
+
ParamKeys["flip"] = "flip";
|
|
15
|
+
ParamKeys["flipX"] = "flipX";
|
|
16
|
+
ParamKeys["flipY"] = "flipY";
|
|
17
|
+
ParamKeys["angle"] = "angle";
|
|
18
18
|
})(ParamKeys || (exports.ParamKeys = ParamKeys = {}));
|
|
19
19
|
var LayoutDirection;
|
|
20
20
|
(function (LayoutDirection) {
|
|
@@ -25,6 +25,8 @@ var SymbolPinSide;
|
|
|
25
25
|
(function (SymbolPinSide) {
|
|
26
26
|
SymbolPinSide["Left"] = "left";
|
|
27
27
|
SymbolPinSide["Right"] = "right";
|
|
28
|
+
SymbolPinSide["Top"] = "top";
|
|
29
|
+
SymbolPinSide["Bottom"] = "bottom";
|
|
28
30
|
})(SymbolPinSide || (exports.SymbolPinSide = SymbolPinSide = {}));
|
|
29
31
|
var LengthUnit;
|
|
30
32
|
(function (LengthUnit) {
|
|
@@ -74,11 +76,10 @@ exports.ColorScheme = {
|
|
|
74
76
|
};
|
|
75
77
|
var ComponentTypes;
|
|
76
78
|
(function (ComponentTypes) {
|
|
77
|
-
ComponentTypes["gnd"] = "gnd";
|
|
78
79
|
ComponentTypes["net"] = "net";
|
|
79
|
-
ComponentTypes["
|
|
80
|
-
ComponentTypes["
|
|
81
|
-
ComponentTypes["
|
|
80
|
+
ComponentTypes["graphic"] = "graphic";
|
|
81
|
+
ComponentTypes["port"] = "port";
|
|
82
|
+
ComponentTypes["module"] = "module";
|
|
82
83
|
})(ComponentTypes || (exports.ComponentTypes = ComponentTypes = {}));
|
|
83
84
|
var ReferenceTypes;
|
|
84
85
|
(function (ReferenceTypes) {
|
|
@@ -100,8 +101,12 @@ var FrameType;
|
|
|
100
101
|
FrameType[FrameType["Frame"] = 1] = "Frame";
|
|
101
102
|
FrameType[FrameType["Sheet"] = 2] = "Sheet";
|
|
102
103
|
})(FrameType || (exports.FrameType = FrameType = {}));
|
|
104
|
+
exports.ModuleContainsKeyword = 'contains';
|
|
103
105
|
exports.GlobalDocumentName = 'document';
|
|
104
106
|
exports.RenderFlags = {
|
|
105
107
|
ShowElementFrames: false,
|
|
106
108
|
ShowOrigin: false,
|
|
109
|
+
ShowGridOrigin: false,
|
|
110
|
+
ShowLabelBoxBounds: false,
|
|
111
|
+
ShowLabelOrigin: false,
|
|
107
112
|
};
|
package/dist/cjs/helpers.js
CHANGED
|
@@ -22,6 +22,8 @@ const CircuitScriptParser_js_1 = require("./antlr/CircuitScriptParser.js");
|
|
|
22
22
|
const SemanticTokenVisitor_js_1 = require("./SemanticTokenVisitor.js");
|
|
23
23
|
const globals_js_1 = require("./globals.js");
|
|
24
24
|
const Frame_js_1 = require("./objects/Frame.js");
|
|
25
|
+
const big_js_1 = __importDefault(require("big.js"));
|
|
26
|
+
const logger_js_1 = require("./logger.js");
|
|
25
27
|
var JSModuleType;
|
|
26
28
|
(function (JSModuleType) {
|
|
27
29
|
JSModuleType["CommonJs"] = "cjs";
|
|
@@ -200,7 +202,13 @@ function renderScript(scriptData, outputPath, options) {
|
|
|
200
202
|
const action = tmp[0];
|
|
201
203
|
if (action === ExecutionScope_js_1.SequenceAction.Wire) {
|
|
202
204
|
tmp[2] = tmp[2].map(item2 => {
|
|
203
|
-
|
|
205
|
+
const lengthValue = item2.value;
|
|
206
|
+
const useValue = [item2.direction];
|
|
207
|
+
if (lengthValue !== null) {
|
|
208
|
+
useValue.push(lengthValue.value);
|
|
209
|
+
useValue.push(lengthValue.type);
|
|
210
|
+
}
|
|
211
|
+
return useValue.join(",");
|
|
204
212
|
}).join(" ");
|
|
205
213
|
}
|
|
206
214
|
else if (action === ExecutionScope_js_1.SequenceAction.Frame) {
|
|
@@ -238,8 +246,10 @@ function renderScript(scriptData, outputPath, options) {
|
|
|
238
246
|
showStats && console.log('Layout took:', layoutTimer.lap());
|
|
239
247
|
dumpData && (0, fs_1.writeFileSync)('dump/raw-layout.txt', layoutEngine.logger.dump());
|
|
240
248
|
const generateSvgTimer = new utils_js_1.SimpleStopwatch();
|
|
241
|
-
const
|
|
249
|
+
const renderLogger = new logger_js_1.Logger();
|
|
250
|
+
const svgCanvas = (0, render_js_1.renderSheetsToSVG)(sheetFrames, renderLogger);
|
|
242
251
|
showStats && console.log('Render took:', generateSvgTimer.lap());
|
|
252
|
+
dumpData && (0, fs_1.writeFileSync)('dump/raw-render.txt', renderLogger.dump());
|
|
243
253
|
svgOutput = (0, render_js_1.generateSvgOutput)(svgCanvas, outputDefaultZoom);
|
|
244
254
|
if (outputPath) {
|
|
245
255
|
if (fileExtension === 'svg') {
|
|
@@ -336,7 +346,10 @@ class UnitDimension {
|
|
|
336
346
|
}
|
|
337
347
|
exports.UnitDimension = UnitDimension;
|
|
338
348
|
function milsToMM(value) {
|
|
339
|
-
|
|
349
|
+
if (typeof value === 'number') {
|
|
350
|
+
value = (0, utils_js_1.resolveToNumericValue)(new big_js_1.default(value));
|
|
351
|
+
}
|
|
352
|
+
return (0, utils_js_1.resolveToNumericValue)(value.toBigNumber().mul(new big_js_1.default(globals_js_1.MilsToMM)));
|
|
340
353
|
}
|
|
341
354
|
exports.milsToMM = milsToMM;
|
|
342
355
|
function pxToMM(value) {
|