Skip to content

Commit

Permalink
small tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
ianharrigan committed Dec 15, 2023
1 parent 10544fa commit e700d85
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 22 deletions.
2 changes: 1 addition & 1 deletion haxe/ui/backend/CallLaterImpl.hx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class CallLaterImpl {
if (!added) {
added = true;
current = list1;
FlxG.signals.postUpdate.add(onUpdate);
FlxG.signals.preUpdate.add(onUpdate);
}
current.insert(0, fn);
}
Expand Down
16 changes: 4 additions & 12 deletions haxe/ui/backend/ComponentImpl.hx
Original file line number Diff line number Diff line change
Expand Up @@ -261,18 +261,10 @@ class ComponentImpl extends ComponentBase {
return child;
}

// TODO: really need revision on if this is still needed, or what purpose it was originally supposed
// to serve, maybe its no longer needed in flixel 5.0?
private var _overrideSkipTransformChildren:Bool = true;
private function superVisible(value:Bool) {
if (_overrideSkipTransformChildren) {
_skipTransformChildren = true;
}
_skipTransformChildren = true;
super.set_visible(value);
_skipTransformChildren = false;
if (_overrideSkipTransformChildren) {
_skipTransformChildren = false;
}
}

private override function handleAddComponentAt(child:Component, index:Int):Component {
Expand Down Expand Up @@ -1185,7 +1177,7 @@ class ComponentImpl extends ComponentBase {
// Flixel overrides
//***********************************************************************************************************

private var _updates:Int = 0;
private var _updates:Float = 0;
public override function update(elapsed:Float) {
if (_destroyed) {
super.update(elapsed);
Expand All @@ -1198,11 +1190,11 @@ class ComponentImpl extends ComponentBase {
}

clearCaches();
applyClipRect();
repositionChildren();
applyClipRect();

_updates++;
if (_updates == 2) {
if (_updates == 1) {
if (asComponent.hidden == false) {
applyVisibility(true);
} else {
Expand Down
15 changes: 6 additions & 9 deletions haxe/ui/backend/flixel/components/SparrowPlayer.hx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package haxe.ui.backend.flixel.components;

import haxe.ui.data.DataSource;
import haxe.ui.core.IDataComponent;
import haxe.ui.events.AnimationEvent;
import haxe.ui.core.Component;
import haxe.ui.geom.Size;
import haxe.ui.layouts.DefaultLayout;
import flixel.FlxSprite;
import flixel.graphics.frames.FlxAtlasFrames;
import flixel.graphics.frames.FlxFramesCollection;
import haxe.ui.containers.Box;
import haxe.ui.core.Component;
import haxe.ui.core.IDataComponent;
import haxe.ui.data.DataSource;
import haxe.ui.events.AnimationEvent;
import haxe.ui.geom.Size;
import haxe.ui.layouts.DefaultLayout;
import openfl.Assets;

private typedef AnimationInfo = {
Expand Down Expand Up @@ -38,7 +38,6 @@ class SparrowPlayer extends Box implements IDataComponent {

public function new() {
super();
_overrideSkipTransformChildren = false;
sprite = new FlxSprite(1, 1);
add(sprite);
}
Expand Down Expand Up @@ -138,8 +137,6 @@ class SparrowPlayer extends Box implements IDataComponent {
_redispatchStart = false;
dispatch(new AnimationEvent(AnimationEvent.START));
}

parentComponent._overrideSkipTransformChildren = false;
}

private var _cachedAnimationPrefixes:Array<AnimationInfo> = []; // component might not have an animation yet, so we'll cache it if thats the case
Expand Down

0 comments on commit e700d85

Please sign in to comment.