mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 13:16:10 +03:00
added Euclidean modulo helper function
This commit is contained in:
parent
62e24ac1ab
commit
1b27e59be8
@ -1635,7 +1635,7 @@ function OpenSeadragon( options ){
|
|||||||
/**
|
/**
|
||||||
* Compute the modulo of a number but makes sure to always return
|
* Compute the modulo of a number but makes sure to always return
|
||||||
* a positive value.
|
* a positive value.
|
||||||
* @param {Number} number the number to computes the modulo of
|
* @param {Number} number the number to compute the modulo of
|
||||||
* @param {Number} modulo the modulo
|
* @param {Number} modulo the modulo
|
||||||
* @returns {Number} the result of the modulo of number
|
* @returns {Number} the result of the modulo of number
|
||||||
*/
|
*/
|
||||||
@ -1647,6 +1647,16 @@ function OpenSeadragon( options ){
|
|||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Computes Euclidean modulo of m % n.
|
||||||
|
* @param {Number} number the number to compute the modulo of
|
||||||
|
* @param {Number} modulo the modulo
|
||||||
|
* @returns {Number} the result of the modulo of number
|
||||||
|
*/
|
||||||
|
euclideanModulo: function(number, modulo) {
|
||||||
|
return ( ( number % modulo ) + modulo ) % modulo;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines if a point is within the bounding rectangle of the given element (hit-test).
|
* Determines if a point is within the bounding rectangle of the given element (hit-test).
|
||||||
* @function
|
* @function
|
||||||
|
Loading…
Reference in New Issue
Block a user