| 957 | |
| 958 | /* Help function to updateGrid */ |
| 959 | var fillGridAt = function fillGridAt(x, y, drawMask, dimension, item) { |
| 960 | if (x >= ngx || y >= ngy || x < 0 || y < 0) { |
| 961 | return; |
| 962 | } |
| 963 | |
| 964 | grid[x][y] = false; |
| 965 | |
| 966 | if (drawMask) { |
| 967 | var ctx = elements[0].getContext('2d'); |
| 968 | ctx.fillRect(x * g, y * g, maskRectWidth, maskRectWidth); |
| 969 | } |
| 970 | |
| 971 | if (interactive) { |
| 972 | infoGrid[x][y] = { item: item, dimension: dimension }; |
| 973 | } |
| 974 | }; |
| 975 | |
| 976 | /* Update the filling information of the given space with occupied points. |
| 977 | Draw the mask on the canvas if necessary. */ |