Skip to content
Open
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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(
Expand Down Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
7 changes: 2 additions & 5 deletions inst/htmljs/animint.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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"){
Expand Down
Loading