File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -823,14 +823,15 @@ verify_webgl <- function(p) {
823823 return (p )
824824 }
825825 types <- sapply(p $ x $ data , function (x ) x [[" type" ]][1 ] %|| % " scatter" )
826- idx <- paste0(types , " gl" ) %in% names(Schema $ traces )
827- if (any(! idx )) {
826+ can_gl <- paste0(types , " gl" ) %in% names(Schema $ traces )
827+ already_gl <- grepl(" gl$" , types )
828+ if (any(! can_gl & ! already_gl )) {
828829 warning(
829830 " The following traces don't have a WebGL equivalent: " ,
830- paste(which(! idx ), collapse = " , " )
831+ paste(which(! can_gl & ! already_gl ), collapse = " , " )
831832 )
832833 }
833- for (i in which(idx )) {
834+ for (i in which(can_gl )) {
834835 p $ x $ data [[i ]]$ type <- paste0(p $ x $ data [[i ]]$ type , " gl" )
835836 }
836837 p
Original file line number Diff line number Diff line change @@ -310,3 +310,10 @@ test_that("Informative deprecation message for titlefont", {
310310 p <- layout(plot_ly(), title = " A title" , titlefont = list (size = 30 ))
311311 expect_warning(plotly_build(p ), " titlefont" )
312312})
313+
314+ test_that(" toWebGL() shouldn't complain if it's already webgl" , {
315+ p <- plot_ly(x = 1 , y = 1 ) %> %
316+ add_trace(type = " scattergl" , mode = " markers" ) %> %
317+ toWebGL()
318+ expect_silent(plotly_build(p ))
319+ })
You can’t perform that action at this time.
0 commit comments