Skip to content
Open
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
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="GSOC 2026"),
person("Nandani", "Aggarwal",
role="ctb",
comment="Removed geom_dotplot and replaced with error"))
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

- `geom_dotplot()` has been removed. Use `geom_point()` instead for interactive visualizations. (Fixed #289)

# Changes in version 2026.3.2 (PR#306)

- `animint.js`: Remove redundant `Selectors.hasOwnProperty` checks and use a shared `selector_has_duration()` helper (issue #278, PR#306).

# 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
15 changes: 9 additions & 6 deletions inst/htmljs/animint.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ var animint = function (to_select, json_file) {
return safe_name(selector_name) + "_variable";
}

// selector_name can be null for geoms without a selector (initial render via update_geom(g, null)).
function selector_has_duration(name) {
return name &&
Selectors[name].hasOwnProperty("duration");
}

function is_interactive_aes(v_name){
if(v_name.indexOf("clickSelects") > -1){
return true;
Expand Down Expand Up @@ -1642,7 +1648,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_has_duration(selector_name)){
transitionDuration = +Selectors[selector_name].duration || 0;
}
groups.each(function(d) {
Expand Down Expand Up @@ -1938,7 +1944,7 @@ var animint = function (to_select, json_file) {
positionTooltip(tooltip, tooltip.html());
});
}
if(Selectors.hasOwnProperty(selector_name)){
if(selector_has_duration(selector_name)){
var milliseconds = Selectors[selector_name].duration;
elements = elements.transition().duration(milliseconds);
}
Expand Down Expand Up @@ -2086,7 +2092,7 @@ var animint = function (to_select, json_file) {
// update existing axis
var xyaxis_sel = element.select("#"+viz_id+"_"+p_name).select("."+axes+"axis_"+panel_i);
var milliseconds = 0;
if(v_name && Selectors.hasOwnProperty(v_name) && Selectors[v_name].hasOwnProperty("duration")){
if(selector_has_duration(v_name)){
milliseconds = Selectors[v_name].duration;
}
var xyaxis_g = xyaxis_sel
Expand Down Expand Up @@ -2163,9 +2169,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