/** * @file client_utils.js * @author frtk@tetalab */ NPGClient.Utils = { /** * UI */ // setTxtStyle : function(ctx, style) { ctx.font = style.font; ctx.fillStyle = style.col; ctx.textAlign = style.align; }, // applyStyle : function(ctx, style) { // if (style.bm) { ctx.lineWidth = style.bw; ctx.strokeStyle = style.bc; } // if (style.fm) { ctx.fillStyle = style.fc; } }, /** * User Name */ // addChar : function(key) { //console.log(key + ' ' + NPGClient.userName); if (NPGClient.userName.length < NPGClient.NAMEMAXSIZE) { NPGClient.userName = NPGClient.userName + String.fromCharCode(key).toLowerCase(); console.log(NPGClient.userName); } }, // removeChar : function(key) { if (NPGClient.userName.length > 0) { NPGClient.userName = NPGClient.userName.substring(0, NPGClient.userName.length - 1); console.log(NPGClient.userName); } }, // validChar : function(key) { return NPGClient.evtHandler.loginValidKey(key); }, // validName : function(key) { var len = NPGClient.userName.length; return (len >= 0 && len <= NPGClient.NAMEMAXSIZE); }, // resetName : function() { NPGClient.userName = ''; }, }