From eba4aafbfd2f0a629f8315f95818d61278671d77 Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Fri, 7 Dec 2018 15:52:30 +0800 Subject: [PATCH] Adjust to 2.5 lines --- libs/core.js | 4 ++-- libs/ui.js | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/libs/core.js b/libs/core.js index 6d01ebb9..3131844c 100644 --- a/libs/core.js +++ b/libs/core.js @@ -759,8 +759,8 @@ core.prototype.animateBlock = function (loc,type,time,callback) { } ////// 将某个块从禁用变成启用状态 ////// -core.prototype.showBlock = function(x, y, floodId) { - core.maps.showBlock(x,y,floodId); +core.prototype.showBlock = function(x, y, floorId) { + core.maps.showBlock(x,y,floorId); } ////// 将某个块从启用变成禁用状态,但是并不删除它 ////// diff --git a/libs/ui.js b/libs/ui.js index c6067779..5eb60157 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -403,6 +403,9 @@ ui.prototype.calTextBoxWidth = function (canvas, content, min_width, max_width) // 如果不存在手动换行,则二分自动换行 if (allLines.length == 1) { + var w = core.canvas[canvas].measureText(allLines[0]).width; + return core.clamp(w / 2.4, min_width, max_width); + /* var prefer_lines = 3; var start = Math.floor(min_width), end = Math.floor(max_width); while (start < end) { @@ -413,6 +416,7 @@ ui.prototype.calTextBoxWidth = function (canvas, content, min_width, max_width) start = mid + 1; } return mid; + */ } // 存在手动换行:以最长的为准 else {