From 838e132515035b3ad6cf1131bf312d793445f395 Mon Sep 17 00:00:00 2001 From: Yihui Xie Date: Mon, 31 Aug 2015 17:07:11 -0500 Subject: [PATCH] Trigger shiny:visualchange in doSendOutputHiddenState() as well. Added a 'visible' property to the event object. --- srcjs/init_shiny.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/srcjs/init_shiny.js b/srcjs/init_shiny.js index c988558833..f3656592d1 100644 --- a/srcjs/init_shiny.js +++ b/srcjs/init_shiny.js @@ -256,6 +256,7 @@ function initShiny() { var $this = $(this), binding = $this.data('shiny-output-binding'); $this.trigger({ type: 'shiny:visualchange', + visible: !isHidden(this), binding: binding }); binding.onResize(); @@ -301,12 +302,19 @@ function initShiny() { $('.shiny-bound-output').each(function() { delete lastKnownVisibleOutputs[this.id]; // Assume that the object is hidden when width and height are 0 - if (isHidden(this)) { + var hidden = isHidden(this), evt = { + type: 'shiny:visualchange', + visible: !hidden + }; + if (hidden) { inputs.setInput('.clientdata_output_' + this.id + '_hidden', true); } else { visibleOutputs[this.id] = true; inputs.setInput('.clientdata_output_' + this.id + '_hidden', false); } + var $this = $(this); + evt.binding = $this.data('shiny-output-binding'); + $this.trigger(evt); }); // Anything left in lastKnownVisibleOutputs is orphaned for (var name in lastKnownVisibleOutputs) {