fix button spacing/flicker

This commit is contained in:
lunarcleint
2024-07-17 10:07:02 -07:00
parent 17dec84df1
commit 285855b195
3 changed files with 19 additions and 9 deletions
@@ -172,9 +172,7 @@ class CharacterAnimButton extends UIButton {
members.push(ghostIcon);
}
public override function update(elapsed:Float) {
bHeight = closed ? 52 : 208;
public inline function updateButtonsPos() {
playIcon.follow(this, 22, (52/2) - (playIcon.height/2));
field.follow(this, 22+16+10, (52/2) - (field.height/2) + 1);
@@ -200,13 +198,17 @@ class CharacterAnimButton extends UIButton {
indicesTextBox.follow(this, 158, 164);
for (button in foldableButtons)
button.visible = button.active = !closed;
for (ui => text in labels) {
text.follow(ui, -(2+(ui is UICheckbox?12:0)), -(18+(ui is UICheckbox?6:0)));
text.visible = text.active = ui.visible;
}
}
public override function update(elapsed:Float) {
bHeight = closed ? 52 : 208;
for (button in foldableButtons)
button.visible = button.active = !closed;
super.update(elapsed);
}
@@ -366,6 +368,7 @@ class CharacterAnimButton extends UIButton {
}
public override function draw() {
updateButtonsPos();
super.draw();
if (!closed && parent.displayAnimsFramesList.exists(anim)) {
+5 -3
View File
@@ -67,21 +67,23 @@ class UIButtonList<T:UIButton> extends UIWindow {
}
public inline function updateButtonsPos(elapsed:Float) {
var endButtonY:Float = 0;
for (i => button in buttons.members) {
if (button == null) continue;
if (curMoving != button) {
button.setPosition(
(bWidth/2) - (buttonSize.x/2) + buttonOffset.x,
CoolUtil.fpsLerp(button.y, ((buttonSize.y+buttonSpacing) * i) + buttonOffset.y, 0.25));
CoolUtil.fpsLerp(button.y, endButtonY + buttonOffset.y, 0.25));
}
endButtonY += button.bHeight+buttonSpacing;
if (button.hovered && FlxG.mouse.justPressed) curMoving = button;
}
if (addButton != null)
addButton.setPosition(
(bWidth/2) - (buttonSize.x/2) + buttonOffset.x,
CoolUtil.fpsLerp(addButton.y, ((buttonSize.y+buttonSpacing) * buttons.members.length) + buttonOffset.y, 0.25));
CoolUtil.fpsLerp(addButton.y, endButtonY + buttonOffset.y, 0.25));
if (curMoving != null) {
curMovingInterval += FlxG.mouse.deltaY;
+5
View File
@@ -305,6 +305,11 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
for (anim in xml.nodes.anim)
XMLUtil.addXMLAnimation(this, anim);
for (offset in animOffsets) {
offset.x = FlxMath.roundDecimal(offset.x, 2);
offset.y = FlxMath.roundDecimal(offset.y, 2);
}
for (attribute in xml.x.attributes())
if (!characterProperties.contains(attribute))
extra[attribute] = xml.x.get(attribute);