From 0d2d81b0a909caa458514b8332cfc2d36075c0a6 Mon Sep 17 00:00:00 2001 From: Stephane Dallongeville <stephane@outlook.com> Date: Mon, 20 Apr 2020 16:02:25 +0200 Subject: [PATCH] fixed possible exception --- .../adufour/protocols/gui/block/BlockPanel.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/plugins/adufour/protocols/gui/block/BlockPanel.java b/src/plugins/adufour/protocols/gui/block/BlockPanel.java index 07e6f83..5dfcf70 100644 --- a/src/plugins/adufour/protocols/gui/block/BlockPanel.java +++ b/src/plugins/adufour/protocols/gui/block/BlockPanel.java @@ -1132,22 +1132,27 @@ public class BlockPanel extends JPanel implements ActionListener, BlockListener public Point getDragZoneLocation(Var<?> output) { if (blockDesc.isCollapsed() && !(this instanceof WorkFlowPanel)) - { return new Point(getX() + getWidth() - SHADOW_SIZE, getY() + getHeight() / 2); - } + DragDropZone dz = getDragZone(output); + if (!dz.isVisible()) + return new Point(getX() + getWidth() - SHADOW_SIZE, getY() + getHeight() / 2); + int x = dz.getLocationOnScreen().x - getParent().getLocationOnScreen().x; int y = dz.getLocationOnScreen().y - getParent().getLocationOnScreen().y; + return new Point(x + dz.getWidth(), y + dz.getHeight() / 2); } public Point getDropZoneLocation(Var<?> input) { if (blockDesc.isCollapsed() && !(this instanceof WorkFlowPanel)) - { return new Point(getX() + SHADOW_SIZE, getY() + getHeight() / 2); - } + DragDropZone dz = getDropZone(input); + if (!dz.isVisible()) + return new Point(getX() + SHADOW_SIZE, getY() + getHeight() / 2); + int x = dz.getLocationOnScreen().x - getParent().getLocationOnScreen().x; int y = dz.getLocationOnScreen().y - getParent().getLocationOnScreen().y; return new Point(x, y + dz.getHeight() / 2); -- GitLab