Skip to content

FlxBar: Refresh rendering when fill direction changes - #3663

Merged
Geokureli merged 1 commit into
HaxeFlixel:devfrom
snowyukitty:fix/bar-fill-direction
Oct 29, 2026
Merged

Geokureli merged 1 commit into
HaxeFlixel:devfrom
snowyukitty:fix/bar-fill-direction

Conversation

@snowyukitty

Copy link
Copy Markdown
Contributor

Fixes #3256.

Changing fillDirection currently leaves the displayed bar unchanged, and subsequent redraws can reuse crop/destination offsets from the previous direction. Switching a right-to-left bar to left-to-right can therefore leave two filled sections.

Reset the crop rectangle and destination point for each fill update, and redraw on direction assignment once the constructor has initialized the bar. This calls updateBar() directly, so it does not reassign the value or trigger empty/full callbacks. Existing fill calculations are preserved.

Regression coverage includes the issue's bordered 640×25 bar, immediate pixel placement, all 8×8 direction transitions with solid/bordered/gradient bars, and callback preservation at empty, partial and full values.

Validation with Haxe 4.3.7, Lime 8.3.2 and OpenFL 9.5.2:

  • Complete native C++ munit suite: 681 passed, 38 existing ignored tests; unchanged base: 676 passed, the same 38 ignored.
  • HTML5 FlxBar tests executed in Chromium with both WebGL (DRAW_TILES) and Canvas (BLITTING): 6 passed in each. The three rendering regressions fail on the unchanged source in both modes.
  • Complete unit-suite builds for HTML5 WebGL/Canvas, Flash and HashLink passed.
  • A real FlxGame smoke scene renders switched-direction bars beside fresh reference bars; all eight pairs match pixel-for-pixel in both browser renderers after the fix.

The complete HTML5 suite's browser execution hits an existing pre-main FlxSoundTest/Lime Base64 initialization error on the unchanged base as well. Browser execution above uses the focused FlxBar suite; complete runtime coverage is from C++.

@Geokureli Geokureli added this to the 6.2.1 milestone Oct 29, 2026
@Geokureli
Geokureli merged commit ee4c9a9 into HaxeFlixel:dev Oct 29, 2026
8 checks passed
@Geokureli

Copy link
Copy Markdown
Member

Thanks! Thanks, especially for adding tests; most contributors don't bother

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error with FlxBar rendering if fill direction is changed

2 participants