Too much code is repeated in this method.  Instead, do something more clever with CSS to make the grid automatically resize, or just query the size this.el and make the grid the same size.  No need to repeat all the calculations.

Note also that the grid will look exactly the same even if mirrored, so there is no need for that parameter.