From 29139a16158e4ab7815dacabbd6ecbd57ce787b1 Mon Sep 17 00:00:00 2001 From: Ryan May Date: Mon, 5 Oct 2020 14:17:15 -0600 Subject: [PATCH] Backport PR #18639: nbagg: Don't close figures for bubbled events. --- lib/matplotlib/backends/web_backend/js/nbagg_mpl.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/backends/web_backend/js/nbagg_mpl.js b/lib/matplotlib/backends/web_backend/js/nbagg_mpl.js index 0f538979d19d..688e1953ebe1 100644 --- a/lib/matplotlib/backends/web_backend/js/nbagg_mpl.js +++ b/lib/matplotlib/backends/web_backend/js/nbagg_mpl.js @@ -48,7 +48,7 @@ mpl.mpl_figure_comm = function (comm, msg) { console.error('Failed to find cell for figure', id, fig); return; } - fig.cell_info[0].output_area.element.one( + fig.cell_info[0].output_area.element.on( 'cleared', { fig: fig }, fig._remove_fig_handler @@ -181,6 +181,10 @@ mpl.figure.prototype._init_toolbar = function () { mpl.figure.prototype._remove_fig_handler = function (event) { var fig = event.data.fig; + if (event.target !== this) { + // Ignore bubbled events from children. + return; + } fig.close_ws(fig, {}); }; pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy