Browse Source

无jira任务 代码质量

newui
vito 10 months ago
parent
commit
366eaf01f3
  1. 11
      designer-base/src/main/java/com/fine/theme/utils/AnimatedPainterSupport.java

11
designer-base/src/main/java/com/fine/theme/utils/AnimatedPainterSupport.java

@ -9,6 +9,7 @@ import java.awt.Graphics2D;
/** /**
* 动画支持类用于存储动画状态并实现动画 * 动画支持类用于存储动画状态并实现动画
* 逻辑保持与AnimatedIcon逻辑一致
* *
* @author vito * @author vito
* @since 12.0 * @since 12.0
@ -29,6 +30,10 @@ class AnimatedPainterSupport {
private int width; private int width;
private int height; private int height;
/**
* 用于包内绘制保持与AnimatedIcon逻辑一致
* 后期整合逻辑之后在整理代码质量
*/
static void paint(AnimatedPainter painter, Component c, Graphics g, static void paint(AnimatedPainter painter, Component c, Graphics g,
int x, int y, int width, int height) { int x, int y, int width, int height) {
if (!isAnimationEnabled(painter, c)) { if (!isAnimationEnabled(painter, c)) {
@ -115,8 +120,9 @@ class AnimatedPainterSupport {
// animated value to the new target value with reduced duration // animated value to the new target value with reduced duration
as.animator.cancel(); as.animator.cancel();
int duration2 = (int) (animationDuration * as.fraction); int duration2 = (int) (animationDuration * as.fraction);
if (duration2 > 0) if (duration2 > 0) {
as.animator.setDuration(duration2); as.animator.setDuration(duration2);
}
as.startValue = as.animatedValue; as.startValue = as.animatedValue;
} else { } else {
// new animation // new animation
@ -153,8 +159,9 @@ class AnimatedPainterSupport {
} }
static void saveRepaintLocation(AnimatedPainter painter, Component c, int x, int y) { static void saveRepaintLocation(AnimatedPainter painter, Component c, int x, int y) {
if (!isAnimationEnabled(painter, c)) if (!isAnimationEnabled(painter, c)) {
return; return;
}
AnimatedPainterSupport[] ass = (AnimatedPainterSupport[]) ((JComponent) c).getClientProperty(painter.getClientPropertyKey()); AnimatedPainterSupport[] ass = (AnimatedPainterSupport[]) ((JComponent) c).getClientProperty(painter.getClientPropertyKey());
if (ass != null) { if (ass != null) {

Loading…
Cancel
Save