Skip to content

The diffrOutput() width parameter is not able to use 100% of the available width #6

@nhward

Description

@nhward

The shiny widget that wraps the diffr comparator is excellent. A fine piece of work that is much appreciated. :)

Sadly the width parameter (of diffrOutput) does not allow the widget to be drawn within more than 50% of the available width. Using larger values does bring a horizontal slider into play which suggests that the widget is indeed the size it is asked to be. However the widget is always drawn on the first 50% of available width.

Changing the font size of the browser does improve things. However, it should do as it claims at 100% zoom.

Reprex below:

library(shiny)
library(diffr)
library(dplyr)

ui <- fluidPage(
   diffr::diffrOutput(outputId = "Iris", width = "400%") ## here I am using 400% but only 50% is used for the widget display
)

server <- function(input, output) {

  output$Iris <- diffr::renderDiffr({
    data(iris)
    f1 <- tempfile()
    f2 <- tempfile()
    capture.output(
      dplyr::glimpse(iris, width = 120),
      file = f1
    )
    capture.output(
      dplyr::glimpse(rev(iris), width = 120),
      file = f2
    )
    diffr::diffr(f1, f2, wordWrap = TRUE)
  })
}

# Run the application
shinyApp(ui = ui, server = server)

While this Reprex is using the browser size, my actual use-case involves bslib::cards that switch between card and full screen. The lack of genuine full screen sizing (at 100%) is problematic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions