mikke89 / RmlUi

RmlUi - The HTML/CSS User Interface library evolved
https://mikke89.github.io/RmlUiDoc/
MIT License
2.73k stars 298 forks source link

Document window failed to auto scale after moving #637

Open AdjWang opened 1 month ago

AdjWang commented 1 month ago

The issue

The demo program rmlui_sample_demo.exe shows a responsive document window auto scaling with the main window. The auto scaling would not work if drag and move it somewhere.

How to reproduce

vcpkg install freetype glfw3
git clone https://github.com/mikke89/RmlUi.git
cd RmlUi
cmake -B Build -S . --preset samples -DRMLUI_BACKEND=GLFW_GL3 -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake"
cmake --build Build
git log -1
commit 51af29b1b34c3d8c6b1790385e6584f004cfe3a9 (HEAD -> master, origin/master, origin/HEAD)
Author: Michael Ragazzon <michael.ragazzon@gmail.com>
Date:   Sun Jul 14 18:24:36 2024 +0200

    Defer scroll offset clamping to after layout, fixes #452
mikke89 commented 1 month ago

Ah yes, this is really just how the handle element currently behaves, but I understand it might not be what one expects. When moving an element, the handle fixes the target's size, so that it doesn't accidentally resize it too. Hm, we could perhaps be smarter about how we do this though. Maybe it's fine to keep the right and bottom properties, but just adjust them accordingly so it doesn't change in size. I'll tinker a bit on it.

AdjWang commented 1 month ago

Ok, thanks for consideration. I think maybe separate them in different way? Like in web, an out-of-flow window uses absolute position and sets left, top, right and bottom to move and scale; an in-flow window uses margin in px and width and height in percent to move and scale. The out-of-flow window never scale with the outer container while the in-flow one does.