fixed union line parent with child when type image

Former-commit-id: ae80e3067fe8600c7e65eac0b35c7a3c16d03be5
This commit is contained in:
Daniel Barbero Martin 2019-04-16 09:41:17 +02:00
parent b0b1db5746
commit 5f4bc3a7e4
5 changed files with 32 additions and 3 deletions

View File

@ -156,6 +156,14 @@ final class Group extends Item
)
);
// If the width and height are equal to 0.
// We need to know the width and height of the image.
if ($data['width'] == 0 && $data['height'] == 0) {
$sizeImage = getimagesize($data['statusImageSrc']);
$data['width'] = $sizeImage[0];
$data['height'] = $sizeImage[1];
}
return $data;
}

View File

@ -116,6 +116,14 @@ final class Icon extends Item
\visual_map_get_image_status_element($data)
);
// If the width and height are equal to 0.
// We need to know the width and height of the image.
if ($data['width'] == 0 && $data['height'] == 0) {
$sizeImage = getimagesize($data['imageSrc']);
$data['width'] = $sizeImage[0];
$data['height'] = $sizeImage[1];
}
return $data;
}

View File

@ -181,6 +181,14 @@ final class StaticGraph extends Item
\visual_map_get_image_status_element($data)
);
// If the width and height are equal to 0.
// We need to know the width and height of the image.
if ($data['width'] == 0 && $data['height'] == 0) {
$sizeImage = getimagesize($data['statusImageSrc']);
$data['width'] = $sizeImage[0];
$data['height'] = $sizeImage[1];
}
// Get last value.
if (isset($data['show_last_value']) && $data['show_last_value'] !== 2) {
$img_style_title = '';

View File

@ -117,7 +117,7 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
private itemProps: Props;
// Reference to the DOM element which will contain the item.
public elementRef: HTMLElement;
private readonly labelElementRef: HTMLElement;
public readonly labelElementRef: HTMLElement;
// Reference to the DOM element which will contain the view of the item which extends this class.
protected readonly childElementRef: HTMLElement;
// Event manager for click events.

View File

@ -502,9 +502,14 @@ export default class VisualConsole {
// Get the items center.
const startX = parent.props.x + parent.elementRef.clientWidth / 2;
const startY = parent.props.y + parent.elementRef.clientHeight / 2;
const startY =
parent.props.y +
(parent.elementRef.clientHeight + parent.labelElementRef.clientHeight) /
2;
const endX = child.props.x + child.elementRef.clientWidth / 2;
const endY = child.props.y + child.elementRef.clientHeight / 2;
const endY =
child.props.y +
(child.elementRef.clientHeight + child.labelElementRef.clientHeight) / 2;
const line = new Line(
linePropsDecoder({