Improve browser scrolling
This commit is contained in:
@@ -24,16 +24,21 @@ class TabBrowser {
|
||||
var bookmarksW = Std.int(100 * ui.SCALE());
|
||||
|
||||
var _y = ui._y;
|
||||
ui._x = bookmarksW;
|
||||
ui._w -= bookmarksW;
|
||||
if (hpath.text == "" && Config.raw.bookmarks.length > 0) { // Init to first bookmark
|
||||
hpath.text = Config.raw.bookmarks[0];
|
||||
}
|
||||
|
||||
// ui.beginSticky();
|
||||
ui.beginSticky();
|
||||
ui.row([bookmarksW / ui._w, 1 - bookmarksW / ui._w]);
|
||||
if (ui.button("+")) {
|
||||
Config.raw.bookmarks.push(hpath.text);
|
||||
Config.save();
|
||||
}
|
||||
hpath.text = ui.textInput(hpath, tr("Path"));
|
||||
// ui.endSticky();
|
||||
ui.endSticky();
|
||||
|
||||
ui._x = bookmarksW;
|
||||
ui._w -= bookmarksW;
|
||||
UIFiles.fileBrowser(ui, hpath, false, true);
|
||||
|
||||
if (known) {
|
||||
@@ -49,16 +54,10 @@ class TabBrowser {
|
||||
#end
|
||||
|
||||
var bottomY = ui._y;
|
||||
var _h = ui._h;
|
||||
ui._x = 0;
|
||||
ui._y = _y;
|
||||
ui._w = bookmarksW;
|
||||
|
||||
if (ui.button("+")) {
|
||||
Config.raw.bookmarks.push(hpath.text);
|
||||
Config.save();
|
||||
}
|
||||
|
||||
if (ui.button(tr("Cloud"), Left)) {
|
||||
hpath.text = "cloud";
|
||||
}
|
||||
@@ -85,7 +84,7 @@ class TabBrowser {
|
||||
}
|
||||
}
|
||||
|
||||
ui._y = bottomY;
|
||||
if (ui._y < bottomY) ui._y = bottomY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,15 +174,16 @@ class UIFiles {
|
||||
}
|
||||
if (f.endsWith(".arm") && !isCloud) {
|
||||
if (iconMap == null) iconMap = [];
|
||||
var icon = iconMap.get(handle.text + Path.sep + f);
|
||||
if (icon == null) {
|
||||
var bytes = Bytes.ofData(Krom.loadBlob(handle.text + Path.sep + f));
|
||||
var key = handle.text + Path.sep + f;
|
||||
var icon = iconMap.get(key);
|
||||
if (!iconMap.exists(key)) {
|
||||
var bytes = Bytes.ofData(Krom.loadBlob(key));
|
||||
var raw = ArmPack.decode(bytes);
|
||||
if (raw.material_icons != null) {
|
||||
var bytesIcon = raw.material_icons[0];
|
||||
icon = kha.Image.fromBytes(Lz4.decode(bytesIcon, 256 * 256 * 4), 256, 256);
|
||||
iconMap.set(handle.text + Path.sep + f, icon);
|
||||
}
|
||||
iconMap.set(key, icon);
|
||||
}
|
||||
if (icon != null) {
|
||||
state = ui.image(icon, 0xffffffff, 50 * ui.SCALE());
|
||||
|
||||
Reference in New Issue
Block a user