mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-04-08 18:55:09 +02:00
Fixed the resizement of a vc item when it has a label
This commit is contained in:
parent
08f100d608
commit
7a932aceec
@ -252,6 +252,29 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
|
||||
this.removeResizement = addResizementListener(
|
||||
element,
|
||||
(width: Size["width"], height: Size["height"]) => {
|
||||
// The label it's outside the item's size, so we need
|
||||
// to get rid of its size to get the real size of the
|
||||
// item's content.
|
||||
if (this.props.label && this.props.label.length > 0) {
|
||||
const {
|
||||
width: labelWidth,
|
||||
height: labelHeight
|
||||
} = this.labelElementRef.getBoundingClientRect();
|
||||
|
||||
switch (this.props.labelPosition) {
|
||||
case "up":
|
||||
case "down":
|
||||
height -= labelHeight;
|
||||
if (width < labelWidth) width = labelWidth;
|
||||
break;
|
||||
case "left":
|
||||
case "right":
|
||||
width -= labelWidth;
|
||||
if (height < labelHeight) height = labelHeight;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Move the DOM element.
|
||||
this.resizeElement(width, height);
|
||||
// Run the save function.
|
||||
|
Loading…
x
Reference in New Issue
Block a user