commit
82577b2fe9
21
libs/maps.js
21
libs/maps.js
@ -2561,25 +2561,20 @@ maps.prototype._drawAnimateFrame = function (name, animate, centerX, centerY, in
|
|||||||
frame.forEach(function (t) {
|
frame.forEach(function (t) {
|
||||||
var image = animate.images[t.index];
|
var image = animate.images[t.index];
|
||||||
if (!image) return;
|
if (!image) return;
|
||||||
|
|
||||||
var realWidth = image.width * ratio * t.zoom / 100;
|
var realWidth = image.width * ratio * t.zoom / 100;
|
||||||
var realHeight = image.height * ratio * t.zoom / 100;
|
var realHeight = image.height * ratio * t.zoom / 100;
|
||||||
core.setAlpha(ctx, t.opacity / 255);
|
core.setAlpha(ctx, t.opacity / 255);
|
||||||
|
|
||||||
var cx = centerX + t.x, cy = centerY + t.y;
|
var cx = centerX + t.x, cy = centerY + t.y;
|
||||||
|
|
||||||
if (!t.mirror && !t.angle) {
|
var ix = cx - realWidth / 2 - core.bigmap.offsetX,
|
||||||
core.drawImage(ctx, image, cx - realWidth / 2 - core.bigmap.offsetX, cy - realHeight / 2 - core.bigmap.offsetY, realWidth, realHeight);
|
iy = cy - realHeight / 2 - core.bigmap.offsetY;
|
||||||
}
|
|
||||||
else {
|
var mirror = t.mirror ? 'x' : null;
|
||||||
core.saveCanvas(ctx);
|
var angle = t.angle ? -t.angle * Math.PI / 180 : null;
|
||||||
ctx.translate(cx, cy);
|
core.drawImage(ctx, image, ix, iy, realWidth, realHeight, null, null, null, null, angle, mirror);
|
||||||
if (t.angle)
|
|
||||||
ctx.rotate(-t.angle * Math.PI / 180);
|
|
||||||
if (t.mirror)
|
|
||||||
ctx.scale(-1, 1);
|
|
||||||
core.drawImage(ctx, image, -realWidth / 2 - core.bigmap.offsetX, -realHeight / 2 - core.bigmap.offsetY, realWidth, realHeight);
|
|
||||||
core.loadCanvas(ctx);
|
|
||||||
}
|
|
||||||
core.setAlpha(ctx, 1);
|
core.setAlpha(ctx, 1);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -538,11 +538,11 @@ ui.prototype.splitLines = function (name, text, maxWidth, font) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
////// 绘制一张图片 //////
|
////// 绘制一张图片 //////
|
||||||
ui.prototype.drawImage = function (name, image, x, y, w, h, x1, y1, w1, h1, angle) {
|
ui.prototype.drawImage = function (name, image, x, y, w, h, x1, y1, w1, h1, angle, reverse) {
|
||||||
// 检测文件名以 :x, :y, :o 结尾,表示左右翻转,上下翻转和中心翻转
|
// 检测文件名以 :x, :y, :o 结尾,表示左右翻转,上下翻转和中心翻转
|
||||||
var ctx = this.getContextByName(name);
|
var ctx = this.getContextByName(name);
|
||||||
if (!ctx) return;
|
if (!ctx) return;
|
||||||
var reverse = null;
|
// var reverse = null;
|
||||||
if (typeof image == 'string') {
|
if (typeof image == 'string') {
|
||||||
if (image.endsWith(':x') || image.endsWith(':y') || image.endsWith(':o')) {
|
if (image.endsWith(':x') || image.endsWith(':y') || image.endsWith(':o')) {
|
||||||
reverse = image.charAt(image.length - 1);
|
reverse = image.charAt(image.length - 1);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user