@@ -1,5 +1,6 @@ | |||||
#pragma once | #pragma once | ||||
#include "ui/common.hpp" | #include "ui/common.hpp" | ||||
#include "ui/QuantityWidget.hpp" | |||||
#include "ui/SequentialLayout.hpp" | #include "ui/SequentialLayout.hpp" | ||||
#include "ui/Label.hpp" | #include "ui/Label.hpp" | ||||
#include "ui/List.hpp" | #include "ui/List.hpp" | ||||
@@ -1,5 +1,6 @@ | |||||
#pragma once | #pragma once | ||||
#include "ui/common.hpp" | #include "ui/common.hpp" | ||||
#include "ui/QuantityWidget.hpp" | |||||
namespace rack { | namespace rack { | ||||
@@ -1,5 +1,5 @@ | |||||
#pragma once | #pragma once | ||||
#include "widgets/Widget.hpp" | |||||
#include "ui/common.hpp" | |||||
namespace rack { | namespace rack { |
@@ -1,5 +1,6 @@ | |||||
#pragma once | #pragma once | ||||
#include "ui/common.hpp" | #include "ui/common.hpp" | ||||
#include "ui/QuantityWidget.hpp" | |||||
namespace rack { | namespace rack { | ||||
@@ -1,5 +1,6 @@ | |||||
#pragma once | #pragma once | ||||
#include "ui/common.hpp" | #include "ui/common.hpp" | ||||
#include "ui/QuantityWidget.hpp" | |||||
namespace rack { | namespace rack { | ||||
@@ -6,4 +6,3 @@ | |||||
#include "widgets/ZoomWidget.hpp" | #include "widgets/ZoomWidget.hpp" | ||||
#include "widgets/SVGWidget.hpp" | #include "widgets/SVGWidget.hpp" | ||||
#include "widgets/FramebufferWidget.hpp" | #include "widgets/FramebufferWidget.hpp" | ||||
#include "widgets/QuantityWidget.hpp" |
@@ -13,6 +13,7 @@ struct TransparentWidget : virtual Widget { | |||||
void onHoverKey(event::HoverKey &e) override {} | void onHoverKey(event::HoverKey &e) override {} | ||||
void onHoverText(event::HoverText &e) override {} | void onHoverText(event::HoverText &e) override {} | ||||
void onHoverScroll(event::HoverScroll &e) override {} | void onHoverScroll(event::HoverScroll &e) override {} | ||||
void onDragHover(event::DragHover &e) override {} | |||||
void onPathDrop(event::PathDrop &e) override {} | void onPathDrop(event::PathDrop &e) override {} | ||||
}; | }; | ||||
@@ -40,31 +40,31 @@ struct ZoomWidget : virtual Widget { | |||||
e2.pos = e.pos.div(zoom); | e2.pos = e.pos.div(zoom); | ||||
Widget::onHover(e2); | Widget::onHover(e2); | ||||
} | } | ||||
void onButton(event::Button &e) override { | void onButton(event::Button &e) override { | ||||
event::Button e2 = e; | event::Button e2 = e; | ||||
e2.pos = e.pos.div(zoom); | e2.pos = e.pos.div(zoom); | ||||
Widget::onButton(e2); | Widget::onButton(e2); | ||||
} | } | ||||
void onHoverKey(event::HoverKey &e) override { | void onHoverKey(event::HoverKey &e) override { | ||||
event::HoverKey e2 = e; | event::HoverKey e2 = e; | ||||
e2.pos = e.pos.div(zoom); | e2.pos = e.pos.div(zoom); | ||||
Widget::onHoverKey(e2); | Widget::onHoverKey(e2); | ||||
} | } | ||||
void onHoverText(event::HoverText &e) override { | void onHoverText(event::HoverText &e) override { | ||||
event::HoverText e2 = e; | event::HoverText e2 = e; | ||||
e2.pos = e.pos.div(zoom); | e2.pos = e.pos.div(zoom); | ||||
Widget::onHoverText(e2); | Widget::onHoverText(e2); | ||||
} | } | ||||
void onHoverScroll(event::HoverScroll &e) override { | void onHoverScroll(event::HoverScroll &e) override { | ||||
event::HoverScroll e2 = e; | event::HoverScroll e2 = e; | ||||
e2.pos = e.pos.div(zoom); | e2.pos = e.pos.div(zoom); | ||||
Widget::onHoverScroll(e2); | Widget::onHoverScroll(e2); | ||||
} | } | ||||
void onDragHover(event::DragHover &e) override { | |||||
event::DragHover e2 = e; | |||||
e2.pos = e.pos.div(zoom); | |||||
Widget::onDragHover(e2); | |||||
} | |||||
void onPathDrop(event::PathDrop &e) override { | void onPathDrop(event::PathDrop &e) override { | ||||
event::PathDrop e2 = e; | event::PathDrop e2 = e; | ||||
e2.pos = e.pos.div(zoom); | e2.pos = e.pos.div(zoom); | ||||
@@ -89,8 +89,13 @@ void Widget::step() { | |||||
void Widget::draw(NVGcontext *vg) { | void Widget::draw(NVGcontext *vg) { | ||||
for (Widget *child : children) { | for (Widget *child : children) { | ||||
// Don't draw if invisible | |||||
if (!child->visible) | if (!child->visible) | ||||
continue; | continue; | ||||
// Don't draw if child is outside bounding box | |||||
if (!box.zeroPos().intersects(child->box)) | |||||
continue; | |||||
nvgSave(vg); | nvgSave(vg); | ||||
nvgTranslate(vg, child->box.pos.x, child->box.pos.y); | nvgTranslate(vg, child->box.pos.x, child->box.pos.y); | ||||
child->draw(vg); | child->draw(vg); | ||||