Skip to content

Commit d995787

Browse files
author
Adrien
authored
[FEAT] Ensure overlays are passed as a list to the js function (#57)
1 parent a40703a commit d995787

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

R/bpmnVisualization.R

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#' Display BPMN diagram based on BPMN definition in XML format
1818
#'
1919
#' @param bpmnXML A file name or xml document or string in BPMN XML format
20-
#' @param overlays A list of elements to be added to the diagram's existing elements.
20+
#' @param overlays An element or a list of elements to be added to the diagram's existing elements.
2121
#' Use overlay function to create an overlay object with content and relative position.
2222
#' @param width The width used to display the widget
2323
#' @param height The height used to display the widget
@@ -47,7 +47,12 @@ display <- function(bpmnXML, overlays = NULL, width = NULL, height = NULL, eleme
4747
# widget parameters
4848
x <- list(bpmnContent = bpmnContent)
4949
if(length(overlays)) {
50-
x$overlays <- overlays
50+
# In case the user passes a single parameter as overlays (instead of a list), we wrap it into a list so the js can work
51+
x$overlays <- if (is.list(overlays[[1]])) {
52+
overlays
53+
} else {
54+
list(overlays)
55+
}
5156
}
5257

5358
# create widget

man/display.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)