From 6b916c5c4e505e602bc18eec47a85edd21c24d82 Mon Sep 17 00:00:00 2001 From: Aakriti Kushwaha Date: Fri, 23 Jan 2026 22:18:29 +0530 Subject: [PATCH 1/3] Increase default stroke-width for geom_point when color_off is used --- inst/htmljs/animint.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/inst/htmljs/animint.js b/inst/htmljs/animint.js index 04c21430..59e6a7e9 100644 --- a/inst/htmljs/animint.js +++ b/inst/htmljs/animint.js @@ -1134,14 +1134,20 @@ 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 + + // If color_off is used, make stroke more visible + if(aes.hasOwnProperty("color_off")){ + stroke_width = 2; + } + var get_stroke_width; if(aes.hasOwnProperty("stroke")){ get_stroke_width = get_attr("stroke"); }else{ get_stroke_width = function(d){ - return stroke_width; - }; + return stroke_width; + }; } var linetype = "solid"; From e8c4d3d430479d6c678cd2f9336dd280afb8c8be Mon Sep 17 00:00:00 2001 From: Aakriti Kushwaha Date: Fri, 23 Jan 2026 22:32:21 +0530 Subject: [PATCH 2/3] Increase stroke-width for geom_point when color_off is used --- inst/htmljs/animint.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/inst/htmljs/animint.js b/inst/htmljs/animint.js index 59e6a7e9..06db1c21 100644 --- a/inst/htmljs/animint.js +++ b/inst/htmljs/animint.js @@ -1136,18 +1136,18 @@ var animint = function (to_select, json_file) { // stroke_width for geom_point var stroke_width = 1; // default - // If color_off is used, make stroke more visible + // Make stroke more visible when color_off is used if(aes.hasOwnProperty("color_off")){ - stroke_width = 2; - } + 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){ - return stroke_width; - }; + get_stroke_width = function(d){ + return stroke_width; + }; } var linetype = "solid"; From 9d5f4dd22f711667de90de091eab64f7a6e4dd1e Mon Sep 17 00:00:00 2001 From: Aakriti Kushwaha Date: Sun, 25 Jan 2026 21:24:02 +0530 Subject: [PATCH 3/3] Add renderer test for selectors without hasOwnProperty --- tests/testthat/test-renderer-selectors.R | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/testthat/test-renderer-selectors.R 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