aboutsummaryrefslogtreecommitdiffstats
path: root/draw9patch
diff options
context:
space:
mode:
authorKeiji Ariyama <keiji_ariyama@c-lis.co.jp>2011-02-04 02:46:15 +0900
committerKeiji Ariyama <keiji_ariyama@c-lis.co.jp>2011-02-04 04:26:09 +0900
commite73dda40f952f08312cfd6ac6eb1ccd64781a123 (patch)
treeb3eef61fe3fb499aa4be01a931b4de14174301f6 /draw9patch
parentc90bdb0ce4ed6c7494879d93091e40d9c575e43a (diff)
downloadsdk-e73dda40f952f08312cfd6ac6eb1ccd64781a123.zip
sdk-e73dda40f952f08312cfd6ac6eb1ccd64781a123.tar.gz
sdk-e73dda40f952f08312cfd6ac6eb1ccd64781a123.tar.bz2
draw9patch tool: improving zoom process.
Change-Id: Ie4d6408858db5b2bafb76ecb916e6b7c00ba0bb7
Diffstat (limited to 'draw9patch')
-rw-r--r--draw9patch/src/com/android/draw9patch/ui/ImageEditorPanel.java15
1 files changed, 8 insertions, 7 deletions
diff --git a/draw9patch/src/com/android/draw9patch/ui/ImageEditorPanel.java b/draw9patch/src/com/android/draw9patch/ui/ImageEditorPanel.java
index aac6145..1afc2ce 100644
--- a/draw9patch/src/com/android/draw9patch/ui/ImageEditorPanel.java
+++ b/draw9patch/src/com/android/draw9patch/ui/ImageEditorPanel.java
@@ -659,7 +659,7 @@ class ImageEditorPanel extends JPanel {
private boolean showPatches;
private boolean showLock = true;
- private Dimension size;
+ private final Dimension size;
private boolean locked;
@@ -699,7 +699,6 @@ class ImageEditorPanel extends JPanel {
setOpaque(true);
- // Set dummy size.
// Exact size will be set by setZoom() in AncestorListener#ancestorMoved.
size = new Dimension(0, 0);
@@ -1029,14 +1028,16 @@ class ImageEditorPanel extends JPanel {
zoom = value;
if (size.height == 0 || (getHeight() - size.height) == 0) {
- size = new Dimension(width * zoom, height * zoom + helpPanel.getHeight());
+ size.setSize(width * zoom, height * zoom + helpPanel.getHeight());
} else {
- size = new Dimension(width * zoom, height * zoom);
+ size.setSize(width * zoom, height * zoom);
}
- setSize(size);
- ImageEditorPanel.this.validate();
- repaint();
+ if (!size.equals(getSize())) {
+ setSize(size);
+ ImageEditorPanel.this.validate();
+ repaint();
+ }
}
void setPatchesVisible(boolean visible) {