A full-screen viewer for a list of images, with zoom and rotation.
Usage
el_image_viewer(
id = NULL,
url_list = NULL,
visible = FALSE,
z_index = NULL,
initial_index = NULL,
infinite = NULL,
hide_on_click_modal = NULL,
teleported = NULL,
zoom_rate = NULL,
scale = NULL,
min_scale = NULL,
max_scale = NULL,
close_on_press_escape = NULL,
show_progress = NULL,
width = NULL,
slots = NULL
)
update_el_image_viewer(
session = shiny::getDefaultReactiveDomain(),
id,
visible = NULL,
url_list = NULL,
initial_index = NULL,
z_index = NULL,
infinite = NULL,
hide_on_click_modal = NULL,
teleported = NULL,
zoom_rate = NULL,
scale = NULL,
min_scale = NULL,
max_scale = NULL,
close_on_press_escape = NULL,
show_progress = NULL
)Arguments
- id
Component ID. Auto-generated if
NULL.- url_list
Preview link list. Element Plus's
url-list(string[]).- visible
Whether it starts open. Open and close it later with
update_el_image_viewer().- z_index
Preview backdrop z-index. Element Plus's
z-index(number / string).- initial_index
The initial preview image index, less than or equal to the length of
url-list. Element Plus'sinitial-index(number).- infinite
Whether preview is infinite. Element Plus's
infinite(boolean).- hide_on_click_modal
Whether user can emit close event when clicking backdrop. Element Plus's
hide-on-click-modal(boolean).- teleported
Whether to append image itself to body. A nested parent element attribute transform should have this attribute set to
true. Element Plus'steleported(boolean).- zoom_rate
The zoom rate of the image viewer zoom event. Element Plus's
zoom-rate(number).- scale
The preview image scale. Element Plus's
scale(number).- min_scale
The min scale of the image viewer zoom event. Element Plus's
min-scale(number).- max_scale
The max scale of the image viewer zoom event. Element Plus's
max-scale(number).- close_on_press_escape
Whether the image-viewer can be closed by pressing ESC. Element Plus's
close-on-press-escape(boolean).- show_progress
Whether to display the preview image progress content. Element Plus's
show-progress(boolean).- width
Component width, as a CSS unit.
- slots
Named list of Element slot contents:
progress,toolbar,viewer-error. A scoped slot is written withtemplate().- session
Shiny session; the current one by default, as for
shiny::updateTextInput().
Shiny inputs
input$<id>_close– as it closes.input$<id>_error– Element Plus'serrorevent.input$<id>_switch– Element Plus'sswitchevent.input$<id>_rotate– Element Plus'srotateevent.
Element methods
Callable with call_el(): setActiveItem().
Updating from the server
Open or close an el_image_viewer(), or give it other images.
Every other argument of el_image_viewer() that can change once it is
drawn is an argument here too, under the same name. One left NULL
stays as it is; NA returns it to Element's default.
update_el_image_viewer() is called for its side effect and returns NULL invisibly.
Examples
if (interactive()) {
# inside a server function
observeEvent(
input$show,
update_el_image_viewer(session, "photos", visible = TRUE)
)
}