Finite boards (#1)

This commit is contained in:
gavin
2018-07-15 02:54:26 +00:00
committed by Gitea
parent 68f83bfc4b
commit 0545c0a5d9
14 changed files with 497 additions and 356 deletions

View File

@@ -1,5 +1,5 @@
import {sqrt2} from './utils.js';
import {POINTY} from './consts.js';
export default class DrawSquare {
constructor(settings) {
@@ -11,8 +11,8 @@ export default class DrawSquare {
filled(context, scale, x, y, cell) {
scale = scale * cell.scale;
let squareCornerX = cell.pointyTop ? this.diamondX : this.squareX;
let squareCornerY = cell.pointyTop ? this.diamondY : this.squareY;
let squareCornerX = cell.orientation === POINTY ? this.diamondX : this.squareX;
let squareCornerY = cell.orientation === POINTY ? this.diamondY : this.squareY;
context.beginPath();
context.moveTo(x + scale * squareCornerX[0], y + scale * squareCornerY[0]);
@@ -26,8 +26,8 @@ export default class DrawSquare {
outline(context, scale, x, y, cell) {
scale = scale * cell.scale;
let squareCornerX = cell.pointyTop ? this.diamondX : this.squareX;
let squareCornerY = cell.pointyTop ? this.diamondY : this.squareY;
let squareCornerX = cell.orientation === POINTY ? this.diamondX : this.squareX;
let squareCornerY = cell.orientation === POINTY ? this.diamondY : this.squareY;
context.beginPath();
context.moveTo(x + scale * squareCornerX[0], y + scale * squareCornerY[0]);