\b noPeak

This commit is contained in:
ckcz123 2019-12-26 15:47:35 +08:00
parent 18d888a05f
commit 8ba9abc331
2 changed files with 7 additions and 6 deletions

View File

@ -2452,7 +2452,7 @@ control.prototype.updateHeroIcon = function (name) {
// 全身图
var w = core.material.icons.hero.width || 32;
var h = core.material.icons.hero.height || 48;
var ratio = Math.max(w / h, 1), width = 32 * ratio, left = 16 - width/2;
var ratio = Math.min(w / h, 1), width = 32 * ratio, left = 16 - width/2;
var canvas = document.createElement("canvas");
var context = canvas.getContext("2d");

View File

@ -587,7 +587,7 @@ ui.prototype._getTitleAndIcon = function (content) {
////// 正则处理 \b[up,xxx] 问题
ui.prototype._getPosition = function (content) {
var pos = null, px = null, py = null;
var pos = null, px = null, py = null, noPeak = false;
if (core.status.event.id=='action') {
px = core.status.event.data.x;
py = core.status.event.data.y;
@ -614,6 +614,7 @@ ui.prototype._getPosition = function (content) {
} else{
px = parseInt(str[0]);
py = parseInt(str[1]);
noPeak = core.getBlockId(px, py) == null;
}
}
if(pos=='hero' || pos=='null'){
@ -621,7 +622,7 @@ ui.prototype._getPosition = function (content) {
}
return "";
});
return {content: content, position: pos, px: px, py: py};
return {content: content, position: pos, px: px, py: py, noPeak: noPeak};
}
////// 绘制选择光标
@ -719,8 +720,8 @@ ui.prototype.drawWindowSkin = function(background, ctx, x, y, w, h, direction, p
////// 绘制一个背景图,可绘制 winskin 或纯色背景;支持小箭头绘制
ui.prototype.drawBackground = function (left, top, right, bottom, posInfo) {
posInfo = posInfo || {};
var px = posInfo.px == null ? null : posInfo.px * 32 - core.bigmap.offsetX;
var py = posInfo.py == null ? null : posInfo.py * 32 - core.bigmap.offsetY;
var px = posInfo.px == null || posInfo.noPeak ? null : posInfo.px * 32 - core.bigmap.offsetX;
var py = posInfo.py == null || posInfo.noPeak ? null : posInfo.py * 32 - core.bigmap.offsetY;
var xoffset = posInfo.xoffset || 0, yoffset = posInfo.yoffset || 0;
var background = core.status.textAttribute.background;
@ -1114,7 +1115,7 @@ ui.prototype.drawTextBox = function(content, showAll) {
main.dom.next.style.borderRightColor = main.dom.next.style.borderBottomColor = core.arrayToRGB(textAttribute.text);
main.dom.next.style.top = (vPos.bottom - 20) * core.domStyle.scale + "px";
var left = (hPos.left + hPos.right) / 2;
if (pInfo.position == 'up' && pInfo.px != null && Math.abs(pInfo.px * 32 + 16 - left) < 50)
if (pInfo.position == 'up' && !pInfo.noPeak && pInfo.px != null && Math.abs(pInfo.px * 32 + 16 - left) < 50)
left = hPos.right - 64;
main.dom.next.style.left = left * core.domStyle.scale + "px";
return config;