mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
rearrange code ui: removing arrangement rule animation is too slow on HiDPI display
This commit is contained in:
-1
@@ -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;
|
||||
|
||||
|
||||
+11
-8
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user