add top, right, bottom and left resizer

This commit is contained in:
Martin Beyer
2021-08-24 18:52:55 +02:00
parent 03eebfe486
commit 7df028b0b8
2 changed files with 22 additions and 0 deletions

View File

@@ -22,6 +22,11 @@ public class ResizeController implements FxController {
public Region trResizer;
public Region blResizer;
public Region brResizer;
public Region tResizer;
public Region rResizer;
public Region bResizer;
public Region lResizer;
private double origX, origY, origW, origH;
@@ -40,10 +45,18 @@ public class ResizeController implements FxController {
trResizer.setOnMousePressed(this::startResize);
blResizer.setOnMousePressed(this::startResize);
brResizer.setOnMousePressed(this::startResize);
tResizer.setOnMousePressed(this::startResize);
rResizer.setOnMousePressed(this::startResize);
bResizer.setOnMousePressed(this::startResize);
lResizer.setOnMousePressed(this::startResize);
tlResizer.setOnMouseDragged(this::resizeTopLeft);
trResizer.setOnMouseDragged(this::resizeTopRight);
blResizer.setOnMouseDragged(this::resizeBottomLeft);
brResizer.setOnMouseDragged(this::resizeBottomRight);
tResizer.setOnMouseDragged(this::resizeTop);
rResizer.setOnMouseDragged(this::resizeRight);
bResizer.setOnMouseDragged(this::resizeBottom);
lResizer.setOnMouseDragged(this::resizeLeft);
window.setHeight(settings.windowHeightProperty().get());
//TODO: remove comments

View File

@@ -9,9 +9,18 @@
<fx:define>
<Cursor fx:id="nwResize" fx:constant="NW_RESIZE"/>
<Cursor fx:id="neResize" fx:constant="NE_RESIZE"/>
<Cursor fx:id="nsResize" fx:constant="N_RESIZE" />
<Cursor fx:id="ewResize" fx:constant="E_RESIZE" />
</fx:define>
<Region fx:id="tlResizer" cursor="${nwResize}" prefWidth="10" prefHeight="10" maxWidth="-Infinity" maxHeight="-Infinity" AnchorPane.topAnchor="0" AnchorPane.leftAnchor="0"/>
<Region fx:id="trResizer" cursor="${neResize}" prefWidth="10" prefHeight="10" maxWidth="-Infinity" maxHeight="-Infinity" AnchorPane.topAnchor="0" AnchorPane.rightAnchor="0"/>
<Region fx:id="blResizer" cursor="${neResize}" prefWidth="10" prefHeight="10" maxWidth="-Infinity" maxHeight="-Infinity" AnchorPane.bottomAnchor="0" AnchorPane.leftAnchor="0"/>
<Region fx:id="brResizer" cursor="${nwResize}" prefWidth="10" prefHeight="10" maxWidth="-Infinity" maxHeight="-Infinity" AnchorPane.bottomAnchor="0" AnchorPane.rightAnchor="0"/>
<Region fx:id="tResizer" cursor="${nsResize}" prefWidth="10" prefHeight="10" maxWidth="-Infinity" maxHeight="-Infinity" AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="0.0"/>
<Region fx:id="rResizer" cursor="${ewResize}" prefWidth="10" prefHeight="10" maxWidth="-Infinity" maxHeight="-Infinity" AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="10.0"/>
<Region fx:id="bResizer" cursor="${nsResize}" prefWidth="10" prefHeight="10" maxWidth="-Infinity" maxHeight="-Infinity" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="10.0"/>
<Region fx:id="lResizer" cursor="${ewResize}" prefWidth="10" prefHeight="10" maxWidth="-Infinity" maxHeight="-Infinity" AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="10.0"/>
</AnchorPane>