Merge pull request #2657 from cff29546/master

use unique hash for MouseTracker
This commit is contained in:
Ian Gilman 2025-01-10 09:32:12 -08:00 committed by GitHub
commit 306adb9b6a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -135,7 +135,7 @@
};
}
this.hash = Math.random(); // An unique hash for this tracker.
this.hash = uniqueHash(); // An unique hash for this tracker.
/**
* The element for which pointer events are being monitored.
* @member {Element} element
@ -3781,4 +3781,19 @@
}
}
/**
* @function
* @private
* @inner
*/
function uniqueHash( ) {
let uniqueId = Date.now().toString(36) + Math.random().toString(36).substring(2);
while (uniqueId in THIS) {
// rehash when not unique
uniqueId = Date.now().toString(36) + Math.random().toString(36).substring(2);
}
return uniqueId;
}
}(OpenSeadragon));