| 33 | } |
| 34 | |
| 35 | drawLightGrid( yAxis, pos, extent ){ |
| 36 | if ( extent < 5 ) return; |
| 37 | |
| 38 | const inc = ( extent < 30 ) ? extent/2 : extent/10; |
| 39 | |
| 40 | this.context.strokeStyle = "#AAD"; |
| 41 | this.context.lineWidth = 0.5; |
| 42 | |
| 43 | this.context.beginPath(); |
| 44 | |
| 45 | if (yAxis){ |
| 46 | for( let x=pos; x<pos + extent; x+=inc){ |
| 47 | this.context.moveTo( x, 0 ); |
| 48 | this.context.lineTo( x, this.canvas.height ); |
| 49 | } |
| 50 | }else{ |
| 51 | for( let y=pos; y<pos + extent; y+=inc){ |
| 52 | this.context.moveTo( 0, y ); |
| 53 | this.context.lineTo( this.canvas.width, y ); |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | // Draw the Path |
| 58 | this.context.stroke(); |
| 59 | } |
| 60 | |
| 61 | drawGrid( x, y, lineWidth = 0.7 ){ |
| 62 | |