From 144a3ddfb55fbf17cec4baaa73542664d68a3b05 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Sat, 31 Dec 2022 11:47:56 +0100 Subject: Debug comments$ --- src/CGEditor.cpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'src/CGEditor.cpp') 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 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) { -- cgit v1.2.3