Skip to content

Commit 1d9f795

Browse files
committed
fix default alpha_off
1 parent 151e25e commit 1d9f795

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

inst/htmljs/animint.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,7 @@ var animint = function (to_select, json_file) {
10831083
return linetypesize2dasharray(lt, get_size(d));
10841084
};
10851085

1086-
var alpha = 1, alpha_off;
1086+
var alpha = 1, alpha_off = 0.5;
10871087
var get_alpha;
10881088
if(aes.hasOwnProperty("alpha")){
10891089
get_alpha = get_attr("alpha");
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
acontext("geom text color")
22
library(animint2)
3-
43
df <- data.frame(x=1,y="foo")
54
viz <- animint(
65
text=ggplot()+
@@ -9,20 +8,25 @@ viz <- animint(
98
scale_color_manual(values=c(foo="blue"))+
109
geom_text(aes(x, 2, label=y), color="red", data=df)+
1110
geom_text(aes(x, 1, label=y), color="black", color_off="pink", clickSelects="y", data=df))
11+
1212
info <- animint2HTML(viz)
1313
test_that("geom_text color rendered as fill style", {
1414
fill <- getStyleValue(info$html, '//text[@class="geom"]', "fill")
1515
expect_color(fill, c("black", "blue","red","black"))
1616
opacity <- getStyleValue(info$html, '//text[@class="geom"]', "opacity")
1717
expect_identical(opacity, c("1","1","1","1"))
1818
})
19+
1920
clickID("plot_text_y_variable_foo_svg")#or foo_label?
2021
after.html <- getHTML()
2122
test_that("geom_text color rendered as fill style", {
2223
fill <- getStyleValue(after.html, '//text[@class="geom"]', "fill")
2324
print(fill)
2425
expect_color(fill, c("black", "red","pink"))
26+
})
27+
28+
test_that("default text alpha_off correct", {
2529
opacity <- getStyleValue(after.html, '//text[@class="geom"]', "opacity")
2630
print(opacity)
27-
expect_identical(opacity, c("0.5","1","1"))
31+
expect_identical(opacity, c("0.5","1","0.5"))
2832
})

0 commit comments

Comments
 (0)