Merge branch 'v2.0' of https://github.com/ckcz123/mota-js into v2.0

This commit is contained in:
oc 2019-02-25 01:41:22 +08:00
commit 5594f4e76f
4 changed files with 13 additions and 14 deletions

View File

@ -1814,7 +1814,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];

View File

@ -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<mh;x++) {
var floorMap = core.floors.map[x] || [];
if (mapArr[x] === 0) {
mapArr[x] = core.clone(core.floors[floorId].map[x]);
mapArr[x] = floorMap;
}
else {
for (var y=0;y<mw;y++) {
if (mapArr[x][y] === -1) {
mapArr[x][y] = core.floors[floorId].map[x][y];
mapArr[x][y] = floorMap[y] || 0;
}
}
}

View File

@ -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);
}

View File

@ -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);