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

Loading…
Cancel
Save