From e4d985c8b6963621d6f0cbd669297950aa350be8 Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Thu, 13 Dec 2018 17:22:56 +0800 Subject: [PATCH] Fix paint bugs --- libs/utils.js | 12 +++++++----- project/functions.js | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/libs/utils.js b/libs/utils.js index e7ba2f23..45313e71 100644 --- a/libs/utils.js +++ b/libs/utils.js @@ -813,6 +813,12 @@ utils.prototype.encodeCanvas = function (ctx) { ////// 解析arr数组,并绘制到tempCanvas上 ////// utils.prototype.decodeCanvas = function (arr, width, height) { + // 清空tempCanvas + var tempCanvas = core.bigmap.tempCanvas; + tempCanvas.canvas.width=width; + tempCanvas.canvas.height=height; + tempCanvas.clearRect(0, 0, width, height); + if (!core.isset(arr)) return null; // to byte array var curr = 0, list = []; @@ -820,11 +826,6 @@ utils.prototype.decodeCanvas = function (arr, width, height) { for (var i=0;i threshold diff --git a/project/functions.js b/project/functions.js index 21852685..0d47e471 100644 --- a/project/functions.js +++ b/project/functions.js @@ -1040,8 +1040,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = ctx.drawImage(core.statusBar.icons[name], leftOffset, topOffset, 25, 25); // 文字内容 var text = (core.statusBar[name]||{}).innerText || " "; - // 斜体判定:如果不是纯数字,斜体会非常难看,需要取消 - if (!/^\d*$/.test(text)) ctx.font = 'bold 18px Verdana'; + // 斜体判定:如果不是纯数字和字母,斜体会非常难看,需要取消 + if (!/^[-+_.a-zA-Z0-9]*$/.test(text)) ctx.font = 'bold 18px Verdana'; // 绘制文字 ctx.fillText(text, leftOffset + 36, topOffset + 20); ctx.font = 'italic bold 18px Verdana';