Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     draw: function() {
  2.         // Bounds
  3.         if( this.active ) {        
  4.             ig.system.context.lineWidth = 1;
  5.             ig.system.context.strokeStyle = wm.config.colors.primary;
  6.             ig.system.context.strokeRect(
  7.                 -ig.system.getDrawPos(this.scroll.x) - 0.5,
  8.                 -ig.system.getDrawPos(this.scroll.y) - 0.5,
  9.                 this.width * this.tilesize * ig.system.scale + 1,
  10.                 this.height * this.tilesize * ig.system.scale + 1
  11.             );         
  12.         }
  13.            
  14.         if( this.visible ) {
  15.             this.parent();
  16.         }
  17.        
  18.         // Grid
  19.         if( this.active ) {
  20.             var x = -ig.system.getDrawPos(this.scroll.x % this.tilesize) - 0.5;
  21.             var y = -ig.system.getDrawPos(this.scroll.y % this.tilesize) - 0.5;
  22.             var step = this.tilesize * ig.system.scale;
  23.            
  24.             for( x; x < ig.system.realWidth; x += step ) {
  25.                 ig.system.context.moveTo( x, 0 );
  26.                 ig.system.context.lineTo( x, ig.system.realHeight );
  27.             }
  28.             for( y; y < ig.system.realHeight; y += step ) {
  29.                 ig.system.context.moveTo( 0, y );
  30.                 ig.system.context.lineTo( ig.system.realWidth, y );
  31.             }
  32.             ig.system.context.strokeStyle = wm.config.colors.secondary;
  33.             ig.system.context.stroke();
  34.         }
  35.     },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement