[#364] fixed draw of shapes when debug mode is enabled
[#364] made the implementation more generic

still one but to squash linked to mouse over detection (for later today)