Search in sources :

Example 1 with InsertPicture

use of net.sf.latexdraw.commands.shape.InsertPicture in project latexdraw by arnobl.

the class Pencil method configureBindings.

@Override
protected void configureBindings() {
    bindPressToAddShape();
    // Binds a pressure to insert a picture
    nodeBinder(InsertPicture.class, new Press()).on(canvas).map(i -> new InsertPicture(ShapeFactory.INST.createPicture(getAdaptedPoint(i.getSrcLocalPoint())), canvas.getDrawing(), getPictureFileChooser())).when(i -> currentChoice.get() == EditionChoice.PICTURE && i.getButton() == MouseButton.PRIMARY).bind();
    bindDnDToDrawRectangularShape();
    bindDnDToDrawSquaredShape();
    bindDnDToDrawFreeHandShape();
    bindMultiClic2AddShape();
    // Binds a pressure to show the text setter
    nodeBinder(InitTextSetter.class, new Press()).on(canvas).map(i -> new InitTextSetter(textSetter, textSetter, "", getAdaptedPoint(i.getSrcLocalPoint()), null, null)).when(i -> (currentChoice.get() == EditionChoice.TEXT || currentChoice.get() == EditionChoice.PLOT) && i.getButton() == MouseButton.PRIMARY).bind();
}
Also used : ISquaredShape(net.sf.latexdraw.models.interfaces.shape.ISquaredShape) Arrays(java.util.Arrays) MouseButton(javafx.scene.input.MouseButton) IPositionShape(net.sf.latexdraw.models.interfaces.shape.IPositionShape) Point3D(javafx.geometry.Point3D) ShapeFactory(net.sf.latexdraw.models.ShapeFactory) IRectangularShape(net.sf.latexdraw.models.interfaces.shape.IRectangularShape) MathUtils(net.sf.latexdraw.models.MathUtils) AddShape(net.sf.latexdraw.commands.shape.AddShape) Function(java.util.function.Function) BorderPos(net.sf.latexdraw.models.interfaces.shape.BorderPos) Inject(net.sf.latexdraw.util.Inject) IShape(net.sf.latexdraw.models.interfaces.shape.IShape) InsertPicture(net.sf.latexdraw.commands.shape.InsertPicture) IPoint(net.sf.latexdraw.models.interfaces.shape.IPoint) DnD(org.malai.javafx.interaction.library.DnD) IFreehand(net.sf.latexdraw.models.interfaces.shape.IFreehand) ObjectProperty(javafx.beans.property.ObjectProperty) ViewFactory(net.sf.latexdraw.view.jfx.ViewFactory) IControlPointShape(net.sf.latexdraw.models.interfaces.shape.IControlPointShape) IPolygon(net.sf.latexdraw.models.interfaces.shape.IPolygon) IPolyline(net.sf.latexdraw.models.interfaces.shape.IPolyline) LangTool(net.sf.latexdraw.util.LangTool) IGroup(net.sf.latexdraw.models.interfaces.shape.IGroup) IBezierCurve(net.sf.latexdraw.models.interfaces.shape.IBezierCurve) InitTextSetter(net.sf.latexdraw.commands.shape.InitTextSetter) MultiClick(org.malai.javafx.interaction.library.MultiClick) Platform(javafx.application.Platform) Cursor(javafx.scene.Cursor) FileChooser(javafx.stage.FileChooser) IModifiablePointsShape(net.sf.latexdraw.models.interfaces.shape.IModifiablePointsShape) Press(org.malai.javafx.interaction.library.Press) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) Collections(java.util.Collections) InitTextSetter(net.sf.latexdraw.commands.shape.InitTextSetter) InsertPicture(net.sf.latexdraw.commands.shape.InsertPicture) Press(org.malai.javafx.interaction.library.Press)

Aggregations

Arrays (java.util.Arrays)1 Collections (java.util.Collections)1 Function (java.util.function.Function)1 Platform (javafx.application.Platform)1 ObjectProperty (javafx.beans.property.ObjectProperty)1 SimpleObjectProperty (javafx.beans.property.SimpleObjectProperty)1 Point3D (javafx.geometry.Point3D)1 Cursor (javafx.scene.Cursor)1 MouseButton (javafx.scene.input.MouseButton)1 FileChooser (javafx.stage.FileChooser)1 AddShape (net.sf.latexdraw.commands.shape.AddShape)1 InitTextSetter (net.sf.latexdraw.commands.shape.InitTextSetter)1 InsertPicture (net.sf.latexdraw.commands.shape.InsertPicture)1 MathUtils (net.sf.latexdraw.models.MathUtils)1 ShapeFactory (net.sf.latexdraw.models.ShapeFactory)1 BorderPos (net.sf.latexdraw.models.interfaces.shape.BorderPos)1 IBezierCurve (net.sf.latexdraw.models.interfaces.shape.IBezierCurve)1 IControlPointShape (net.sf.latexdraw.models.interfaces.shape.IControlPointShape)1 IFreehand (net.sf.latexdraw.models.interfaces.shape.IFreehand)1 IGroup (net.sf.latexdraw.models.interfaces.shape.IGroup)1