@@ -78,6 +78,7 @@ render_session_info <- function(session) {
7878
7979
8080server <- function (input , output , session ) {
81+ values <- reactiveValues(show_alert = TRUE )
8182 # ################################################################################
8283 # # Report versions of packages used
8384 # ################################################################################
@@ -121,27 +122,39 @@ server <- function(input, output, session) {
121122 # ################################################################################
122123 # # Preview Bullets while Uploading Bullet lands
123124 # ################################################################################
125+
126+ observeEvent(input $ bul_x3p , {
127+ values $ show_alert <- TRUE
128+ })
129+
130+ uploaded_bull <- reactive({
131+ temp_refresh <- input $ prevreport
132+
133+ # Create Temporary Directory and save bullets in it
134+ temp_dir <- tempfile()
135+ dir.create(temp_dir )
136+ file.copy(input $ bul_x3p $ datapath , paste0(temp_dir , " /" , input $ bul_x3p $ name ))
137+
138+ return (read_bullet(temp_dir ))
139+ })
140+
124141 output $ lpupload <- renderUI({
125142 if (is.null(input $ bul_x3p )) return (NULL )
126143 disable(" up_bull" )
127144 progress <- shiny :: Progress $ new();on.exit(progress $ close())
128145
129- # # Refresh on Tab Change
130- temp_refresh <- input $ prevreport
131-
132- # Create Temporary Directory and save bullets in it
133- temp_dir <- tempfile()
134- dir.create(temp_dir )
135- file.copy(input $ bul_x3p $ datapath , paste0(temp_dir , " /" , input $ bul_x3p $ name ))
136146 # # Read Bullet
137147 progress $ set(message = " Reading Bullets" , value = .25 )
138- bull <- read_bullet( temp_dir )
148+ bull <- uploaded_bull( )
139149
140150 # Check if we need to rotate the bullet
141151 hinfo <- bull $ x3p [[1 ]]$ header.info
142152 if (hinfo $ sizeX < hinfo $ sizeY ) {
143- alert(" Detected rotated bullet, rotating 90 degrees..." )
144- bull $ x3p <- lapply(bull $ x3p , x3p_rotate , angle = - 90 )
153+ if (values $ show_alert ) {
154+ alert(" Detected rotated bullet, rotating 90 degrees..." )
155+ }
156+ values $ show_alert <- FALSE
157+ bull $ x3p <- lapply(bull $ x3p , x3p_rotate , angle = 90 )
145158 }
146159
147160 # Check if we need to down-sample the bullet
@@ -151,15 +164,21 @@ server <- function(input, output, session) {
151164 current_resolution <- x3p_get_scale(bull $ x3p [[1 ]])
152165
153166 # Down-sample if necessary
154- if (reference_resolution < current_resolution ) {
155- alert(" Detected higher resolution bullet, down-sampling..." )
156- m <- round(current_resolution / reference_resolution )
167+ if (reference_resolution > current_resolution ) {
168+ if (values $ show_alert ) {
169+ alert(" Detected higher resolution bullet, down-sampling..." )
170+ }
171+ values $ show_alert <- FALSE
172+ m <- round(reference_resolution / current_resolution )
157173
158174 bull $ x3p <- lapply(bull $ x3p , x3p_sample , m = m )
159- } else if (reference_resolution > current_resolution ) {
160- alert(" Detected lower resolution bullet, down-sampling previous bullets..." )
161-
162- m <- round(reference_resolution / current_resolution )
175+ } else if (reference_resolution < current_resolution ) {
176+ if (values $ show_alert ) {
177+ alert(" Detected lower resolution bullet, down-sampling previous bullets..." )
178+ }
179+ values $ show_alert <- FALSE
180+
181+ m <- round(current_resolution / reference_resolution )
163182 bulldata $ allbull $ x3p <- lapply(bulldata $ allbull $ x3p , x3p_sample , m = m )
164183 }
165184 }
@@ -261,6 +280,7 @@ server <- function(input, output, session) {
261280
262281 # # Start Process before Interactivity
263282 observeEvent(input $ doprocess ,{
283+ values $ show_alert <- FALSE
264284 if (length(input $ bullcompgroup )== 0 ) return (NULL )
265285 progress <- shiny :: Progress $ new();on.exit(progress $ close())
266286
@@ -474,7 +494,7 @@ server <- function(input, output, session) {
474494 output $ reportUI <- renderUI({
475495 if (! is.null(bulldata $ preCC )) return (NULL )
476496 if (is.null(bulldata $ comparison )) return (NULL )
477- if (is.null(input $ comp_bul1 ) | is.null(input $ comp_bul2 )) return (NULL )
497+ if (is.null(input $ comp_bul1 ) | is.null(input $ comp_bul2 )) return (NULL )
478498
479499 # # Bullet Comparison Report
480500 BullComp <- list (
0 commit comments