Visual Edit

This commit is contained in:
Alexander Lobas
2013-02-01 20:32:12 +04:00
parent 2b1efb5e9e
commit f077c3183d
@@ -75,28 +75,17 @@ public abstract class FlowBaseOperation extends AbstractEditOperation {
public void showFeedback() {
createFeedback();
if (!getChildren().isEmpty()) {
List<RadComponent> 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<RadComponent> 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<RadComponent> 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) {