diff --git a/platform/lang-api/src/com/intellij/application/options/codeStyle/arrangement/ArrangementConstants.java b/platform/lang-api/src/com/intellij/application/options/codeStyle/arrangement/ArrangementConstants.java index 3b703dbcc4ca..0f4b975e5b4b 100644 --- a/platform/lang-api/src/com/intellij/application/options/codeStyle/arrangement/ArrangementConstants.java +++ b/platform/lang-api/src/com/intellij/application/options/codeStyle/arrangement/ArrangementConstants.java @@ -42,7 +42,6 @@ public class ArrangementConstants { public static final int CALLOUT_BORDER_HEIGHT = 10; public static final int BORDER_ARC_SIZE = 12; - public static final int ANIMATION_ITERATION_PIXEL_STEP = 5; public static final int ANIMATION_STEPS_TIME_GAP_MILLIS = 40; public static final int TEXT_UPDATE_DELAY_MILLIS = 1000; diff --git a/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/animation/ArrangementAnimationPanel.java b/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/animation/ArrangementAnimationPanel.java index a45f50c3ccfc..fbaf9dc054a6 100644 --- a/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/animation/ArrangementAnimationPanel.java +++ b/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/animation/ArrangementAnimationPanel.java @@ -33,6 +33,7 @@ import java.awt.image.BufferedImage; public class ArrangementAnimationPanel extends JPanel { @NotNull private final JComponent myContent; + private int myAnimationIterationStep; @Nullable private BufferedImage myImage; @Nullable private BufferedImage myCurrentImage; @@ -74,27 +75,29 @@ public class ArrangementAnimationPanel extends JPanel { graphics.fillRect(0, 0, size.width, size.height); myContent.paint(graphics); graphics.dispose(); + int expectedDurationMillis = 500; + myAnimationIterationStep = size.width / (expectedDurationMillis / ArrangementConstants.ANIMATION_STEPS_TIME_GAP_MILLIS); myContent.setBounds(bounds); applyDoubledBuffered(myContent, true); if (myExpand) { if (myHorizontal) { - myCurrentImage = myImage.getSubimage(0, 0, ArrangementConstants.ANIMATION_ITERATION_PIXEL_STEP, myImage.getHeight()); + myCurrentImage = myImage.getSubimage(0, 0, myAnimationIterationStep, myImage.getHeight()); } else { - myCurrentImage = myImage.getSubimage(0, 0, myImage.getWidth(), ArrangementConstants.ANIMATION_ITERATION_PIXEL_STEP); + myCurrentImage = myImage.getSubimage(0, 0, myImage.getWidth(), myAnimationIterationStep); } } else { if (myHorizontal) { myCurrentImage = myImage.getSubimage( - 0, 0, myImage.getWidth() - ArrangementConstants.ANIMATION_ITERATION_PIXEL_STEP, myImage.getHeight() + 0, 0, myImage.getWidth() - myAnimationIterationStep, myImage.getHeight() ); } else { myCurrentImage = myImage.getSubimage( - 0, 0, myImage.getWidth(), myImage.getHeight() - ArrangementConstants.ANIMATION_ITERATION_PIXEL_STEP + 0, 0, myImage.getWidth(), myImage.getHeight() - myAnimationIterationStep ); } } @@ -165,8 +168,8 @@ public class ArrangementAnimationPanel extends JPanel { if (myCurrentImage == null) { Dimension size = myContent.getPreferredSize(); - int width = (myHorizontal && myExpand) ? ArrangementConstants.ANIMATION_ITERATION_PIXEL_STEP : size.width; - int height = (!myHorizontal && myExpand) ? ArrangementConstants.ANIMATION_ITERATION_PIXEL_STEP : size.height; + int width = (myHorizontal && myExpand) ? myAnimationIterationStep : size.width; + int height = (!myHorizontal && myExpand) ? myAnimationIterationStep : size.height; return new Dimension(width, height); } return new Dimension(myCurrentImage.getWidth(), myCurrentImage.getHeight()); @@ -179,7 +182,7 @@ public class ArrangementAnimationPanel extends JPanel { } int sign = myExpand ? 1 : -1; - int result = myCurrentImage.getWidth() + sign * ArrangementConstants.ANIMATION_ITERATION_PIXEL_STEP; + int result = myCurrentImage.getWidth() + sign * myAnimationIterationStep; if (result <= 0 || result > myImage.getWidth()) { return -1; @@ -194,7 +197,7 @@ public class ArrangementAnimationPanel extends JPanel { } int sign = myExpand ? 1 : -1; - int result = myCurrentImage.getHeight() + sign * ArrangementConstants.ANIMATION_ITERATION_PIXEL_STEP; + int result = myCurrentImage.getHeight() + sign * myAnimationIterationStep; if (result <= 0 || result > myImage.getHeight()) { return -1;