Skip to content

Commit

Permalink
Use modals instead of javascript alerts
Browse files Browse the repository at this point in the history
  • Loading branch information
erichare committed Dec 16, 2024
1 parent e91cce1 commit aa7b5b7
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions app/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,12 @@ server <- function(input, output, session) {
hinfo <- bull$x3p[[1]]$header.info
if (hinfo$sizeX < hinfo$sizeY) {
if (values$show_alert) {
alert("Detected rotated bullet, rotating 90 degrees...")
showModal(modalDialog(
title = "Rotated Bullet",
"Detected rotated bullet, rotating 90 degrees...",
easyClose = TRUE,
footer = modalButton("OK")
))
}
values$show_alert <- FALSE
bull$x3p <- lapply(bull$x3p, x3p_rotate, angle = 90)
Expand All @@ -166,15 +171,25 @@ server <- function(input, output, session) {
# Down-sample if necessary
if (reference_resolution > current_resolution) {
if (values$show_alert) {
alert("Detected higher resolution bullet, down-sampling...")
showModal(modalDialog(
title = "Higher Resolution Bullet",
"Detected higher resolution bullet, down-sampling...",
easyClose = TRUE,
footer = modalButton("OK")
))
}
values$show_alert <- FALSE
m <- round(reference_resolution / current_resolution)

bull$x3p <- lapply(bull$x3p, x3p_sample, m = m)
} else if (reference_resolution < current_resolution) {
if (values$show_alert) {
alert("Detected lower resolution bullet, down-sampling previous bullets...")
showModal(modalDialog(
title = "Lower Resolution Bullet",
"Detected lower resolution bullet, down-sampling previous bullets...",
easyClose = TRUE,
footer = modalButton("OK")
))
}
values$show_alert <- FALSE

Expand Down

0 comments on commit aa7b5b7

Please sign in to comment.