@elicdavis/node-flow 0.1.2 → 0.1.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/dist/index.js +10 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/elements/text.ts +6 -6
- package/src/port.ts +3 -2
package/dist/index.mjs
CHANGED
|
@@ -985,17 +985,19 @@ renderColumn_fn = function(ctx, position, graphScale, scaledFillableSpace) {
|
|
|
985
985
|
};
|
|
986
986
|
|
|
987
987
|
// src/elements/text.ts
|
|
988
|
-
var _text, _align, _verticalAlign;
|
|
988
|
+
var _text, _align, _verticalAlign, _lineHeight;
|
|
989
989
|
var TextElement = class extends RenderElementBase {
|
|
990
990
|
constructor(text, styling) {
|
|
991
|
-
var _a, _b;
|
|
991
|
+
var _a, _b, _c;
|
|
992
992
|
super(styling);
|
|
993
993
|
__privateAdd(this, _text);
|
|
994
994
|
__privateAdd(this, _align);
|
|
995
995
|
__privateAdd(this, _verticalAlign);
|
|
996
|
+
__privateAdd(this, _lineHeight);
|
|
996
997
|
__privateSet(this, _text, text);
|
|
997
998
|
__privateSet(this, _align, (_a = styling == null ? void 0 : styling.Align) != null ? _a : "left" /* Left */);
|
|
998
999
|
__privateSet(this, _verticalAlign, (_b = styling == null ? void 0 : styling.VerticalAlign) != null ? _b : "top" /* Top */);
|
|
1000
|
+
__privateSet(this, _lineHeight, (_c = styling == null ? void 0 : styling.LineHeight) != null ? _c : 1);
|
|
999
1001
|
}
|
|
1000
1002
|
doRender(ctx, position, graphScale, scaledFillableSpace) {
|
|
1001
1003
|
const scale = Zero();
|
|
@@ -1037,7 +1039,7 @@ var TextElement = class extends RenderElementBase {
|
|
|
1037
1039
|
for (let i = 0; i < eles.length; i++) {
|
|
1038
1040
|
eles[i].render(ctx, graphScale, justifiedPosition);
|
|
1039
1041
|
eles[i].size(ctx, 1, tempSize);
|
|
1040
|
-
justifiedPosition.y +=
|
|
1042
|
+
justifiedPosition.y += __privateGet(this, _text).style().getSize() * __privateGet(this, _lineHeight);
|
|
1041
1043
|
}
|
|
1042
1044
|
}
|
|
1043
1045
|
}
|
|
@@ -1049,17 +1051,17 @@ var TextElement = class extends RenderElementBase {
|
|
|
1049
1051
|
const eles = __privateGet(this, _text).breakIntoLines(ctx, limitations.x);
|
|
1050
1052
|
const tempSize = { x: 0, y: 0 };
|
|
1051
1053
|
out.x = 0;
|
|
1052
|
-
out.y =
|
|
1054
|
+
out.y = __privateGet(this, _text).style().getSize() * eles.length * __privateGet(this, _lineHeight);
|
|
1053
1055
|
for (let i = 0; i < eles.length; i++) {
|
|
1054
1056
|
eles[i].size(ctx, 1, tempSize);
|
|
1055
1057
|
out.x = Math.max(tempSize.x, out.x);
|
|
1056
|
-
out.y += tempSize.y;
|
|
1057
1058
|
}
|
|
1058
1059
|
}
|
|
1059
1060
|
};
|
|
1060
1061
|
_text = new WeakMap();
|
|
1061
1062
|
_align = new WeakMap();
|
|
1062
1063
|
_verticalAlign = new WeakMap();
|
|
1064
|
+
_lineHeight = new WeakMap();
|
|
1063
1065
|
|
|
1064
1066
|
// src/utils/string.ts
|
|
1065
1067
|
var binarySearch = ({ max, getValue, match }) => {
|
|
@@ -1401,8 +1403,9 @@ var Port = class {
|
|
|
1401
1403
|
new Text(description, { color: "white", style: "italic" /* Italic */ }),
|
|
1402
1404
|
{
|
|
1403
1405
|
Align: "center" /* Center */,
|
|
1404
|
-
Padding: { Top:
|
|
1405
|
-
MaxWidth:
|
|
1406
|
+
Padding: { Top: 16 },
|
|
1407
|
+
MaxWidth: 400,
|
|
1408
|
+
LineHeight: 1.5
|
|
1406
1409
|
}
|
|
1407
1410
|
));
|
|
1408
1411
|
}
|