Merge branch 'ent-4258-visual-console-movement-redimension-mode' of https://brutus.artica.lan:8081/artica/pandorafms into ent-4258-visual-console-movement-redimension-mode

This commit is contained in:
Daniel Maya 2019-06-24 18:24:53 +02:00
commit a06cc36713
3 changed files with 21 additions and 4 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -265,12 +265,10 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
case "up":
case "down":
height -= labelHeight;
if (width < labelWidth) width = labelWidth;
break;
case "left":
case "right":
width -= labelWidth;
if (height < labelHeight) height = labelHeight;
break;
}
}
@ -739,6 +737,25 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
// The most valuable size is the content size.
this.childElementRef.style.width = width > 0 ? `${width}px` : null;
this.childElementRef.style.height = height > 0 ? `${height}px` : null;
if (this.props.label && this.props.label.length > 0) {
// Ugly table to show the label as its legacy counterpart.
const tables = this.labelElementRef.getElementsByTagName("table");
const table = tables.length > 0 ? tables.item(0) : null;
if (table) {
switch (this.props.labelPosition) {
case "up":
case "down":
table.style.width = width > 0 ? `${width}px` : null;
break;
case "left":
case "right":
table.style.height = height > 0 ? `${height}px` : null;
break;
}
}
}
}
/**