1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-12 02:00:58 +01:00

Comments, minor tweaks to ImGuiTextFilter.

This commit is contained in:
ocornut 2024-07-29 22:34:34 +02:00
parent df38704926
commit c2a3d5e47b
2 changed files with 11 additions and 8 deletions

View File

@ -50,10 +50,11 @@ Breaking changes:
You should never need those functions! You can do everything in less a confusing manner by only You should never need those functions! You can do everything in less a confusing manner by only
using GetCursorScreenPos() and GetContentRegionAvail(). Also always consider that if you are using using GetCursorScreenPos() and GetContentRegionAvail(). Also always consider that if you are using
GetWindowPos() and GetCursorPos() you may also be making things unnecessarily complicated. GetWindowPos() and GetCursorPos() you may also be making things unnecessarily complicated.
I repeat: You can do everything with GetCursorScreenPos() and GetContentRegionAvail()!! I repeat: You can do everything with GetCursorScreenPos() and GetContentRegionAvail()!
- GetWindowContentRegionMax().x - GetCursorPos().x --> GetContentRegionAvail().x - GetWindowContentRegionMax().x - GetCursorPos().x --> GetContentRegionAvail().x
- GetWindowContentRegionMax().x + GetWindowPos().x --> GetCursorScreenPos().x + GetContentRegionAvail().x - GetWindowContentRegionMax().x + GetWindowPos().x --> GetCursorScreenPos().x + GetContentRegionAvail().x // when called from left edge of window
- GetContentRegionMax() --> GetContentRegionAvail() + GetCursorScreenPos() - GetWindowPos() // right edge in weird local coordinates - GetContentRegionMax() --> GetContentRegionAvail() + GetCursorScreenPos() - GetWindowPos() // right edge in local coordinates
- GetWindowContentRegionMax().x - GetWindowContentRegionMin().x --> GetContentRegionAvail() // when called from left edge of window
- Item flag changes: - Item flag changes:
- Obsoleted PushButtonRepeat()/PopButtonRepeat() in favor of using new PushItemFlag()/PopItemFlag() - Obsoleted PushButtonRepeat()/PopButtonRepeat() in favor of using new PushItemFlag()/PopItemFlag()
with ImGuiItemFlags_ButtonRepeat. Kept inline redirecting functions (will obsolete). with ImGuiItemFlags_ButtonRepeat. Kept inline redirecting functions (will obsolete).

View File

@ -435,9 +435,11 @@ CODE
- instead of: GetWindowContentRegionMax().x - GetCursorPos().x - instead of: GetWindowContentRegionMax().x - GetCursorPos().x
- you can use: GetContentRegionAvail().x - you can use: GetContentRegionAvail().x
- instead of: GetWindowContentRegionMax().x + GetWindowPos().x - instead of: GetWindowContentRegionMax().x + GetWindowPos().x
- you can use: GetCursorScreenPos().x + GetContentRegionAvail().x (from left edge of window) - you can use: GetCursorScreenPos().x + GetContentRegionAvail().x // when called from left edge of window
- instead of: GetContentRegionMax() - instead of: GetContentRegionMax()
- you cna use: GetContentRegionAvail() + GetCursorScreenPos() - GetWindowPos() // right edge in weird local coordinates - you can use: GetContentRegionAvail() + GetCursorScreenPos() - GetWindowPos() // right edge in local coordinates
- instead of: GetWindowContentRegionMax().x - GetWindowContentRegionMin().x
- you can use: GetContentRegionAvail() // when called from left edge of window
- 2024/07/15 (1.91.0) - renamed ImGuiSelectableFlags_DontClosePopups to ImGuiSelectableFlags_NoAutoClosePopups. (#1379, #1468, #2200, #4936, #5216, #7302, #7573) - 2024/07/15 (1.91.0) - renamed ImGuiSelectableFlags_DontClosePopups to ImGuiSelectableFlags_NoAutoClosePopups. (#1379, #1468, #2200, #4936, #5216, #7302, #7573)
(internals: also renamed ImGuiItemFlags_SelectableDontClosePopup into ImGuiItemFlags_AutoClosePopups with inverted behaviors) (internals: also renamed ImGuiItemFlags_SelectableDontClosePopup into ImGuiItemFlags_AutoClosePopups with inverted behaviors)
- 2024/07/15 (1.91.0) - obsoleted PushButtonRepeat()/PopButtonRepeat() in favor of using new PushItemFlag(ImGuiItemFlags_ButtonRepeat, ...)/PopItemFlag(). - 2024/07/15 (1.91.0) - obsoleted PushButtonRepeat()/PopButtonRepeat() in favor of using new PushItemFlag(ImGuiItemFlags_ButtonRepeat, ...)/PopItemFlag().
@ -2753,11 +2755,11 @@ bool ImGuiTextFilter::PassFilter(const char* text, const char* text_end) const
return true; return true;
if (text == NULL) if (text == NULL)
text = ""; text = text_end = "";
for (const ImGuiTextRange& f : Filters) for (const ImGuiTextRange& f : Filters)
{ {
if (f.empty()) if (f.b == f.e)
continue; continue;
if (f.b[0] == '-') if (f.b[0] == '-')
{ {