@@ -48,6 +48,12 @@ struct TransformWidget : Widget { | |||||
nvgTransform(args.vg, transform[0], transform[1], transform[2], transform[3], transform[4], transform[5]); | nvgTransform(args.vg, transform[0], transform[1], transform[2], transform[3], transform[4], transform[5]); | ||||
Widget::draw(args); | Widget::draw(args); | ||||
} | } | ||||
void drawLayer(const DrawArgs& args, int layer) override { | |||||
// No need to save the state because that is done in the parent | |||||
nvgTransform(args.vg, transform[0], transform[1], transform[2], transform[3], transform[4], transform[5]); | |||||
Widget::drawLayer(args, layer); | |||||
} | |||||
}; | }; | ||||
@@ -18,6 +18,7 @@ struct ZoomWidget : Widget { | |||||
return zoom; | return zoom; | ||||
} | } | ||||
void draw(const DrawArgs& args) override; | void draw(const DrawArgs& args) override; | ||||
void drawLayer(const DrawArgs& args, int layer) override; | |||||
void onHover(const HoverEvent& e) override { | void onHover(const HoverEvent& e) override { | ||||
HoverEvent e2 = e; | HoverEvent e2 = e; | ||||
@@ -50,5 +50,15 @@ void ZoomWidget::draw(const DrawArgs& args) { | |||||
} | } | ||||
void ZoomWidget::drawLayer(const DrawArgs& args, int layer) { | |||||
DrawArgs zoomCtx = args; | |||||
zoomCtx.clipBox.pos = zoomCtx.clipBox.pos.div(zoom); | |||||
zoomCtx.clipBox.size = zoomCtx.clipBox.size.div(zoom); | |||||
// No need to save the state because that is done in the parent | |||||
nvgScale(args.vg, zoom, zoom); | |||||
Widget::drawLayer(zoomCtx, layer); | |||||
} | |||||
} // namespace widget | } // namespace widget | ||||
} // namespace rack | } // namespace rack |