VulpesOS/gaia/apps/camera/js/lib/get-aspect.js
OverSu b38dea0597 Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
2026-09-30 23:13:03 +02:00

20 lines
No EOL
445 B
JavaScript
Executable file

define(function(require, exports, module) {
'use strict';
/**
* Returns aspect ratio string.
*
* Makes use of Euclid's GCD algorithm,
* http://en.wikipedia.org/wiki/Euclidean_algorithm
*
* @param {Number} w
* @param {Number} h
* @return {String}
*/
module.exports = function(w, h) {
var gcd = function(a, b) { return (b === 0) ? a : gcd(b, a % b); };
var divisor = gcd(w, h);
return (w / divisor) + ':' + (h / divisor);
};
});