This commit is contained in:
a-ill
2023-07-04 21:38:05 +03:00
parent 8e322b5df0
commit b949595702
6 changed files with 29 additions and 10 deletions

View File

@@ -38,7 +38,6 @@ export function px2rem(px) {
*
* @see https://stackoverflow.com/questions/118241/calculate-text-width-with-javascript/21015393#21015393
*/
export function getTextWidth(text, font) {
// re-use canvas object for better performance
const canvas = getTextWidth.canvas || (getTextWidth.canvas = document.createElement("canvas"));
@@ -109,4 +108,11 @@ export function validatePosNumber(event,input,callback,max) {
else {
callback(input.value)
}
}
export function shuffleArray(array) {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
}