|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- #pragma once
- #include "widgets/Widget.hpp"
-
-
- namespace rack {
-
-
- struct ZoomWidget : Widget {
- float zoom = 1.f;
-
- math::Vec getRelativeOffset(math::Vec v, Widget *relative) override;
- math::Rect getViewport(math::Rect r) override;
- void setZoom(float zoom);
- void draw(const DrawContext &ctx) override;
-
- void onHover(const event::Hover &e) override {
- event::Hover e2 = e;
- e2.pos = e.pos.div(zoom);
- Widget::onHover(e2);
- }
- void onButton(const event::Button &e) override {
- event::Button e2 = e;
- e2.pos = e.pos.div(zoom);
- Widget::onButton(e2);
- }
- void onHoverKey(const event::HoverKey &e) override {
- event::HoverKey e2 = e;
- e2.pos = e.pos.div(zoom);
- Widget::onHoverKey(e2);
- }
- void onHoverText(const event::HoverText &e) override {
- event::HoverText e2 = e;
- e2.pos = e.pos.div(zoom);
- Widget::onHoverText(e2);
- }
- void onHoverScroll(const event::HoverScroll &e) override {
- event::HoverScroll e2 = e;
- e2.pos = e.pos.div(zoom);
- Widget::onHoverScroll(e2);
- }
- void onDragHover(const event::DragHover &e) override {
- event::DragHover e2 = e;
- e2.pos = e.pos.div(zoom);
- Widget::onDragHover(e2);
- }
- void onPathDrop(const event::PathDrop &e) override {
- event::PathDrop e2 = e;
- e2.pos = e.pos.div(zoom);
- Widget::onPathDrop(e2);
- }
- };
-
-
- } // namespace rack
|