Added: Option to enter custom zoom level by clicking on zoom percentage label

This commit is contained in:
Jindra Petřík
2025-05-08 22:40:31 +02:00
parent 33dbaa7575
commit 1971fe9753
9 changed files with 34 additions and 1 deletions

View File

@@ -19,6 +19,7 @@ All notable changes to this project will be documented in this file.
- [#2370] Setting for color and snap accuracy for guides, grid
- [#2370] Dialogs for editing grid, guides and snapping
- [#2453] SVG export/import - use image-rendering attribute for image smoothing
- Option to enter custom zoom level by clicking on zoom percentage label
### Fixed
- [#2424] DefineEditText handling of letterSpacing, font size on incorrect values

Binary file not shown.

After

Width:  |  Height:  |  Size: 784 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -1044,4 +1044,8 @@ grid_options.show_grid = Show grid
grid_options.edit = Edit grid...
move_guide = Move guide
move_guide.position = Position:
move_guide.position = Position:
zoom = Zoom
zoom.hint = Zoom level. Click to change.
zoom.enter = Enter zoom percentage value:

View File

@@ -18,14 +18,18 @@ package com.jpexs.decompiler.flash.gui.player;
import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.configuration.ConfigurationItemChangeListener;
import com.jpexs.decompiler.flash.ecma.EcmaNumberToString;
import com.jpexs.decompiler.flash.gui.AppStrings;
import com.jpexs.decompiler.flash.gui.GridDialog;
import com.jpexs.decompiler.flash.gui.GuidesDialog;
import com.jpexs.decompiler.flash.gui.Main;
import com.jpexs.decompiler.flash.gui.PopupButton;
import com.jpexs.decompiler.flash.gui.View;
import com.jpexs.decompiler.flash.gui.ViewMessages;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Objects;
@@ -129,6 +133,30 @@ public class ZoomPanel extends JPanel implements MediaDisplayListener {
};
gridButton.setToolTipText(AppStrings.translate("button.grid_options"));
percentLabel.setToolTipText(AppStrings.translate("zoom.hint"));
percentLabel.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
double currentZoom = roundZoom(getRealZoom() * 100, 3);
String newZoomStr = ViewMessages.showInputDialog(ZoomPanel.this, AppStrings.translate("zoom.enter"), AppStrings.translate("zoom"), View.getIcon("zoom32"), EcmaNumberToString.stringFor(currentZoom));
if (newZoomStr != null) {
try {
double newZoom = Double.parseDouble(newZoomStr) / 100;
if (newZoom <= 0) {
return;
}
realZoom = newZoom;
zoomToFit = false;
updateZoom();
} catch (NumberFormatException nfe) {
//ignore
}
}
}
});
setLayout(new FlowLayout());
add(percentLabel);
add(zoomInButton);