Skip to content

Commit

Permalink
restore the cooldown
Browse files Browse the repository at this point in the history
  • Loading branch information
fohristiwhirl committed Jul 5, 2019
1 parent a8af6eb commit ea6c59c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion 95_renderer.js
Expand Up @@ -16,8 +16,9 @@ function NewRenderer() {
renderer.pgn_choices = null; // All games found when opening a PGN file.
renderer.friendly_draws = New2DArray(8, 8); // What pieces are drawn in boardfriends. Used to skip redraws.
renderer.active_square = null; // Clicked square.
renderer.hoverdraw_line = [];
renderer.hoverdraw_line = []; // The fantasy line drawn so far.
renderer.tick = 0; // How many draw loops we've been through.
renderer.position_change_time = performance.now(); // Time of the last position change. Used for cooldown on hover draw.

// Some sync stuff...

Expand All @@ -34,6 +35,8 @@ function NewRenderer() {

renderer.position_changed = function(new_game_flag) {

this.position_change_time = performance.now();

this.searchmoves = [];
this.hoverdraw_line = [];
this.position_changed_clear_info_handler(new_game_flag);
Expand Down Expand Up @@ -1013,6 +1016,11 @@ function NewRenderer() {
return false;
}

if (performance.now() - this.position_change_time < 1000) {
this.hoverdraw_line = [];
return false;
}

let overlist = document.querySelectorAll(":hover");

let firstmove = null;
Expand Down

0 comments on commit ea6c59c

Please sign in to comment.