diff --git a/inst/htmljs/animint.js b/inst/htmljs/animint.js index 04c21430..06db1c21 100644 --- a/inst/htmljs/animint.js +++ b/inst/htmljs/animint.js @@ -1134,12 +1134,18 @@ var animint = function (to_select, json_file) { var get_style_on_stroke_width = get_size; // stroke_width for geom_point - var stroke_width = 1; // by default ggplot2 has 0.5, animint has 1 + var stroke_width = 1; // default + + // Make stroke more visible when color_off is used + if(aes.hasOwnProperty("color_off")){ + stroke_width = 2; + } + var get_stroke_width; if(aes.hasOwnProperty("stroke")){ - get_stroke_width = get_attr("stroke"); + get_stroke_width = get_attr("stroke"); }else{ - get_stroke_width = function(d){ + get_stroke_width = function(d){ return stroke_width; }; } diff --git a/tests/testthat/test-renderer-selectors.R b/tests/testthat/test-renderer-selectors.R new file mode 100644 index 00000000..a3d60e95 --- /dev/null +++ b/tests/testthat/test-renderer-selectors.R @@ -0,0 +1,20 @@ +test_that("animint renderer works without Selectors.hasOwnProperty", { + skip_on_cran() + + library(animint2) + + df <- data.frame( + x = 1:3, + y = 1:3, + grp = c("a", "b", "c") + ) + + p <- ggplot(df, aes(x, y)) + + geom_point(clickSelects = "grp") + + tmp <- withr::local_tempdir() + + expect_silent( + animint(list(plot = p), out.dir = tmp) + ) +}) \ No newline at end of file