parent
ca9082f266
commit
d6eaee23ec
|
|
@ -86,3 +86,4 @@
|
||||||
* Display path in leaflet
|
* Display path in leaflet
|
||||||
* Reduce framerate if locked
|
* Reduce framerate if locked
|
||||||
* Stroke to move around in the map
|
* Stroke to move around in the map
|
||||||
|
* Fix for missing paths in display
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
let simulated = false;
|
let simulated = true;
|
||||||
let displaying = false;
|
let displaying = false;
|
||||||
let in_menu = false;
|
let in_menu = false;
|
||||||
let go_backwards = false;
|
let go_backwards = false;
|
||||||
|
|
@ -243,6 +243,7 @@ class Map {
|
||||||
let local_y = displayed_y - this.start_coordinates[1];
|
let local_y = displayed_y - this.start_coordinates[1];
|
||||||
let tile_x = Math.floor(local_x / this.side);
|
let tile_x = Math.floor(local_x / this.side);
|
||||||
let tile_y = Math.floor(local_y / this.side);
|
let tile_y = Math.floor(local_y / this.side);
|
||||||
|
|
||||||
let limit = 1;
|
let limit = 1;
|
||||||
if (!zoomed) {
|
if (!zoomed) {
|
||||||
limit = 2;
|
limit = 2;
|
||||||
|
|
@ -266,6 +267,18 @@ class Map {
|
||||||
sin_direction
|
sin_direction
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
|
// let colors = [
|
||||||
|
// [0, 0, 0],
|
||||||
|
// [0, 0, 1],
|
||||||
|
// [0, 1, 0],
|
||||||
|
// [0, 1, 1],
|
||||||
|
// [1, 0, 0],
|
||||||
|
// [1, 0, 1],
|
||||||
|
// [1, 1, 0],
|
||||||
|
// [1, 1, 0.5],
|
||||||
|
// [0.5, 0, 0.5],
|
||||||
|
// [0, 0.5, 0.5],
|
||||||
|
// ];
|
||||||
if (this.color[0] == 1 && this.color[1] == 0 && this.color[2] == 0) {
|
if (this.color[0] == 1 && this.color[1] == 0 && this.color[2] == 0) {
|
||||||
this.display_thick_tile(
|
this.display_thick_tile(
|
||||||
x,
|
x,
|
||||||
|
|
@ -301,33 +314,32 @@ class Map {
|
||||||
cos_direction,
|
cos_direction,
|
||||||
sin_direction
|
sin_direction
|
||||||
) {
|
) {
|
||||||
let center_x = g.getWidth() / 2;
|
let width = g.getWidth();
|
||||||
let center_y = g.getHeight() / 2 + Y_OFFSET;
|
let height = g.getHeight();
|
||||||
|
let center_x = width / 2;
|
||||||
|
let center_y = height / 2 + Y_OFFSET;
|
||||||
let side = this.side;
|
let side = this.side;
|
||||||
let x1 = tile_x * side;
|
let tile_center_x = (tile_x + 0.5) * side;
|
||||||
let y1 = tile_y * side;
|
let tile_center_y = (tile_y + 0.5) * side;
|
||||||
let x2 = x1 + side;
|
let scaled_center_x = (tile_center_x - current_x) * scale_factor;
|
||||||
let y2 = y1 + side;
|
let scaled_center_y = (tile_center_y - current_y) * scale_factor;
|
||||||
let scaled_x1 = (x1 - current_x) * scale_factor;
|
let rotated_center_x = scaled_center_x * cos_direction - scaled_center_y * sin_direction;
|
||||||
let scaled_y1 = (y1 - current_y) * scale_factor;
|
let rotated_center_y = scaled_center_x * sin_direction + scaled_center_y * cos_direction;
|
||||||
let rotated_x1 = scaled_x1 * cos_direction - scaled_y1 * sin_direction;
|
let on_screen_center_x = center_x - rotated_center_x;
|
||||||
let rotated_y1 = scaled_x1 * sin_direction + scaled_y1 * cos_direction;
|
let on_screen_center_y = center_y + rotated_center_y;
|
||||||
let scaled_x2 = (x2 - current_x) * scale_factor;
|
|
||||||
let scaled_y2 = (y2 - current_y) * scale_factor;
|
|
||||||
let rotated_x2 = scaled_x2 * cos_direction - scaled_y2 * sin_direction;
|
|
||||||
let rotated_y2 = scaled_x2 * sin_direction + scaled_y2 * cos_direction;
|
|
||||||
|
|
||||||
if (center_x < rotated_x1 && center_x < rotated_x2) {
|
let scaled_side = side * scale_factor;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (-center_x > rotated_x1 && -center_x > rotated_x2) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (center_y < rotated_y1 && center_y < rotated_y2) {
|
if (on_screen_center_x + scaled_side <= 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (-center_y > rotated_y1 && -center_y > rotated_y2) {
|
if (on_screen_center_x - scaled_side >= width) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (on_screen_center_y + scaled_side <= 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (on_screen_center_y - scaled_side >= height) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue