Layout fixes
This commit is contained in:
+17
-9
@@ -237,7 +237,8 @@ class App {
|
||||
appx = 0;
|
||||
#end
|
||||
|
||||
appy = UIHeader.inst.headerh * 2;
|
||||
appy = UIHeader.headerh;
|
||||
if (Config.raw.layout[LayoutHeader] == 1) appy += UIHeader.headerh;
|
||||
var cam = Scene.active.camera;
|
||||
cam.data.raw.fov = Std.int(cam.data.raw.fov * 100) / 100;
|
||||
cam.buildProjection();
|
||||
@@ -312,16 +313,17 @@ class App {
|
||||
}
|
||||
|
||||
var res = System.windowHeight();
|
||||
|
||||
if (UIBase.inst == null) {
|
||||
res -= UIHeader.defaultHeaderH * 2 + UIStatus.defaultStatusH;
|
||||
}
|
||||
else if (UIBase.inst != null && UIBase.inst.show && res > 0) {
|
||||
var statush = Config.raw.layout[LayoutStatusH];
|
||||
res -= Std.int(UIHeader.defaultHeaderH * 2 * Config.raw.window_scale) + statush;
|
||||
}
|
||||
|
||||
if (UIHeader.inst != null && !UIHeader.inst.show) {
|
||||
res += UIHeader.inst.headerh;
|
||||
}
|
||||
if (Config.raw.layout[LayoutHeader] == 0) {
|
||||
res += UIHeader.headerh;
|
||||
}
|
||||
|
||||
return res > 0 ? res : 1; // App was minimized, force render path resize
|
||||
@@ -425,9 +427,9 @@ class App {
|
||||
#if is_lab
|
||||
appx = 0;
|
||||
#end
|
||||
appy = UIHeader.inst.headerh * 2;
|
||||
if (!UIHeader.inst.show) {
|
||||
appy -= UIHeader.inst.headerh;
|
||||
appy = UIHeader.headerh * 2;
|
||||
if (Config.raw.layout[LayoutHeader] == 0) {
|
||||
appy -= UIHeader.headerh;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -798,7 +800,7 @@ class App {
|
||||
g.color = 0xffffffff;
|
||||
}
|
||||
|
||||
var usingMenu = UIMenu.show && mouse.y > UIHeader.inst.headerh;
|
||||
var usingMenu = UIMenu.show && mouse.y > UIHeader.headerh;
|
||||
uiEnabled = !UIBox.show && !usingMenu && !isComboSelected();
|
||||
if (UIBox.show) UIBox.render(g);
|
||||
if (UIMenu.show) UIMenu.render(g);
|
||||
@@ -947,7 +949,13 @@ class App {
|
||||
Std.int(iron.App.h() / 2),
|
||||
#end
|
||||
|
||||
Std.int(UIStatus.defaultStatusH * raw.window_scale)
|
||||
Std.int(UIStatus.defaultStatusH * raw.window_scale),
|
||||
|
||||
#if (krom_android || krom_ios)
|
||||
0, // LayoutHeader
|
||||
#else
|
||||
1,
|
||||
#end
|
||||
];
|
||||
|
||||
raw.layout_tabs = [
|
||||
|
||||
@@ -350,9 +350,11 @@ package arm;
|
||||
var LayoutNodesW = 3;
|
||||
var LayoutNodesH = 4;
|
||||
var LayoutStatusH = 5;
|
||||
var LayoutHeader = 6; // 0 - hidden, 1 - visible
|
||||
#end
|
||||
#if is_lab
|
||||
var LayoutNodesW = 0;
|
||||
var LayoutStatusH = 1;
|
||||
var LayoutHeader = 2;
|
||||
#end
|
||||
}
|
||||
|
||||
@@ -89,6 +89,7 @@ class BoxPreferences {
|
||||
if (ui.changed) {
|
||||
Zui.touchScroll = Zui.touchHold = Zui.touchTooltip = Config.raw.touch_ui;
|
||||
Config.loadTheme(Config.raw.theme);
|
||||
setScale();
|
||||
UIBase.inst.tagUIRedraw();
|
||||
}
|
||||
#end
|
||||
@@ -642,7 +643,7 @@ plugin.drawUI = function(ui) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 600, 400, function() { Config.save(); });
|
||||
}, 620, 450, function() { Config.save(); });
|
||||
}
|
||||
|
||||
public static function fetchThemes() {
|
||||
@@ -674,7 +675,7 @@ plugin.drawUI = function(ui) {
|
||||
static function setScale() {
|
||||
var scale = Config.raw.window_scale;
|
||||
UIBase.inst.ui.setScale(scale);
|
||||
UIHeader.inst.headerh = Std.int(UIHeader.defaultHeaderH * scale);
|
||||
UIHeader.headerh = Std.int(UIHeader.defaultHeaderH * scale);
|
||||
Config.raw.layout[LayoutStatusH] = Std.int(UIStatus.defaultStatusH * scale);
|
||||
UIMenubar.inst.menubarw = Std.int(UIMenubar.defaultMenubarW * scale);
|
||||
UIBase.inst.setIconScale();
|
||||
|
||||
@@ -79,7 +79,7 @@ class UIBase {
|
||||
new UIStatus();
|
||||
new UIMenubar();
|
||||
|
||||
UIHeader.inst.headerh = Std.int(UIHeader.defaultHeaderH * Config.raw.window_scale);
|
||||
UIHeader.headerh = Std.int(UIHeader.defaultHeaderH * Config.raw.window_scale);
|
||||
UIMenubar.inst.menubarw = Std.int(UIMenubar.defaultMenubarW * Config.raw.window_scale);
|
||||
|
||||
#if (is_paint || is_sculpt)
|
||||
|
||||
@@ -23,23 +23,17 @@ class UIHeader {
|
||||
public static inline var defaultHeaderH = 28;
|
||||
#end
|
||||
|
||||
public static var headerh = defaultHeaderH;
|
||||
public var headerHandle = new Handle({ layout: Horizontal });
|
||||
public var headerh = defaultHeaderH;
|
||||
public var worktab = Id.handle();
|
||||
|
||||
#if (krom_android || krom_ios)
|
||||
public var show = false;
|
||||
#else
|
||||
public var show = true;
|
||||
#end
|
||||
|
||||
public function new() {
|
||||
inst = this;
|
||||
}
|
||||
|
||||
@:access(zui.Zui)
|
||||
public function renderUI(g: kha.graphics2.Graphics) {
|
||||
if (!show) return;
|
||||
if (Config.raw.layout[LayoutHeader] == 0) return;
|
||||
|
||||
var ui = UIBase.inst.ui;
|
||||
var panelx = iron.App.x();
|
||||
|
||||
@@ -591,10 +591,19 @@ class UIMenu {
|
||||
public static function menuStart(ui: Zui) {
|
||||
// Draw top border
|
||||
ui.g.color = ui.t.ACCENT_SELECT_COL;
|
||||
ui.g.fillRect(ui._x - 1 + menuCategoryW, ui._y - 1, ui._w + 2 - menuCategoryW, 1);
|
||||
ui.g.fillRect(ui._x - 1, ui._y - menuCategoryH, menuCategoryW, 1);
|
||||
ui.g.fillRect(ui._x - 1, ui._y - menuCategoryH, 1, menuCategoryH);
|
||||
ui.g.fillRect(ui._x - 1 + menuCategoryW, ui._y - menuCategoryH, 1, menuCategoryH);
|
||||
if (Config.raw.touch_ui) {
|
||||
ui.g.fillRect(ui._x + ui._w / 2 + menuCategoryW / 2, ui._y - 1, ui._w / 2 - menuCategoryW / 2 + 1, 1);
|
||||
ui.g.fillRect(ui._x - 1, ui._y - 1, ui._w / 2 - menuCategoryW / 2 + 1, 1);
|
||||
ui.g.fillRect(ui._x + ui._w / 2 - menuCategoryW / 2, ui._y - menuCategoryH, menuCategoryW, 1);
|
||||
ui.g.fillRect(ui._x + ui._w / 2 - menuCategoryW / 2, ui._y - menuCategoryH, 1, menuCategoryH);
|
||||
ui.g.fillRect(ui._x + ui._w / 2 + menuCategoryW / 2, ui._y - menuCategoryH, 1, menuCategoryH);
|
||||
}
|
||||
else {
|
||||
ui.g.fillRect(ui._x - 1 + menuCategoryW, ui._y - 1, ui._w + 2 - menuCategoryW, 1);
|
||||
ui.g.fillRect(ui._x - 1, ui._y - menuCategoryH, menuCategoryW, 1);
|
||||
ui.g.fillRect(ui._x - 1, ui._y - menuCategoryH, 1, menuCategoryH);
|
||||
ui.g.fillRect(ui._x - 1 + menuCategoryW, ui._y - menuCategoryH, 1, menuCategoryH);
|
||||
}
|
||||
ui.g.color = 0xffffffff;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,6 +111,7 @@ class UIMenubar {
|
||||
var nodesw = (UINodes.inst.show || UIView2D.inst.show) ? Config.raw.layout[LayoutNodesW] : 0;
|
||||
var ww = System.windowWidth() - Config.raw.layout[LayoutSidebarW] - menubarw - nodesw;
|
||||
if (ui.window(workspaceHandle, panelx, 0, ww, Std.int(UIHeader.defaultHeaderH * ui.SCALE()))) {
|
||||
// ui.tab(UIHeader.inst.worktab, tr("3D View"));
|
||||
ui.tab(UIHeader.inst.worktab, tr("Paint"));
|
||||
ui.tab(UIHeader.inst.worktab, tr("Material"));
|
||||
ui.tab(UIHeader.inst.worktab, tr("Bake"));
|
||||
@@ -207,7 +208,7 @@ class UIMenubar {
|
||||
UIMenu.menuY = Std.int(Ext.MENUBAR_H(ui));
|
||||
if (Config.raw.touch_ui) {
|
||||
var menuW = Std.int(App.defaultElementW * App.uiMenu.SCALE() * 2.0);
|
||||
UIMenu.menuX -= Std.int((menuW - ui._w) / 2) + Std.int(UIHeader.inst.headerh / 2);
|
||||
UIMenu.menuX -= Std.int((menuW - ui._w) / 2) + Std.int(UIHeader.headerh / 2);
|
||||
// UIMenu.menuY += 4;
|
||||
UIMenu.keepOpen = true;
|
||||
}
|
||||
|
||||
@@ -486,7 +486,7 @@ class UINodes {
|
||||
#if is_lab
|
||||
wx = Std.int(iron.App.w());
|
||||
#end
|
||||
wy = UIHeader.inst.headerh * 2;
|
||||
wy = UIHeader.headerh * 2;
|
||||
|
||||
#if (is_paint || is_sculpt)
|
||||
if (UIView2D.inst.show) {
|
||||
@@ -756,14 +756,14 @@ class UINodes {
|
||||
}
|
||||
|
||||
var ew = Std.int(ui.ELEMENT_W() * 0.7);
|
||||
wh = iron.App.h() + UIHeader.inst.headerh * 2;
|
||||
wh = iron.App.h() + UIHeader.headerh * 2;
|
||||
|
||||
#if (is_paint || is_sculpt)
|
||||
if (UIView2D.inst.show) {
|
||||
wh = Config.raw.layout[LayoutNodesH];
|
||||
wy = iron.App.h() - Config.raw.layout[LayoutNodesH] + UIHeader.inst.headerh * 2;
|
||||
wy = iron.App.h() - Config.raw.layout[LayoutNodesH] + UIHeader.headerh * 2;
|
||||
if (!UIBase.inst.show) {
|
||||
wy -= UIHeader.inst.headerh * 2;
|
||||
wy -= UIHeader.headerh * 2;
|
||||
}
|
||||
}
|
||||
#end
|
||||
@@ -787,7 +787,7 @@ class UINodes {
|
||||
#if (is_paint || is_sculpt)
|
||||
ui.windowBorderRight = Config.raw.layout[LayoutSidebarW];
|
||||
#end
|
||||
ui.windowBorderTop = UIHeader.inst.headerh * 2;
|
||||
ui.windowBorderTop = UIHeader.headerh * 2;
|
||||
ui.windowBorderBottom = Config.raw.layout[LayoutStatusH];
|
||||
nodes.nodeCanvas(ui, c);
|
||||
ui.inputEnabled = _inputEnabled;
|
||||
@@ -931,11 +931,11 @@ class UINodes {
|
||||
#end
|
||||
|
||||
// Menu
|
||||
var startY = ui.ELEMENT_H() + ui.ELEMENT_OFFSET();
|
||||
ui.g.color = ui.t.SEPARATOR_COL;
|
||||
ui.g.fillRect(0, startY, ww, ui.ELEMENT_H() + ui.ELEMENT_OFFSET());
|
||||
ui.g.fillRect(0, ui.ELEMENT_H(), ww, ui.ELEMENT_H() + ui.ELEMENT_OFFSET() * 2);
|
||||
ui.g.color = 0xffffffff;
|
||||
|
||||
var startY = ui.ELEMENT_H() + ui.ELEMENT_OFFSET();
|
||||
ui._x = 0;
|
||||
ui._y = 2 + startY;
|
||||
ui._w = ew;
|
||||
@@ -1099,6 +1099,9 @@ class UINodes {
|
||||
popupY = wy + ui._y;
|
||||
if (Config.raw.touch_ui) {
|
||||
showMenuFirst = true;
|
||||
var menuw = Std.int(ew * 2.3);
|
||||
popupX -= menuw / 2;
|
||||
popupX += ui._w / 2;
|
||||
}
|
||||
UIMenu.menuCategoryW = ui._w;
|
||||
UIMenu.menuCategoryH = Std.int(Ext.MENUBAR_H(ui));
|
||||
|
||||
@@ -45,7 +45,7 @@ class UIToolbar {
|
||||
public function renderUI(g: kha.graphics2.Graphics) {
|
||||
var ui = UIBase.inst.ui;
|
||||
|
||||
if (ui.window(toolbarHandle, 0, UIHeader.inst.headerh, toolbarw, System.windowHeight() - UIHeader.inst.headerh)) {
|
||||
if (ui.window(toolbarHandle, 0, UIHeader.headerh, toolbarw, System.windowHeight() - UIHeader.headerh)) {
|
||||
ui._y -= 4 * ui.SCALE();
|
||||
|
||||
ui.imageScrollAlign = false;
|
||||
@@ -60,7 +60,7 @@ class UIToolbar {
|
||||
// Properties icon
|
||||
var rect = Res.tile50(img, 7, 1);
|
||||
if (ui.image(img, light ? 0xff666666 : ui.t.BUTTON_COL, null, rect.x, rect.y, rect.w, rect.h) == State.Started) {
|
||||
UIHeader.inst.show = !UIHeader.inst.show;
|
||||
Config.raw.layout[LayoutHeader] = 1 - Config.raw.layout[LayoutHeader];
|
||||
}
|
||||
if (ui.isHovered) ui.tooltip(tr("Toggle header"));
|
||||
ui._y -= 4 * ui.SCALE();
|
||||
|
||||
@@ -92,9 +92,9 @@ class UIView2D {
|
||||
|
||||
ui.begin(g);
|
||||
|
||||
var apph = System.windowHeight();
|
||||
if (UIHeader.inst.show) apph += UIHeader.inst.headerh;
|
||||
wh = System.windowHeight() - UIHeader.inst.headerh;
|
||||
var headerh = Config.raw.layout[LayoutHeader] == 1 ? UIHeader.headerh * 2 : UIHeader.headerh;
|
||||
var apph = System.windowHeight() - Config.raw.layout[LayoutStatusH] + headerh;
|
||||
wh = System.windowHeight() - Config.raw.layout[LayoutStatusH];
|
||||
|
||||
if (UINodes.inst.show) {
|
||||
wh -= Config.raw.layout[LayoutNodesH];
|
||||
@@ -234,11 +234,12 @@ class UIView2D {
|
||||
}
|
||||
|
||||
// Menu
|
||||
var startY = ui.ELEMENT_H() + ui.ELEMENT_OFFSET();
|
||||
var ew = Std.int(ui.ELEMENT_W());
|
||||
ui.g.color = ui.t.SEPARATOR_COL;
|
||||
ui.g.fillRect(0, startY, ww, ui.ELEMENT_H() + ui.ELEMENT_OFFSET());
|
||||
ui.g.fillRect(0, ui.ELEMENT_H(), ww, ui.ELEMENT_H() + ui.ELEMENT_OFFSET() * 2);
|
||||
ui.g.color = 0xffffffff;
|
||||
|
||||
var startY = ui.ELEMENT_H() + ui.ELEMENT_OFFSET();
|
||||
ui._x = 2;
|
||||
ui._y = 2 + startY;
|
||||
ui._w = ew;
|
||||
|
||||
Reference in New Issue
Block a user