microsoft / pxt

Microsoft MakeCode (PXT - Programming eXperience Toolkit)
https://makecode.com
MIT License
2.1k stars 588 forks source link

fix in game safari webview gridpicker height #10276

Closed riknoll closed 1 week ago

riknoll commented 1 week ago

for whatever reason, the safari webview in minecraft is returning 0 for window.outerHeight but a correct number for window.innerHeight. this is definitely a browser bug given that the outerHeight should always be a bigger number than innerHeight as the name suggests.

this was causing both the block picker being too tall error and the animal picker being too short error. the difference between the two was that the block picker has the search bar, which was causing the div to be given a negative height whereas the animal picker was getting a height of 0

abchatra commented 1 week ago

@riknoll just curious, how does it work in live?

riknoll commented 1 week ago

good question! i'll try and debug it

riknoll commented 1 week ago

the old one was using one of the old closure APIs, goog.dom.getViewportSize(), which is no longer included in blockly. looks like that function was using the document element and getting the client height/width instead of checking the window.