Skip to content

Commit a4dca6d

Browse files
committed
Solved minor bug in rendering
1 parent 1f15491 commit a4dca6d

File tree

1 file changed

+31
-13
lines changed

1 file changed

+31
-13
lines changed

server.R

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,7 +1582,9 @@ shinyServer(function(input, output, session) {
15821582
height <- as.numeric(input$txtExportRenderingClassicPNGHeight)
15831583
dpi <- as.numeric(input$txtExportRenderingClassicPNGResolution)
15841584

1585-
png(filename=FILE_RGL_SNAPSHOT, width=width, height=height, res=dpi)
1585+
if(input$chkTIMELINE_RENDER_TO_FILE){
1586+
png(filename=FILE_RGL_SNAPSHOT, width=width, height=height, res=dpi)
1587+
}
15861588

15871589
par(mar=c(0, 0, 0, 0), xaxs='i', yaxs='i')
15881590
par(oma=c(0, 0, 0, 0))
@@ -1623,6 +1625,12 @@ shinyServer(function(input, output, session) {
16231625
V(g[[l]])$shape[V(g[[l]])$size==0] <- "none"
16241626
V(g[[l]])$framecolor <- input$txtNODE_FRAME_COLOR
16251627
if(input$txtNODE_FRAME_COLOR==""){ V(g[[l]])$framecolor <- V(g[[l]])$color }
1628+
1629+
if(input$chkNODE_LABELS_SHOW_WRAP){
1630+
V(g[[l]])$label2 <- lapply(lapply(V(g[[l]])$label, function(x) strwrap(x,as.numeric(input$txtNODE_LABELS_WRAP))), function(x) paste(x, collapse='\n'))
1631+
}else{
1632+
V(g[[l]])$label2 <- V(g[[l]])$label
1633+
}
16261634

16271635
if(input$chkPLOT_WITH_RGL){
16281636
print(" openGL phase...")
@@ -1654,7 +1662,7 @@ shinyServer(function(input, output, session) {
16541662
vertex.shape=V(g[[l]])$shape,
16551663
vertex.color=V(g[[l]])$color,
16561664
vertex.frame.color=V(g[[l]])$framecolor,
1657-
vertex.label=V(g[[l]])$label,
1665+
vertex.label=V(g[[l]])$label2,
16581666
vertex.label.dist=as.numeric(input$txtNODE_LABELS_DISTANCE), #,+ 0.01*V(g[[l]])$size,
16591667
vertex.label.font=2,
16601668
vertex.label.cex=as.numeric(input$txtNODE_LABELS_FONT_SIZE),
@@ -1739,7 +1747,9 @@ shinyServer(function(input, output, session) {
17391747

17401748
rgl.snapshot(FILE_RGL_SNAPSHOT)
17411749
}else{
1742-
dev.off()
1750+
if(input$chkTIMELINE_RENDER_TO_FILE){
1751+
dev.off()
1752+
}
17431753
}
17441754
#Sys.sleep(1)
17451755
}
@@ -3677,15 +3687,17 @@ shinyServer(function(input, output, session) {
36773687
}
36783688
}
36793689

3680-
#rotate the view, if needed
3681-
thx <- as.numeric(input$txtPLOT_ROTX)
3682-
thy <- as.numeric(input$txtPLOT_ROTY)
3683-
thz <- as.numeric(input$txtPLOT_ROTZ)
3684-
for(l in 1:(LAYERS+1)){
3685-
if(thx>0.){ layouts[[l]] <<- t( Rotx(thx) %*% t(layouts[[l]]) ) }
3686-
if(thy>0.){ layouts[[l]] <<- t( Roty(thy) %*% t(layouts[[l]]) ) }
3687-
if(thz>0.){ layouts[[l]] <<- t( Rotz(thz) %*% t(layouts[[l]]) ) }
3688-
}
3690+
if(!input$chkPLOT_WITH_RGL){
3691+
#rotate the view, if needed
3692+
thx <- as.numeric(input$txtPLOT_ROTX)
3693+
thy <- as.numeric(input$txtPLOT_ROTY)
3694+
thz <- as.numeric(input$txtPLOT_ROTZ)
3695+
for(l in 1:(LAYERS+1)){
3696+
if(thx>0.){ layouts[[l]] <<- t( Rotx(thx) %*% t(layouts[[l]]) ) }
3697+
if(thy>0.){ layouts[[l]] <<- t( Roty(thy) %*% t(layouts[[l]]) ) }
3698+
if(thz>0.){ layouts[[l]] <<- t( Rotz(thz) %*% t(layouts[[l]]) ) }
3699+
}
3700+
}
36893701

36903702
progress$set(message = 'Layout Completed!', value = 1)
36913703
Sys.sleep(2)
@@ -3995,6 +4007,12 @@ shinyServer(function(input, output, session) {
39954007

39964008
if(input$txtNODE_FRAME_COLOR==""){ V(g[[l]])$framecolor <- V(g[[l]])$color }
39974009

4010+
if(input$chkNODE_LABELS_SHOW_WRAP){
4011+
V(g[[l]])$label2 <- lapply(lapply(V(g[[l]])$label, function(x) strwrap(x,as.numeric(input$txtNODE_LABELS_WRAP))), function(x) paste(x, collapse='\n'))
4012+
}else{
4013+
V(g[[l]])$label2 <- V(g[[l]])$label
4014+
}
4015+
39984016

39994017
#saving default values for later usage
40004018
defaultVsize[[l]] <<- V(g[[l]])$size
@@ -4031,7 +4049,7 @@ shinyServer(function(input, output, session) {
40314049
vertex.shape=V(g[[l]])$shape,
40324050
vertex.color=V(g[[l]])$color,
40334051
vertex.frame.color=V(g[[l]])$framecolor,
4034-
vertex.label=V(g[[l]])$label,
4052+
vertex.label=V(g[[l]])$label2,
40354053
vertex.label.dist=as.numeric(input$txtNODE_LABELS_DISTANCE), #,+ 0.01*V(g[[l]])$size,
40364054
vertex.label.font=2,
40374055
vertex.label.cex=as.numeric(input$txtNODE_LABELS_FONT_SIZE),

0 commit comments

Comments
 (0)