Nelarius / imnodes

A small, dependency-free node editor for dear imgui
MIT License
1.97k stars 241 forks source link

Fix editor.GridContentBounds #142

Closed JulesFouchy closed 2 years ago

JulesFouchy commented 2 years ago

This pull request fixes a bug where the bounds of the minimap are not calculated correctly because editor.GridContentBounds.Max isn't actually initialized with the smallest float possible. FLT_MIN is the smallest positive float (a.k.a. the one that is closest to zero); what we actually need is -FLT_MAX.

How to reproduce the bug:

Create a node and drag it up: the minimap will start to show a lot of empty space below the node: image

With this pull request:

The exact same node layout gives this minimap, which is centered on the node as expected: image

Nelarius commented 2 years ago

Thanks @JulesFouchy for the clear description and fix! 👍