Fix scaling issue when drawing animation tiles.
This commit is contained in:
parent
e56e461d49
commit
8f9985791a
@ -325,10 +325,9 @@ const INTERFACE = {
|
||||
let basis_y = gui_offset.y + (13 * gui_scale);
|
||||
let icon_radius = 0.69 * radius;
|
||||
|
||||
const TILE_SCALE = 0.9;
|
||||
ctx.lineWidth = Math.min(gui_scale * 0.06, 3);
|
||||
|
||||
let draw = new INTERFACE.Draw(ctx, TILE_SCALE * gui_scale);
|
||||
let draw = new INTERFACE.Draw(ctx, gui_scale);
|
||||
|
||||
for(let i = 0; i < GAME_DATA.board.tiles.length; ++i) {
|
||||
let tile = GAME_DATA.board.tiles[i];
|
||||
@ -683,7 +682,7 @@ const INTERFACE = {
|
||||
}
|
||||
|
||||
hex(scale=1) {
|
||||
scale *= this.scale;
|
||||
let scale = scale * INTERFACE.TileScale * this.scale;
|
||||
this.ctx.moveTo(INTERFACE.HexVertex[5].x * scale, INTERFACE.HexVertex[5].y * scale);
|
||||
for(let i = 0; i < INTERFACE.HexVertex.length; ++i) {
|
||||
this.ctx.lineTo(INTERFACE.HexVertex[i].x * scale, INTERFACE.HexVertex[i].y * scale);
|
||||
@ -691,6 +690,8 @@ const INTERFACE = {
|
||||
}
|
||||
|
||||
hints(piece) {
|
||||
let scale = INTERFACE.TileScale * this.scale;
|
||||
|
||||
let movement = piece.moves();
|
||||
if((INTERFACE_DATA.player & 1) ^ INTERFACE_DATA.rotate) {
|
||||
movement = movement.rotate();
|
||||
@ -718,8 +719,8 @@ const INTERFACE = {
|
||||
let tqx = fr.x + (2 * dx);
|
||||
let tqy = fr.y + (2 * dy);
|
||||
|
||||
this.ctx.moveTo(fqx * this.scale, fqy * this.scale);
|
||||
this.ctx.lineTo(tqx * this.scale, tqy * this.scale);
|
||||
this.ctx.moveTo(fqx * scale, fqy * scale);
|
||||
this.ctx.lineTo(tqx * scale, tqy * scale);
|
||||
this.ctx.stroke();
|
||||
}
|
||||
|
||||
@ -741,9 +742,9 @@ const INTERFACE = {
|
||||
let tqx = mid.x + dx2;
|
||||
let tqy = mid.y + dy2;
|
||||
|
||||
this.ctx.moveTo(fqx * this.scale, fqy * this.scale);
|
||||
this.ctx.lineTo(mid.x * this.scale, mid.y * this.scale);
|
||||
this.ctx.lineTo(tqx * this.scale, tqy * this.scale);
|
||||
this.ctx.moveTo(fqx * scale, fqy * scale);
|
||||
this.ctx.lineTo(mid.x * scale, mid.y * scale);
|
||||
this.ctx.lineTo(tqx * scale, tqy * scale);
|
||||
this.ctx.stroke();
|
||||
}
|
||||
moves &= ~mask;
|
||||
@ -1293,6 +1294,8 @@ const INTERFACE = {
|
||||
},
|
||||
};
|
||||
|
||||
INTERFACE.TileScale = 0.9;
|
||||
|
||||
INTERFACE.Radius = 2.0 / Math.sqrt(3.0);
|
||||
INTERFACE.HalfRadius = 1.0 / Math.sqrt(3.0);
|
||||
INTERFACE.Scale = 1 / 18;
|
||||
|
Loading…
x
Reference in New Issue
Block a user