diff options
| author | Loic Guegan <manzerbredes@mailbox.org> | 2022-12-31 11:47:56 +0100 |
|---|---|---|
| committer | Loic Guegan <manzerbredes@mailbox.org> | 2022-12-31 11:47:56 +0100 |
| commit | 144a3ddfb55fbf17cec4baaa73542664d68a3b05 (patch) | |
| tree | 43add38a2cd05d52349a6561bd4d9ed8df94f862 /src/CGEditor.cpp | |
| parent | 2bb6730df8094c89af5a07d394fc02c43aea24eb (diff) | |
Debug comments$
Diffstat (limited to 'src/CGEditor.cpp')
| -rw-r--r-- | src/CGEditor.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/CGEditor.cpp b/src/CGEditor.cpp index 1d5eaea..4edf95e 100644 --- a/src/CGEditor.cpp +++ b/src/CGEditor.cpp @@ -1,5 +1,5 @@ #include "CGEditor.hpp" - +#include <iostream> namespace cgeditor { CGEditor::CGEditor() { @@ -77,18 +77,19 @@ void CGEditor::CallDrawElement(Element e) { e.y += status.ScrollY; } } - DrawElement(e); -return; - // Check if element is visible - if (((e.x) >= 0 && ((e.x) <= status.CanvasWidth) && (e.y) >= 0 && - ((e.y) <= status.CanvasHeight)) || - ((e.x + e.width) >= 0 && ((e.x + e.width) <= status.CanvasWidth) && - (e.y + e.height) >= 0 && ((e.y + e.height) <= status.CanvasHeight))) { - if (e.IsOver(status.MouseX, status.MouseY)) { - e.prop |= Property::Mouseover; - } - DrawElement(e); + + // Check if element visible if not just leave + if((e.x+e.width)<0 || status.CanvasWidth < e.x) + return; + if((e.y+e.height)<0 || status.CanvasHeight < e.y) + return; + + // Check if mouse over + if (e.IsOver(status.MouseX, status.MouseY)) { + e.prop |= Property::Mouseover; } + + DrawElement(e); } void CGEditor::DrawComponent(Component *c) { |
