From f077c3183dd7befae75bbe803e18e6eb77644c55 Mon Sep 17 00:00:00 2001 From: Alexander Lobas Date: Fri, 1 Feb 2013 20:31:03 +0400 Subject: [PATCH] Visual Edit --- .../designSurface/FlowBaseOperation.java | 39 ++++++++++++------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/FlowBaseOperation.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/FlowBaseOperation.java index dbdbea94271f..93956a554ed7 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/FlowBaseOperation.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/FlowBaseOperation.java @@ -75,28 +75,17 @@ public abstract class FlowBaseOperation extends AbstractEditOperation { public void showFeedback() { createFeedback(); - if (!getChildren().isEmpty()) { + List children = getChildren(); + if (!children.isEmpty()) { FeedbackLayer layer = myContext.getArea().getFeedbackLayer(); Point location = myContext.getLocation(); myChildTarget = null; if (myHorizontal) { - for (RadComponent child : getChildren()) { - Rectangle childBounds = getBounds(child, layer); - if (childBounds.x <= location.x && location.x <= childBounds.getMaxX()) { - myChildTarget = child; - break; - } - } + handleHorizontal(children, layer, location); } else { - for (RadComponent child : getChildren()) { - Rectangle childBounds = getBounds(child, layer); - if (childBounds.y <= location.y && location.y <= childBounds.getMaxY()) { - myChildTarget = child; - break; - } - } + handleVertical(children, layer, location); } if (myChildTarget == null) { myChildTarget = getSideChildTarget(); @@ -110,6 +99,26 @@ public abstract class FlowBaseOperation extends AbstractEditOperation { } } + protected void handleHorizontal(List children, FeedbackLayer layer, Point location) { + for (RadComponent child : children) { + Rectangle childBounds = getBounds(child, layer); + if (childBounds.x <= location.x && location.x <= childBounds.getMaxX()) { + myChildTarget = child; + break; + } + } + } + + protected void handleVertical(List children, FeedbackLayer layer, Point location) { + for (RadComponent child : children) { + Rectangle childBounds = getBounds(child, layer); + if (childBounds.y <= location.y && location.y <= childBounds.getMaxY()) { + myChildTarget = child; + break; + } + } + } + protected void setInsertFeedbackBounds(Rectangle targetBounds) { if (myHorizontal) { if (myInsertBefore) {