/trunk/dist/was.js |
@@ -129,9 +129,8 @@ |
} |
}); |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2016 Wizardry and Steamworks - License: GNU GPLv3 // |
/////////////////////////////////////////////////////////////////////////// |
/* Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 */ |
/*************************************************************************/ |
function wasCSVToArray(csv) { |
var l = []; |
var s = []; |
@@ -170,9 +169,9 @@ |
return l; |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2016 Wizardry and Steamworks - License: GNU GPLv3 // |
/////////////////////////////////////////////////////////////////////////// |
/*************************************************************************/ |
/* Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 */ |
/*************************************************************************/ |
function wasArrayToCSV(a) { |
var csv = []; |
for(var i=0; i<a.length; ++i) { |
@@ -185,3 +184,30 @@ |
} |
return csv.join(); |
} |
|
/* Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 */ |
/*************************************************************************/ |
function wasMapValueToRange(value, xMin, xMax, yMin, yMax) { |
return yMin + ( |
( yMax - yMin ) * ( value - xMin ) / ( xMax - xMin ) |
); |
} |
|
/* Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 */ |
/*************************************************************************/ |
function HexToRGB(hex) { |
var shortRegEx = /^#?([a-f\d])([a-f\d])([a-f\d])$/i; |
hex = hex.replace( |
shortRegEx, |
function(m, r, g, b) { |
return r + r + g + g + b + b; |
} |
); |
|
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); |
return result ? { |
r: parseInt(result[1], 16), |
g: parseInt(result[2], 16), |
b: parseInt(result[3], 16) |
} : null; |
} |