Editor responsivo: menu com "☰", modo compacto e gestos de toque
Menu calculado pela largura (o que nao cabe vai para o "☰"). Abaixo de 720 px o editor mostra uma area por vez: scripts com a paleta em gaveta ou palco sobre a saida (alternador Codigo|Palco + bandeira no menu). Categorias rolam, abas encolhem, lados fixos limitados em janelas medias. Toque: direcao decide entre tirar bloco e rolar o flyout, segurar abre o menu de contexto, arrastar rola os dialogos. Explorador, Configuracoes, Bibliotecas e aba de imagem com versao estreita. TINYBLOCKS_WIN_SIZE no host e cenario 31 (compacto) no harness. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
aa170d9bd4
commit
756540eb76
6 files changed
+572
-154
No files matched your search
+36
-2
@@ -49,6 +49,7 @@ static void draw(void) {
|
||||
}
|
||||
|
||||
static float g_scroll_dy = 0.f;
|
||||
static int g_win_w = 1280, g_win_h = 720;
|
||||
static void frame(float mx, float my, int ld, int lu, int rd, int sc, const char* text) {
|
||||
tb_block_set_output(ev, GFX_IN_MOUSE_X, tb_value_real(mx));
|
||||
tb_block_set_output(ev, GFX_IN_MOUSE_Y, tb_value_real(my));
|
||||
@@ -62,8 +63,8 @@ static void frame(float mx, float my, int ld, int lu, int rd, int sc, const char
|
||||
tb_block_set_output(ev, GFX_IN_DROP_FILE, tb_value_text(""));
|
||||
tb_block_set_output(ev, GFX_IN_SCROLL_DX, tb_value_real(0));
|
||||
tb_block_set_output(ev, GFX_IN_SCROLL_DY, tb_value_real(g_scroll_dy));
|
||||
tb_block_set_output(ev, GFX_IN_WIN_W, tb_value_integer(1280));
|
||||
tb_block_set_output(ev, GFX_IN_WIN_H, tb_value_integer(720));
|
||||
tb_block_set_output(ev, GFX_IN_WIN_W, tb_value_integer(g_win_w));
|
||||
tb_block_set_output(ev, GFX_IN_WIN_H, tb_value_integer(g_win_h));
|
||||
tb_block_eval(scene, rt);
|
||||
draw();
|
||||
g_scroll_dy = 0.f;
|
||||
@@ -1430,6 +1431,39 @@ int main(void) {
|
||||
stop();
|
||||
}
|
||||
|
||||
/* 31. Modo compacto (celular em retrato): menu com "☰", alternador
|
||||
* Código|Palco, paleta em gaveta que abre pela categoria */
|
||||
{
|
||||
g_win_w = 400; g_win_h = 800;
|
||||
frame(0, 0, 0, 0, 0, 0, NULL);
|
||||
frame(0, 0, 0, 0, 0, 0, NULL);
|
||||
int menu = ax_in(0, TB_A11Y_TOOLBAR, "Menu");
|
||||
CHECK(ax_in(menu, TB_A11Y_BUTTON, "Mais opções") >= 0, "compacto: botão ☰ no menu");
|
||||
CHECK(ax_in(menu, TB_A11Y_BUTTON, "Bibliotecas") < 0, "compacto: Bibliotecas sai da barra");
|
||||
CHECK(pane("Palco") < 0 && pane("Scripts") >= 0, "compacto: só os scripts (sem palco ao lado)");
|
||||
ax_do(ax_need(menu, TB_A11Y_BUTTON, "Mais opções"), TB_A11Y_ACT_ACTIVATE);
|
||||
frame(0, 0, 0, 0, 0, 0, NULL);
|
||||
CHECK(ax_in(ax_in(0, TB_A11Y_MENU, NULL), TB_A11Y_MENU_ITEM, "Bibliotecas") >= 0,
|
||||
"compacto: Bibliotecas no menu ☰");
|
||||
frame(200, 400, 1, 0, 0, 0, NULL); /* clicar fora fecha o menu */
|
||||
frame(200, 400, 0, 1, 0, 0, NULL);
|
||||
CHECK(ax_in(0, TB_A11Y_MENU, NULL) < 0, "compacto: clicar fora fecha o ☰");
|
||||
CHECK(pal() < 0, "compacto: gaveta da paleta começa fechada");
|
||||
cat("Controle");
|
||||
frame(0, 0, 0, 0, 0, 0, NULL);
|
||||
CHECK(pal() >= 0, "compacto: tocar na categoria abre a gaveta");
|
||||
int before = ws_count("sempre");
|
||||
ax_drop_at(pal_block("Controle", "sempre"), ws(), 200, 500);
|
||||
frame(0, 0, 0, 0, 0, 0, NULL);
|
||||
CHECK(ws_count("sempre") == before + 1 && pal() < 0, "compacto: tirar bloco da gaveta fecha a gaveta");
|
||||
ax_do(ax_need(ax_in(0, TB_A11Y_TOOLBAR, "Menu"), TB_A11Y_TAB, "Palco"), TB_A11Y_ACT_ACTIVATE);
|
||||
frame(0, 0, 0, 0, 0, 0, NULL);
|
||||
CHECK(pane("Palco") >= 0 && pane("Saída") >= 0 && pane("Scripts") < 0, "compacto: aba Palco mostra palco e saída");
|
||||
g_win_w = 1280; g_win_h = 720;
|
||||
frame(0, 0, 0, 0, 0, 0, NULL);
|
||||
CHECK(pane("Palco") >= 0 && pane("Scripts") >= 0 && pane("Blocos") >= 0, "janela larga volta ao layout de áreas");
|
||||
}
|
||||
|
||||
tinyblocks_deinit(&rt);
|
||||
printf(fails ? "\n%d FALHA(S)\n" : "\nTUDO OK\n", fails);
|
||||
return fails != 0;
|
||||
|
||||
Reference in new issue
Block a user