File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -288,8 +288,6 @@ void mb_shell::menu_widget::update(ui::update_context &ctx) {
288288 }
289289}
290290void mb_shell::menu_widget::render (ui::nanovg_context ctx) {
291- render_children (ctx, rendering_submenus);
292-
293291 std::lock_guard lock (data_lock);
294292 if (bg) {
295293 bg->render (ctx);
@@ -298,7 +296,16 @@ void mb_shell::menu_widget::render(ui::nanovg_context ctx) {
298296 if (bg_submenu) {
299297 bg_submenu->render (ctx);
300298 }
299+
300+ ctx.transaction ([&]() {
301+ ctx.globalCompositeOperation (NVG_COPY);
302+ auto c = menu_render::current.value ()->light_color ? 1 : 0 ;
303+ ctx.fillColor (nvgRGBAf (c, c, c, 0.3 ));
304+ ctx.fillRect (*x, *y, *width, *height);
305+ });
301306 super::render (ctx);
307+
308+ render_children (ctx, rendering_submenus);
302309}
303310void mb_shell::menu_item_widget::reset_appear_animation (float delay) {
304311 this ->opacity ->after_animate = [this ](float dest) {
Original file line number Diff line number Diff line change @@ -167,6 +167,15 @@ inline auto debugDumpPathCache() { return nvgDebugDumpPathCache(ctx); }
167167 return copy;
168168 }
169169
170+
171+ struct TransactionScope {
172+ nanovg_context &ctx;
173+ TransactionScope (nanovg_context &ctx) : ctx(ctx) { ctx.save (); }
174+ ~TransactionScope () { ctx.restore (); }
175+ };
176+
177+ inline TransactionScope transaction () { return TransactionScope (*this ); }
178+
170179 inline void transaction (std::function<void ()> f) {
171180 save ();
172181 f ();
You can’t perform that action at this time.
0 commit comments