Fix paint bugs
This commit is contained in:
parent
ecdea07856
commit
e4d985c8b6
@ -813,6 +813,12 @@ utils.prototype.encodeCanvas = function (ctx) {
|
|||||||
|
|
||||||
////// 解析arr数组,并绘制到tempCanvas上 //////
|
////// 解析arr数组,并绘制到tempCanvas上 //////
|
||||||
utils.prototype.decodeCanvas = function (arr, width, height) {
|
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;
|
if (!core.isset(arr)) return null;
|
||||||
// to byte array
|
// to byte array
|
||||||
var curr = 0, list = [];
|
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);
|
for (var i=0;i<x;i++) list.push(curr);
|
||||||
curr = 1-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);
|
var imgData = tempCanvas.getImageData(0, 0, width, height);
|
||||||
for (var i=0;i<imgData.data.length;i+=4) {
|
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 () {
|
utils.prototype.consoleOpened = function () {
|
||||||
if (window.Firebug && window.Firebug.chrome && window.Firebug.chrome.isInitialized)
|
if (window.Firebug && window.Firebug.chrome && window.Firebug.chrome.isInitialized)
|
||||||
return true;
|
return true;
|
||||||
|
if (!core.platform.isPC) return false;
|
||||||
var threshold = 160;
|
var threshold = 160;
|
||||||
var zoom = Math.min(window.outerWidth/window.innerWidth, window.outerHeight/window.innerHeight);
|
var zoom = Math.min(window.outerWidth/window.innerWidth, window.outerHeight/window.innerHeight);
|
||||||
return window.outerWidth - zoom*window.innerWidth > threshold
|
return window.outerWidth - zoom*window.innerWidth > threshold
|
||||||
|
|||||||
@ -1040,8 +1040,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
|||||||
ctx.drawImage(core.statusBar.icons[name], leftOffset, topOffset, 25, 25);
|
ctx.drawImage(core.statusBar.icons[name], leftOffset, topOffset, 25, 25);
|
||||||
// 文字内容
|
// 文字内容
|
||||||
var text = (core.statusBar[name]||{}).innerText || " ";
|
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.fillText(text, leftOffset + 36, topOffset + 20);
|
||||||
ctx.font = 'italic bold 18px Verdana';
|
ctx.font = 'italic bold 18px Verdana';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user