Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
TwIStOy committed Dec 8, 2023
1 parent 5f0975b commit e0842f7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
12 changes: 10 additions & 2 deletions src/graphics/widgets/column.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,17 @@ class _Column extends Widget {

this._renderBox = myBox;

let spacingSize = Math.max((height - fixedHeight) / spacingNum, 0);
let spacingSize = Math.max(
(paddingBox.height - fixedHeight) / spacingNum,
0
);

info("Column %s spacings, height: %s", spacingNum, spacingSize);
info(
"Column %s spacings, height: %s, fixed: %s",
spacingNum,
spacingSize,
fixedHeight
);

let usedHeight = 0;
for (let child of this._children) {
Expand Down
10 changes: 8 additions & 2 deletions src/graphics/widgets/text/text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,19 +171,25 @@ class _Text extends Widget {
_maxAvailable: number,
determinedWidth?: number | undefined
): FlexibleRange {
let fe = context.renderer.ctx.font_extents();
if (isNil(determinedWidth)) {
let fe = context.renderer.ctx.font_extents();
return {
min: fe.height * this._text.length,
max: "inf",
};
} else {
this._setupFont(context);
let fe = context.renderer.ctx.font_extents();
let lines = this._text.reduce((previous, line): number => {
let cnt = this._breakLine(context, line, determinedWidth);
return previous + cnt;
}, 0);
info("determinedWidth: %s, lines: %s", determinedWidth, lines);
info(
"determinedWidth: %s, lines: %s, base: %s",
determinedWidth,
lines,
fe.height
);
return {
min: fe.height * lines,
max: "inf",
Expand Down

0 comments on commit e0842f7

Please sign in to comment.