Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beta Fix - issue with doubling up on token selected list #1578

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions Token.js
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,7 @@ class Token {
await this.place(100)
this.update_and_sync();
}
draw_selected_token_bounding_box()

}

Expand Down Expand Up @@ -2331,11 +2332,7 @@ class Token {
} else {
parentToken.removeClass('tokenselected');
}

$(`.token[data-group-id='${groupID}']`).each(function(){
$(this).toggleClass('tokenselected', true);
window.TOKEN_OBJECTS[$(this).attr('data-id')].selected = thisSelected;
})

window.TOKEN_OBJECTS[tokID].selected = thisSelected;

for (let id in window.TOKEN_OBJECTS) {
Expand Down Expand Up @@ -3185,7 +3182,16 @@ async function do_draw_selected_token_bounding_box() {
resolve();
}));
if (window.TOKEN_OBJECTS[id].selected) {
window.CURRENTLY_SELECTED_TOKENS.push(id);
if(!window.CURRENTLY_SELECTED_TOKENS.some(i => i == id))
window.CURRENTLY_SELECTED_TOKENS.push(id);

$(`.token[data-group-id='${window.TOKEN_OBJECTS[id].options.groupId}']`).each(function(){
if(window.CURRENTLY_SELECTED_TOKENS.some(id => id == $(this).attr('data-id')))
return;
$(this).toggleClass('tokenselected', true);
window.TOKEN_OBJECTS[$(this).attr('data-id')].selected = true;
window.CURRENTLY_SELECTED_TOKENS.push($(this).attr('data-id'));
})
}
}

Expand Down