File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -940,21 +940,25 @@ class RendererGL extends Renderer {
940
940
} ;
941
941
942
942
if ( isPGraphics ) {
943
+ // Handle PGraphics: remove and recreate the canvas
943
944
const pg = this . _pInst ;
944
945
pg . canvas . parentNode . removeChild ( pg . canvas ) ;
945
946
pg . canvas = document . createElement ( "canvas" ) ;
946
947
const node = pg . _pInst . _userNode || document . body ;
947
948
node . appendChild ( pg . canvas ) ;
948
949
Element . call ( pg , pg . canvas , pg . _pInst ) ;
950
+ // Restore previous width and height
949
951
pg . width = w ;
950
952
pg . height = h ;
951
953
} else {
954
+ // Handle main canvas: remove and recreate it
952
955
let c = this . canvas ;
953
956
if ( c ) {
954
957
c . parentNode . removeChild ( c ) ;
955
958
}
956
959
c = document . createElement ( "canvas" ) ;
957
960
c . id = defaultId ;
961
+ // Attach the new canvas to the correct parent node
958
962
if ( this . _pInst . _userNode ) {
959
963
this . _pInst . _userNode . appendChild ( c ) ;
960
964
} else {
You can’t perform that action at this time.
0 commit comments