editor: roda do mouse da zoom na aba de imagem e nao pinta mais

- Aba de imagem: roda do mouse = zoom centrado no ponteiro (como no Krita),
  com deslocamento (pan) para nao perder o ponto de referencia; com zoom <=
  100% a pagina volta ao centro. O scroll nao pinta nem move blocos.
- tinyblocks-editor-image exporta tb_editor_image_zoom e a tabela da API
  (tb_ed_img.zoom) faz a ponte, entao o editor so chama por ponteiro.
- Removida a barra cinza decorativa no fim da tela (parecia uma barra de
  rolagem falsa).
- harness: scroll() e testes 'roda do mouse aproxima/afasta/nao pinta'.
This commit is contained in:
mguinhos committed 2026-10-20 23:41:19 -03:00
1 parent 0143d3efd5
commit 2b6bc65062
7 files changed
+77 -7

No files matched your search

@@ -4332,6 +4332,9 @@ static void editor_eval(TinyBlocks_Block* self, TinyBlocks* rt) {
} else if (CT.kind == TK_CODE && mx >= WS_X && mx < WIN_W - STAGE_W && my >= WS_Y) {
CT.code_scroll -= (int)sdy * 3;
if (CT.code_scroll < 0) CT.code_scroll = 0;
} else if (CT.kind == TK_IMAGE && mx >= WS_X && mx < WIN_W - STAGE_W && my >= WS_Y) {
/* roda do mouse na aba de imagem = zoom no cursor (nao pinta) */
image_zoom(ed, mx, my, (int)(sdy > 0 ? 1 : sdy < 0 ? -1 : 0));
} else if (mx >= WS_X && mx < WIN_W - STAGE_W && my >= WS_Y) {
CT.ws_sx -= (float)sdx * 40.f;
CT.ws_sy -= (float)sdy * 40.f;
@@ -131,8 +131,9 @@ static bool resolve_image(void) {
sym_fn(&a.ensure, "tinyblocks-editor-image", "tb_editor_image_ensure");
sym_fn(&a.sel_reset, "tinyblocks-editor-image", "tb_editor_image_sel_reset");
sym_fn(&a.sel_commit, "tinyblocks-editor-image", "tb_editor_image_sel_commit");
sym_fn(&a.zoom, "tinyblocks-editor-image", "tb_editor_image_zoom");
bool ok = a.view && a.click && a.drag && a.release && a.load_file && a.save &&
a.ensure && a.sel_reset && a.sel_commit;
a.ensure && a.sel_reset && a.sel_commit && a.zoom;
if (ok) tb_ed_img = a;
return ok;
}