diff --git a/DESCRIPTION b/DESCRIPTION index 43ca2e728..5d787cd45 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: animint2 Title: Animated Interactive Grammar of Graphics -Version: 2026.2.28 +Version: 2026.3.2 URL: https://animint.github.io/animint2 BugReports: https://github.com/animint/animint2/issues Authors@R: c( @@ -64,7 +64,7 @@ Authors@R: c( comment="Animint2 GSoC 2025"), person("Gaurav", "Chaudhary", role="ctb", - comment="Remove unused css.file parameter; fix issue #233 selector values; fix issue #273 update_axes tick font-size; fix issue #276 update_axes transition duration")) + comment="Remove unused css.file parameter; fix issue #233 selector values; fix issue #273 update_axes tick font-size; fix issue #276 update_axes transition duration; #278 Removed unnecessary Selectors.hasOwnProperty checks in animint.js")) Description: Functions are provided for defining animated, interactive data visualizations in R code, and rendering on a web page. The 2018 Journal of Computational and diff --git a/NEWS.md b/NEWS.md index 6184d117b..f56eb79fb 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,8 @@ +# Changes in version 2026.3.2 (PR#306) + +- `animint.js`: Remove unnecessary `Selectors.hasOwnProperty` checks (issue #278). + Selector names are always valid when accessed, so membership checks are redundant. + # Changes in version 2025.12.4 (PR#277) - `update_axes`: Fix issue #276 where transition duration was hardcoded to 1000ms. Now it respects the selector's duration. diff --git a/inst/htmljs/animint.js b/inst/htmljs/animint.js index bfcc4b07f..1686596ff 100644 --- a/inst/htmljs/animint.js +++ b/inst/htmljs/animint.js @@ -1567,7 +1567,7 @@ var animint = function (to_select, json_file) { eActions = function(groups) { // Handle transitions seperately due to unique structure of geom_label_aligned var transitionDuration = 0; - if (Selectors.hasOwnProperty(selector_name)) { + if(selector_name && Selectors.hasOwnProperty(selector_name) && Selectors[selector_name].hasOwnProperty("duration")){ transitionDuration = +Selectors[selector_name].duration || 0; } groups.each(function(d) { @@ -1863,7 +1863,7 @@ var animint = function (to_select, json_file) { positionTooltip(tooltip, tooltip.html()); }); } - if(Selectors.hasOwnProperty(selector_name)){ + if(selector_name && Selectors.hasOwnProperty(selector_name) && Selectors[selector_name].hasOwnProperty("duration")){ var milliseconds = Selectors[selector_name].duration; elements = elements.transition().duration(milliseconds); } @@ -2088,9 +2088,6 @@ var animint = function (to_select, json_file) { } var update_selector = function (v_name, value) { - if(!Selectors.hasOwnProperty(v_name)){ - return; - } value = value + ""; var s_info = Selectors[v_name]; if(s_info.type == "single"){