选项框细节调整

This commit is contained in:
dljgs1 2019-04-12 23:17:22 +08:00
parent eb108f8f7c
commit 98574e3d68
2 changed files with 12 additions and 1 deletions

View File

@ -779,6 +779,7 @@ actions.prototype._sys_longClick = function (x, y, fromEvent) {
actions.prototype._selectChoices = function (length, keycode, callback) {
var topIndex = this.HSIZE - parseInt((length - 1) / 2);
if (keycode == 13 || keycode == 32 || keycode == 67) {
core.status.event.ui.sep = 0;
callback.apply(this, [this.HSIZE, topIndex + core.status.event.selection]);
}
if (keycode >= 49 && keycode <= 57) {
@ -883,7 +884,7 @@ actions.prototype._clickAction = function (x, y) {
var choices = data.choices;
if (choices.length == 0) return;
if (x >= this.CHOICES_LEFT && x <= this.CHOICES_RIGHT) {
var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2);
var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2) + (core.status.event.ui.sep || 0);
if (y >= topIndex && y < topIndex + choices.length) {
// 选择
core.status.route.push("choices:" + (y - topIndex));

View File

@ -555,6 +555,10 @@ ui.prototype._calTextBoxWidth = function (ctx, content, min_width, max_width, fo
////// 处理 \i[xxx] 的问题
ui.prototype._getDrawableIconInfo = function (id) {
var splt = id.split(':');
if (splt[0] == 'flag' && splt.length > 1) { // 使用变量表示图标
id = core.getFlag(splt[1], id);
}
var image = null, icon = null;
["terrains","animates","items","npcs","enemys"].forEach(function (v) {
if (core.material.icons[v][id] != null) {
@ -1005,6 +1009,12 @@ ui.prototype._drawChoices_getVerticalPosition = function (titleInfo, choices, hP
if (titleInfo.title) height += 25;
height += lines.length * 20;
}
if(bottom-height<0){
var sep = Math.ceil((height-bottom)/32);
choice_top += sep * 32;
bottom += sep*32;
core.status.event.ui.sep = sep;
}
return {top: bottom - height, height: height, bottom: bottom, choice_top: choice_top };
}