Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #166, Issue #140 #6

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions src/main/java/org/roger600/lienzo/client/DockingTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public boolean acceptContainment(WiresContainer parent, WiresShape child) {
return true;
}
});

wires_manager.setDockingAcceptor(new IDockingAcceptor() {
@Override
public boolean dockingAllowed(WiresContainer parent, WiresShape child) {
Expand Down Expand Up @@ -105,41 +105,46 @@ public int getHotspotSize() {
}
});

MultiPath parentMultiPath = new MultiPath().rect(0, 0, 300, 300).setStrokeColor("#000000");
MultiPath parentMultiPath = new MultiPath().rect(0, 0, 200, 200).setStrokeColor("#000000");
final WiresShape parentShape = new WiresShape(parentMultiPath);
parentShape.getContainer().setUserData( "dock-source" );
wires_manager.register( parentShape );
parentShape.setDraggable(true).setX(200).setY(200);
parentShape.setDraggable(true).setX(100).setY(200);
wires_manager.getMagnetManager().createMagnets(parentShape);

MultiPath parentMultiPath2 = new MultiPath().rect(0, 0, 200, 200).setCornerRadius(30).setStrokeColor("#000000");
final WiresShape parentShape2 = new WiresShape(parentMultiPath2);
parentShape2.getContainer().setUserData( "dock-source" );
wires_manager.register( parentShape2 );
parentShape2.setDraggable(true).setX(500).setY(200);
wires_manager.getMagnetManager().createMagnets(parentShape2);

MultiPath childMultiPath = new MultiPath().rect(0, 0, 100, 100).setStrokeColor("#CC0000");
final WiresShape childShape = new WiresShape(childMultiPath);
childShape.getContainer().setUserData( "dock-source" );
wires_manager.register( childShape );
childShape.setDraggable(true).setX(600).setY(200);
childShape.setDraggable(true).setX(200).setY(200);
wires_manager.getMagnetManager().createMagnets(childShape);

MultiPath dockMultiPath = new MultiPath().rect(0, 0, 100, 100).setStrokeColor("#0000FF");
final WiresShape dockShape = new WiresShape(dockMultiPath);
dockShape.getContainer().setUserData( "dock-target" );
wires_manager.register( dockShape );
dockShape.setDraggable(true).setX(600).setY(200);
dockShape.setDraggable(true).setX(200).setY(200);
wires_manager.getMagnetManager().createMagnets(dockShape);

doDock( parentShape, dockShape );

}

private void doDock( WiresShape parentShape , WiresShape child ) {

child.removeFromParent();

child.getGroup().setX( -50 ).setY( 50 );

parentShape.add(child);

child.setDockedTo(parentShape);

}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.ait.lienzo.client.core.shape.wires.event.WiresResizeStartHandler;
import com.ait.lienzo.client.core.shape.wires.event.WiresResizeStepEvent;
import com.ait.lienzo.client.core.shape.wires.event.WiresResizeStepHandler;
import com.ait.lienzo.client.core.types.BoundingBox;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
Expand Down Expand Up @@ -73,7 +74,8 @@ public void test(Layer layer) {

// Rectangle - cornering via corner-radius attribute
rectangle3 = new WiresShape( new MultiPath().rect(0, 0, 400, 400)
// TODO .setCornerRadius(50)
.setCornerRadius(50)
.setSizeConstraints( new BoundingBox(40, 40, 500, 500) )
.setStrokeColor( "#FFFFFF" ).setFillColor( "#CCBB00" ) )
.setX( 500 ).setY( 100 );

Expand Down