mirror of
https://github.com/rileyjshaw/terra.git
synced 2024-11-21 04:54:23 +00:00
Fix cellSize undefined in createCanvasElement
This commit is contained in:
parent
3482efc8af
commit
02e2609ed5
@ -1,6 +1,9 @@
|
|||||||
// Creates an HD canvas element on page and
|
// Creates an HD canvas element on page and
|
||||||
// returns a reference to the element
|
// returns a reference to the element
|
||||||
var createCanvasElement = function (width, height, id, insertAfter) {
|
var createCanvasElement = function (width, height, cellSize, id, insertAfter) {
|
||||||
|
width *= cellSize;
|
||||||
|
height *= cellSize;
|
||||||
|
|
||||||
// Creates a scaled-up canvas based on the device's
|
// Creates a scaled-up canvas based on the device's
|
||||||
// resolution, then displays it properly using styles
|
// resolution, then displays it properly using styles
|
||||||
function createHDCanvas (ratio) {
|
function createHDCanvas (ratio) {
|
||||||
|
@ -13,11 +13,11 @@ var dom = require('./dom.js');
|
|||||||
*/
|
*/
|
||||||
function Terrarium(width, height, id, cellSize, insertAfter) {
|
function Terrarium(width, height, id, cellSize, insertAfter) {
|
||||||
cellSize = cellSize || 10;
|
cellSize = cellSize || 10;
|
||||||
|
this.cellSize = cellSize;
|
||||||
this.width = width;
|
this.width = width;
|
||||||
this.height = height;
|
this.height = height;
|
||||||
this.cellSize = cellSize;
|
|
||||||
this.grid = [];
|
this.grid = [];
|
||||||
this.canvas = dom.createCanvasElement(width * cellSize, height * cellSize, id, insertAfter);
|
this.canvas = dom.createCanvasElement(width, height, cellSize, id, insertAfter);
|
||||||
this.nextFrame = false;
|
this.nextFrame = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
9
dist/terra.js
vendored
9
dist/terra.js
vendored
@ -209,7 +209,10 @@ module.exports = function (canvas, grid, cellSize) {
|
|||||||
},{"./util.js":6}],4:[function(require,module,exports){
|
},{"./util.js":6}],4:[function(require,module,exports){
|
||||||
// Creates an HD canvas element on page and
|
// Creates an HD canvas element on page and
|
||||||
// returns a reference to the element
|
// returns a reference to the element
|
||||||
var createCanvasElement = function (width, height, id, insertAfter) {
|
var createCanvasElement = function (width, height, cellSize, id, insertAfter) {
|
||||||
|
width *= cellSize;
|
||||||
|
height *= cellSize;
|
||||||
|
|
||||||
// Creates a scaled-up canvas based on the device's
|
// Creates a scaled-up canvas based on the device's
|
||||||
// resolution, then displays it properly using styles
|
// resolution, then displays it properly using styles
|
||||||
function createHDCanvas (ratio) {
|
function createHDCanvas (ratio) {
|
||||||
@ -268,11 +271,11 @@ var dom = require('./dom.js');
|
|||||||
*/
|
*/
|
||||||
function Terrarium(width, height, id, cellSize, insertAfter) {
|
function Terrarium(width, height, id, cellSize, insertAfter) {
|
||||||
cellSize = cellSize || 10;
|
cellSize = cellSize || 10;
|
||||||
|
this.cellSize = cellSize;
|
||||||
this.width = width;
|
this.width = width;
|
||||||
this.height = height;
|
this.height = height;
|
||||||
this.cellSize = cellSize;
|
|
||||||
this.grid = [];
|
this.grid = [];
|
||||||
this.canvas = dom.createCanvasElement(width * cellSize, height * cellSize, id, insertAfter);
|
this.canvas = dom.createCanvasElement(width, height, cellSize, id, insertAfter);
|
||||||
this.nextFrame = false;
|
this.nextFrame = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
dist/terra.min.js
vendored
2
dist/terra.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user