mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
deploy dev version
This commit is contained in:
18
dev/js/utils/Math.js
Normal file
18
dev/js/utils/Math.js
Normal file
@@ -0,0 +1,18 @@
|
||||
(function () {
|
||||
var ns = $.namespace('pskl.utils');
|
||||
|
||||
ns.Math = {
|
||||
minmax : function (val, min, max) {
|
||||
return Math.max(Math.min(val, max), min);
|
||||
},
|
||||
|
||||
/**
|
||||
* Calculate the distance between {x0, y0} and {x1, y1}
|
||||
*/
|
||||
distance : function (x0, x1, y0, y1) {
|
||||
var dx = Math.abs(x1 - x0);
|
||||
var dy = Math.abs(y1 - y0);
|
||||
return Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2));
|
||||
}
|
||||
};
|
||||
})();
|
||||
Reference in New Issue
Block a user