HaxeFlixel / HaxeFlixel/flixel-ui

Can't use FlxUIInputText .resize() in create.

Open
#217 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Haxe
Stars
201
Forks
75
PR merge metrics
No merged PRs in 30d

Description

Haxe version: 3.4.7
Lime version: 7.3.0
Flixel version: 4.6.1
Build: html5
OS: macOS 10.14.4
Browsers: FF66.0.3, Opera58.0.3135.132, Safari12.1

If I try set the width for newly created component of FlxUIInputText like this:

input = new FlxUIInputText(10, 580, 200);

or this:

input = new FlxUIInputText(10, 580);
input.resize(200, 24);

and start to write whatever in such input field I get this error in browser and game hangs:

Called from module __handleError@http://127.0.0.1:3000/SimpleGame.js:116020:40
Called from module __broadcastEvent@http://127.0.0.1:3000/SimpleGame.js:115848:7
Called from module __onLimeRender@http://127.0.0.1:3000/SimpleGame.js:116828:3
Called from module f@http://127.0.0.1:3000/SimpleGame.js:130999:233
Called from module dispatch@http://127.0.0.1:3000/SimpleGame.js:75636:16
Called from module handleApplicationEvent@http://127.0.0.1:3000/SimpleGame.js:351:6
Called from module f@http://127.0.0.1:3000/SimpleGame.js:130999:233
Called from module

TypeError: shader is null[Learn More] SimpleGame.js:37658:3
    render http://127.0.0.1:3000/SimpleGame.js:37658
    render http://127.0.0.1:3000/SimpleGame.js:8313
    draw http://127.0.0.1:3000/SimpleGame.js:11506
    onEnterFrame http://127.0.0.1:3000/SimpleGame.js:11334
    f http://127.0.0.1:3000/SimpleGame.js:130999
    __dispatchEvent http://127.0.0.1:3000/SimpleGame.js:1179
    __dispatch http://127.0.0.1:3000/SimpleGame.js:1941
    __broadcastEvent http://127.0.0.1:3000/SimpleGame.js:115844
    __onLimeRender http://127.0.0.1:3000/SimpleGame.js:116828
    f http://127.0.0.1:3000/SimpleGame.js:130999
    dispatch http://127.0.0.1:3000/SimpleGame.js:75636
    handleApplicationEvent http://127.0.0.1:3000/SimpleGame.js:351
    f http://127.0.0.1:3000/SimpleGame.js:130999

Safari even hangs while you try to open such scene where in create is input.resize().
But when I remove all the size setup from create method and put in update - besides ugly flickering sometime while you typing fast, everything works fine.
Maybe not everything. You can't erase first letter, it stays and if you start write again, it will be overwritten.
Another workaround is to set some input.text while you create the component. But if you need it empty at beginning, then you must use update workaround.

You can easily check this bug with online demo: http://haxeflixel.com/demos/Calculator/ but you don't want to use number buttons but enter number from keyboard. If you first press some button number, and then work with keyboard it will be all fine (except that bug with first number left after delete).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with FlxUIInputText creation and its resize path, comparing sizing done in create with sizing done in update. Reproduce the HTML5 issue using the Calculator demo and keyboard input. Done means an initially empty input can be sized during create without the shader error, and deleting and re-entering the first character behaves correctly.

Written by the indexing model from the issue text.

Assessment

Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.