mirror of
https://github.com/openseadragon/openseadragon.git
synced 2025-02-22 17:53:13 +03:00
Merge pull request #2657 from cff29546/master
use unique hash for MouseTracker
This commit is contained in:
commit
306adb9b6a
@ -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));
|
||||
|
Loading…
x
Reference in New Issue
Block a user