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

imageOutput coordinate interaction bug #170

Open
rmcminds opened this issue Aug 15, 2024 · 1 comment
Open

imageOutput coordinate interaction bug #170

rmcminds opened this issue Aug 15, 2024 · 1 comment

Comments

@rmcminds
Copy link

Hello - I have an app that uses imageOutput with options 'click' and 'brush' to retrieve coordinates from a photo. The app works great when run directly from R, but once I export it with shinylive, the interactivity with the photo disappears. Not only do the input values not seem to update, the visual box that is normally created when clicking and dragging does not appear in the shinylive version.

Interestingly, the cursor does seem to have the expected '+' shape on initial load, but goes back to the standard arrow once it is moved.

Simple example:

library(shiny)

ui <- fluidPage(

  sidebarLayout(
    
    mainPanel(
      
      imageOutput("current_photo",
                  click = "photo_click",
                  brush = "photo_brush"
      )
      
    ),
    
    sidebarPanel(
      
      verbatimTextOutput("info")
      
    )
  )
)

server <- function(input, output, session) {
  
  output$current_photo <- renderImage({
  
    list(src = 'photo_1_fish.jpg',
         width = '100%')
    
  }, deleteFile = FALSE)
    
  output$info <- renderText({
    
    paste0(
      "click-x: ", input$photo_click$x, '\n',
      "brush-xmin: ", input$photo_brush$xmin
    )
    
  })
}

shinyApp(ui, server)

#shinylive::export("~/test",  "~/ex_coord")
@rmcminds
Copy link
Author

rmcminds commented Sep 19, 2024

Hello, checking in on this to see if anyone has thoughts on this issue. I haven't had any success tracking the issue down with the developer tools in Chrome, except finding an inherited 'clip' value for the photo containers which seems to be different for shinylive compared to runApp(). I'm able to change that with CSS and register that clicks happen anywhere in the photo, but the click coordinates are still not saved unless they occur in a small box in the upper left corner.

If anything else is needed to reproduce the issue, I'm happy to provide it. I have the buggy shinylive app hosted at https://thecnidaegritty.org/photo_annotator/ and the working source code at
https://github.com/McMinds-Lab/USF_Library_Ogden_Collection_resources/tree/main/shiny_annotation

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant