1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

[groups] Remove padStart because IE11

This commit is contained in:
Nick O'Leary 2020-04-02 23:23:41 +01:00
parent 6ff3286d78
commit 24f7000918
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 6 additions and 3 deletions

View File

@ -17,7 +17,8 @@ RED.colorPicker = (function() {
r = Math.max(0,r-50); r = Math.max(0,r-50);
g = Math.max(0,g-50); g = Math.max(0,g-50);
b = Math.max(0,b-50); b = Math.max(0,b-50);
return '#'+((r<<16) + (g<<8) + b).toString(16).padStart(6,'0') var s = ((r<<16) + (g<<8) + b).toString(16);
return '#'+'000000'.slice(0, 6-s.length)+s;
} }
function create(options) { function create(options) {

View File

@ -78,7 +78,8 @@ RED.group = (function() {
r = Math.min(255,Math.floor(r+j*dr)); r = Math.min(255,Math.floor(r+j*dr));
g = Math.min(255,Math.floor(g+j*dg)); g = Math.min(255,Math.floor(g+j*dg));
b = Math.min(255,Math.floor(b+j*db)); b = Math.min(255,Math.floor(b+j*db));
colorPalette.push('#'+((r<<16) + (g<<8) + b).toString(16).padStart(6,'0')); var s = ((r<<16) + (g<<8) + b).toString(16);
colorPalette.push('#'+'000000'.slice(0, 6-s.length)+s);
} }
var defaultGroupStyle = {}; var defaultGroupStyle = {};
@ -207,7 +208,8 @@ RED.group = (function() {
function convertColorToHex(c) { function convertColorToHex(c) {
var m = /^rgb\((\d+), (\d+), (\d+)\)$/.exec(c); var m = /^rgb\((\d+), (\d+), (\d+)\)$/.exec(c);
if (m) { if (m) {
return "#"+(((parseInt(m[1])<<16) + (parseInt(m[2])<<8) + parseInt(m[3])).toString(16).padStart(6,'0')) var s = ((parseInt(m[1])<<16) + (parseInt(m[2])<<8) + parseInt(m[3])).toString(16)
return '#'+'000000'.slice(0, 6-s.length)+s;
} }
return c; return c;
} }