Apply Move action

This commit is contained in:
Jindra Petřík
2022-12-15 06:49:10 +01:00
parent dfec7d6435
commit 171421a7ca
2 changed files with 32 additions and 2 deletions

View File

@@ -367,7 +367,18 @@ public class TransformPanel extends JPanel {
}
private void applyMoveActionPerformed(ActionEvent e) {
//TODO
Matrix matrix = new Matrix();
try {
double moveHorizontal = convertUnit(Double.parseDouble(moveHorizontalTextField.getText()), (Unit)moveUnitComboBox.getSelectedItem(), Unit.TWIP);
double moveVertical = convertUnit(Double.parseDouble(moveVerticalTextField.getText()), (Unit)moveUnitComboBox.getSelectedItem(), Unit.TWIP);
if (!moveRelativeCheckBox.isSelected()) {
matrix.translate(-bounds.getX(), -bounds.getY());
}
matrix.translate(moveHorizontal, moveVertical);
imagePanel.applyTransformMatrix(matrix);
} catch (NumberFormatException nfe) {
}
}
private void clearScaleActionPerformed(ActionEvent e) {