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,3 +1,4 @@
import {POINTY} from './consts.js';
export default class DrawHexagon {
constructor(settings) {
@@ -33,8 +34,8 @@ export default class DrawHexagon {
outline(context, scale, x, y, cell) {
scale = scale * cell.scale;
let hexCornerX = cell.pointyTop ? this.pointyTopCornerX : this.flatTopCornerX;
let hexCornerY = cell.pointyTop ? this.pointyTopCornerY : this.flatTopCornerY;
let hexCornerX = cell.orientation === POINTY ? this.pointyTopCornerX : this.flatTopCornerX;
let hexCornerY = cell.orientation === POINTY ? this.pointyTopCornerY : this.flatTopCornerY;
context.beginPath();
context.moveTo(x + scale * hexCornerX[0], y + scale * hexCornerY[0]);
@@ -52,8 +53,8 @@ export default class DrawHexagon {
filled(context, scale, x, y, cell) {
scale = scale * cell.scale;
let hexCornerX = cell.pointyTop ? this.pointyTopCornerX : this.flatTopCornerX;
let hexCornerY = cell.pointyTop ? this.pointyTopCornerY : this.flatTopCornerY;
let hexCornerX = cell.orientation === POINTY ? this.pointyTopCornerX : this.flatTopCornerX;
let hexCornerY = cell.orientation === POINTY ? this.pointyTopCornerY : this.flatTopCornerY;
context.beginPath();
context.moveTo(x + scale * hexCornerX[0], y + scale * hexCornerY[0]);