MCPcopy Create free account
hub / github.com/VCVRack/Rack / drawLayer

Method drawLayer

src/app/ModuleWidget.cpp:290–306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

288}
289
290void ModuleWidget::drawLayer(const DrawArgs& args, int layer) {
291 if (layer == -1) {
292 nvgBeginPath(args.vg);
293 float r = 20; // Blur radius
294 float c = 20; // Corner radius
295 math::Rect shadowBox = box.zeroPos().grow(math::Vec(10, -30));
296 math::Rect shadowOutsideBox = shadowBox.grow(math::Vec(r, r));
297 nvgRect(args.vg, RECT_ARGS(shadowOutsideBox));
298 NVGcolor shadowColor = nvgRGBAf(0, 0, 0, 0.2);
299 NVGcolor transparentColor = nvgRGBAf(0, 0, 0, 0);
300 nvgFillPaint(args.vg, nvgBoxGradient(args.vg, RECT_ARGS(shadowBox), c, r, shadowColor, transparentColor));
301 nvgFill(args.vg);
302 }
303 else {
304 Widget::drawLayer(args, layer);
305 }
306}
307
308void ModuleWidget::onHover(const HoverEvent& e) {
309 if (APP->scene->rack->isSelected(this)) {

Callers

nothing calls this directly

Calls 3

VecClass · 0.85
growMethod · 0.80
zeroPosMethod · 0.80

Tested by

no test coverage detected