Search in sources :

Example 1 with SeparateShapes

use of net.sf.latexdraw.command.shape.SeparateShapes in project latexdraw by arnobl.

the class ShapeGrouper method configureBindings.

@Override
protected void configureBindings() {
    buttonBinder().toProduce(() -> new SeparateShapes(canvas.getDrawing(), getSelectCmd().map(sel -> sel.getShapes()).filter(sel -> sel.size() == 1 && sel.get(0) instanceof Group).map(sel -> (Group) sel.get(0)).orElseThrow())).when(() -> getSelectCmd().map(sel -> sel.getShapes()).filter(sel -> sel.size() == 1 && sel.get(0) instanceof Group).isPresent()).on(sepB).bind();
    buttonBinder().toProduce(() -> new JoinShapes(canvas.getDrawing(), getSelectCmd().map(sel -> sel.getShapes()).orElse(List.of()))).on(groupB).bind();
}
Also used : Button(javafx.scene.control.Button) EditingService(net.sf.latexdraw.service.EditingService) SeparateShapes(net.sf.latexdraw.command.shape.SeparateShapes) Drawing(net.sf.latexdraw.model.api.shape.Drawing) URL(java.net.URL) FXML(javafx.fxml.FXML) Group(net.sf.latexdraw.model.api.shape.Group) List(java.util.List) Inject(net.sf.latexdraw.util.Inject) ResourceBundle(java.util.ResourceBundle) AnchorPane(javafx.scene.layout.AnchorPane) JoinShapes(net.sf.latexdraw.command.shape.JoinShapes) Canvas(net.sf.latexdraw.view.jfx.Canvas) Group(net.sf.latexdraw.model.api.shape.Group) JoinShapes(net.sf.latexdraw.command.shape.JoinShapes) SeparateShapes(net.sf.latexdraw.command.shape.SeparateShapes)

Aggregations

URL (java.net.URL)1 List (java.util.List)1 ResourceBundle (java.util.ResourceBundle)1 FXML (javafx.fxml.FXML)1 Button (javafx.scene.control.Button)1 AnchorPane (javafx.scene.layout.AnchorPane)1 JoinShapes (net.sf.latexdraw.command.shape.JoinShapes)1 SeparateShapes (net.sf.latexdraw.command.shape.SeparateShapes)1 Drawing (net.sf.latexdraw.model.api.shape.Drawing)1 Group (net.sf.latexdraw.model.api.shape.Group)1 EditingService (net.sf.latexdraw.service.EditingService)1 Inject (net.sf.latexdraw.util.Inject)1 Canvas (net.sf.latexdraw.view.jfx.Canvas)1