Fix paint bugs

This commit is contained in:
ckcz123 2018-12-13 17:22:56 +08:00
parent ecdea07856
commit e4d985c8b6
2 changed files with 9 additions and 7 deletions

View File

@ -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<x;i++) list.push(curr);
curr = 1-curr;
})
// 使用tempCanvas
var tempCanvas = core.bigmap.tempCanvas;
tempCanvas.canvas.width=width;
tempCanvas.canvas.height=height;
tempCanvas.clearRect(0, 0, width, height);
var imgData = tempCanvas.getImageData(0, 0, width, height);
for (var i=0;i<imgData.data.length;i+=4) {
@ -840,6 +841,7 @@ utils.prototype.decodeCanvas = function (arr, width, height) {
utils.prototype.consoleOpened = function () {
if (window.Firebug && window.Firebug.chrome && window.Firebug.chrome.isInitialized)
return true;
if (!core.platform.isPC) return false;
var threshold = 160;
var zoom = Math.min(window.outerWidth/window.innerWidth, window.outerHeight/window.innerHeight);
return window.outerWidth - zoom*window.innerWidth > threshold

View File

@ -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';