From a1c044f0793251630cfe45a535c4fbb5f2f625ab Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Fri, 22 Feb 2019 12:13:11 +0800 Subject: [PATCH 1/3] Fix scrollText bug --- libs/ui.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/libs/ui.js b/libs/ui.js index 26f86589..9d11eefa 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -505,6 +505,7 @@ ui.prototype.calTextBoxWidth = function (canvas, content, min_width, max_width) ui.prototype.__drawText = function (canvas, content, content_left, content_top, valid_width, color, per_height, time) { + core.setTextAlign(canvas, 'left'); var offsetx = content_left, offsety = content_top; core.setFillStyle(canvas, color); @@ -543,14 +544,12 @@ ui.prototype.__drawText = function (canvas, content, content_left, content_top, return drawNext(); } // 检查是不是自动换行 - if (core.isset(valid_width)) { - var charwidth = core.calWidth(canvas, ch); - if (offsetx + charwidth > content_left + valid_width) { - index--; - offsetx = content_left; - offsety += per_height; - return drawNext(); - } + var charwidth = core.calWidth(canvas, ch); + if (core.isset(valid_width) && offsetx + charwidth > content_left + valid_width) { + index--; + offsetx = content_left; + offsety += per_height; + return drawNext(); } // 输出 core.fillText(canvas, ch, offsetx, offsety); @@ -831,7 +830,7 @@ ui.prototype.drawScrollText = function (content, time, callback) { tempCanvas.clearRect(0, 0, width, height); tempCanvas.font = font; - this.__drawText(tempCanvas, content, 0, textfont, null, textColor, 1.4*textfont, 0); + this.__drawText(tempCanvas, content, offset, textfont, null, textColor, 1.4*textfont, 0); // 开始绘制到UI上 core.clearMap('ui'); @@ -967,7 +966,6 @@ ui.prototype.drawChoices = function(content, choices) { } } - core.setTextAlign('ui', 'left'); core.setFont('ui', 'bold 15px '+globalFont); this.__drawText('ui', content, content_left, content_top, validWidth, textColor, 20, 0); } From 3e12cfd0b82a2f4efc1592a4513cfe0f8b97ca33 Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Fri, 22 Feb 2019 13:27:40 +0800 Subject: [PATCH 2/3] fix log --- main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.js b/main.js index aa3b6d8e..802e058b 100644 --- a/main.js +++ b/main.js @@ -316,7 +316,7 @@ main.prototype.setMainTipsText = function (text) { main.prototype.log = function (e) { if (e) { if (main.core && main.core.platform && !main.core.platform.isPC) { - console.log((e.stack || e.toString()).replace("\n", " --- ")); + console.log((e.stack || e.toString())); } else { console.log(e); From 5cd2613f78300d3f57ab4b5004d2d5cbb50a2edd Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Fri, 22 Feb 2019 18:59:21 +0800 Subject: [PATCH 3/3] Fix moveImage --- libs/events.js | 2 +- libs/maps.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/libs/events.js b/libs/events.js index 3cad299e..27627d6e 100644 --- a/libs/events.js +++ b/libs/events.js @@ -1810,7 +1810,7 @@ events.prototype.moveImage = function (code, to, opacityVal, time, callback) { var animate = setInterval(function () { step++; moveStep(); - if (step > steps) { + if (step == steps) { if (core.isset(opacityVal)) core.setOpacity(name, opacityVal); delete core.animateFrame.asyncId[animate]; diff --git a/libs/maps.js b/libs/maps.js index 3ad953a4..c0ba3b1f 100644 --- a/libs/maps.js +++ b/libs/maps.js @@ -208,13 +208,14 @@ maps.prototype.decompressMap = function (mapArr, floorId) { var mw = core.floors[floorId].width || 13; var mh = core.floors[floorId].height || 13; for (var x=0;x