diff options
author | Tor Norbye <tnorbye@google.com> | 2011-02-04 08:53:16 -0800 |
---|---|---|
committer | Android Code Review <code-review@android.com> | 2011-02-04 08:53:16 -0800 |
commit | e1e78fe1f5767925a6d411270064e434758250ec (patch) | |
tree | 69e48063d26ced68dfceeb891034b32f79d94035 | |
parent | 4f8cd0462b61aa770cb0e1ab83e4b6a88b3666ef (diff) | |
parent | e73dda40f952f08312cfd6ac6eb1ccd64781a123 (diff) | |
download | sdk-e1e78fe1f5767925a6d411270064e434758250ec.zip sdk-e1e78fe1f5767925a6d411270064e434758250ec.tar.gz sdk-e1e78fe1f5767925a6d411270064e434758250ec.tar.bz2 |
Merge "draw9patch tool: improving zoom process."
-rw-r--r-- | draw9patch/src/com/android/draw9patch/ui/ImageEditorPanel.java | 15 |
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) { |