@@ -22,6 +22,7 @@ const canvasStyle = {
2222 position : "absolute" ,
2323} ;
2424
25+ // The order of these is important: grid > drawing > temp > interface
2526const canvasTypes = [ "grid" , "drawing" , "temp" , "interface" ] ;
2627
2728const dimensionsPropTypes = PropTypes . oneOfType ( [
@@ -426,7 +427,7 @@ export default class CanvasDraw extends PureComponent {
426427 }
427428
428429 canvasTypes
429- . map ( ( { name } ) => this . ctx [ name ] )
430+ . map ( ( name ) => this . ctx [ name ] )
430431 . forEach ( ( ctx ) => {
431432 this . clearWindow ( ctx ) ;
432433 const m = this . coordSystem . transformMatrix ;
@@ -685,23 +686,23 @@ export default class CanvasDraw extends PureComponent {
685686 ctx . lineWidth = this . props . gridLineWidth ;
686687
687688 if ( ! this . props . hideGridX ) {
688- let countX = 0 ;
689+ let countX = minx ;
689690 const gridSizeX = this . props . gridSizeX ;
690- while ( countX < ctx . canvas . width ) {
691+ while ( countX < maxx ) {
691692 countX += gridSizeX ;
692- ctx . moveTo ( countX , 0 ) ;
693- ctx . lineTo ( countX , ctx . canvas . height ) ;
693+ ctx . moveTo ( countX , miny ) ;
694+ ctx . lineTo ( countX , maxy ) ;
694695 }
695696 ctx . stroke ( ) ;
696697 }
697698
698699 if ( ! this . props . hideGridY ) {
699- let countY = 0 ;
700+ let countY = miny ;
700701 const gridSizeY = this . props . gridSizeY ;
701- while ( countY < ctx . canvas . height ) {
702+ while ( countY < maxy ) {
702703 countY += gridSizeY ;
703- ctx . moveTo ( 0 , countY ) ;
704- ctx . lineTo ( ctx . canvas . width , countY ) ;
704+ ctx . moveTo ( minx , countY ) ;
705+ ctx . lineTo ( maxx , countY ) ;
705706 }
706707 ctx . stroke ( ) ;
707708 }
0 commit comments