Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modify plot resizing script #248

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions R/plot_with_settings.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,18 @@ plot_with_settings_ui <- function(id) {
tags$script(
# nolint start
sprintf(
'$(document).on("shiny:connected", function(e) {
'
var resize_callback = function(e) {
Shiny.onInputChange("%s", document.getElementById("%s").clientWidth);
Shiny.onInputChange("%s", 0.87*window.innerWidth);
//based on modal CSS property, also accounting for margins
});
$(window).resize(function(e) {
Shiny.onInputChange("%s", document.getElementById("%s").clientWidth);
Shiny.onInputChange("%s", 0.87*window.innerWidth);
//based on modal CSS property, also accounting for margins
});',
};
$(document).on("shiny:connected.tealWidgets", resize_callback);
$(window).on("resize.tealWidgets", resize_callback);
',
# nolint end
ns("flex_width"), # session input$ variable name
ns("plot_out_main"), # graph parent id
ns("plot_modal_width"), # session input$ variable name
ns("flex_width"), # session input$ variable name
ns("plot_out_main"), # graph parent id
ns("plot_modal_width") # session input$ variable name
)
)
Expand Down
Loading