Releases: codehs/chs-js-lib
0.3.5
What's Changed
- Decouple Groups' bounds from their position to fix anchoring issues by @anderoonies in #142
- call resetDimensions on Text when we update the label by @zgalant in #147
New Contributors
Full Changelog: 0.3.4...0.3.5
0.3.4
What's Changed
Don't print the prompt and result of readLineAsync
. input
, the public configuration of Console
, should handle the prompt
message as the argument to the passed function.
0.3.3
What's Changed
Only print the parsed result of readNumber
for synchronous input. Asynchronous input prints itself before awaiting input.
0.3.2
What's Changed
- Improve shape voiceover by @thekuoster in #136
- Print succesfully parsed results from readNumber family of functions by @anderoonies in #139
New Contributors
- @thekuoster made their first contribution in #136
Full Changelog: 0.3.1...0.3.2
0.3.1
What's Changed
- Allow console to be configured with a prompt function by @anderoonies in #138
Full Changelog: 0.3.0...0.3.1
0.3.0
What's Changed
- Asynchronous input methods via
input
configuration by @anderoonies in #137
Asynchronous Input
0.3.0 changes the public API of the Console
class. It is now configured with input
, output
, and clear
.
input
configures how the asynchronous input methods readLineAsync
, readIntAsync
, readFloatAsync
, and readBooleanAsync
receive input. In CodeHS, they receive input via the postMessage
API, but the docs have some examples of how you might implement input with an input
element. Blocking input with prompt
is, for better or worse, the expectation for how many CodeHS programs work, so configuring the default readLine
behavior isn't an important option.
output
configures how print
and println
emit output. By default this is console.log
, but you can configure it however you'd like. This replaces the previous onPrint
option.
clear
configures how clear
functions. By default this is console.clear
. This replaces the previous onClear
option.
To read more about asynchronous input, check out this tutorial.
Full Changelog: 0.2.22...0.3.0
0.2.22
What's Changed
- Improved JSDoc documentation and some module reorganization to support documentation
- Fix re-sorting to prevent single-frame blips of incorrect sort by @anderoonies in #133
Re-Sorting Fix
This was a tricky little issue that was a result of a performance trade-off that was made for how re-sorting happened in the Graphics manager.
The Graphics manager draws elements from bottom to top, so it requires elements to be sorted from lowest layer to highest layer, and for elements with .alive = true
to come before those with .alive = false
.
As an optimization, elements' layer would be checked during the redraw
loop. As an element was drawn, its _sortInvalidated
property was checked to see if its layer had changed. If it had, the Graphics manager would re-sort its elements after the draw. This would cause a single frame where an invalid layering would happen.
To fix this, the Graphics manager now loops over its elements at least twice: once to check for layer changes or .alive
changes, once to draw elements, and a potential third time for sorting.
Here's a recording of an example that illustrates this issue, and the accompanying code:
let top = new Rectangle(getWidth(), getHeight());
top.setColor('orange');
top.layer = 2;
add(top);
setTimer(() => {
let circle = new Circle(30);
circle.setPosition(getWidth() / 2, getHeight() / 2);
add(circle);
}, 250);
You can see that, although the orange rectangle has the higher layer, the first frame that a circle is drawn it will appear above the Rectangle. In this release, that behavior has been removed.
Full Changelog: 0.2.21...0.2.22
0.2.21
0.2.20
What's Changed
- Webimage setImage race condition by @anderoonies in #130
- Disallow sub 1 device pixel ratio by @anderoonies in #132
Full Changelog: 0.2.19...0.2.20
0.2.19
What's Changed
- Make remove() flexible by allowing non-Things to be removed by @anderoonies in #127
- Update Polygons' bounding box calculations by @anderoonies in #128
Full Changelog: 0.2.18...0.2.19