继续修复高清化

This commit is contained in:
unanmed 2022-12-30 18:41:08 +08:00
parent 045400ecd6
commit 05fe01abfa
2 changed files with 12 additions and 11 deletions

View File

@ -2583,6 +2583,7 @@ maps.prototype._drawThumbnail_drawTempCanvas = function (
if (options.noHD) {
tempCanvas.canvas.width = width * 32 * scale;
tempCanvas.canvas.height = height * 32 * scale;
tempCanvas.canvas.removeAttribute('isHD');
} else
core.resizeCanvas(
tempCanvas,
@ -2591,12 +2592,12 @@ maps.prototype._drawThumbnail_drawTempCanvas = function (
false,
true
);
tempCanvas.scale(scale, scale);
} else if (width * height > core.bigmap.threshold) {
options.v2 = true;
if (options.noHD) {
tempCanvas.canvas.width = core._PX_;
tempCanvas.canvas.height = core._PY_;
tempCanvas.canvas.removeAttribute('isHD');
} else core.resizeCanvas(tempCanvas, core._PX_, core._PY_);
var centerX = options.centerX,
centerY = options.centerY;
@ -2618,6 +2619,7 @@ maps.prototype._drawThumbnail_drawTempCanvas = function (
if (options.noHD) {
tempCanvas.canvas.width = width * 32;
tempCanvas.canvas.height = height * 32;
tempCanvas.canvas.removeAttribute('isHD');
} else
core.resizeCanvas(tempCanvas, width * 32, height * 32, false, true);
}
@ -2756,6 +2758,7 @@ maps.prototype._drawThumbnail_drawToTarget = function (floorId, options) {
hw = hh = core.__HALF_SIZE__;
W = H = core.__SIZE__;
}
const scale = devicePixelRatio * core.domStyle.scale;
if (options.v2) {
if (options.noHD) {
core.drawImage(
@ -2771,7 +2774,6 @@ maps.prototype._drawThumbnail_drawToTarget = function (floorId, options) {
h
);
} else {
const scale = devicePixelRatio * core.domStyle.scale;
core.drawImage(
ctx,
tempCanvas.canvas,
@ -2808,8 +2810,8 @@ maps.prototype._drawThumbnail_drawToTarget = function (floorId, options) {
tempCanvas.canvas,
offsetX * 32,
offsetY * 32,
pw,
ph,
pw * scale,
ph * scale,
x,
y,
w,

View File

@ -2763,10 +2763,9 @@ ui.prototype._drawChoices_getHorizontalPosition = function (
for (var i = 0; i < choices.length; i++) {
if (typeof choices[i] === 'string') choices[i] = { text: choices[i] };
choices[i].text = core.replaceText(choices[i].text);
choices[i].width = core.calWidth(
ctx,
core.replaceText(choices[i].text)
);
choices[i].width =
core.calWidth(ctx, core.replaceText(choices[i].text)) /
devicePixelRatio;
if (choices[i].icon != null) choices[i].width += 28;
width = Math.max(width, choices[i].width + 30);
}
@ -3036,7 +3035,7 @@ ui.prototype.drawConfirmBox = function (text, yesCallback, noCallback, ctx) {
);
core.fillText(ctx, '取消', core._PX_ / 2 + 38, rect.bottom - 35);
if (core.status.event.selection != 'none') {
var len = core.calWidth(ctx, '确定');
var len = core.calWidth(ctx, '确定') / devicePixelRatio;
var strokeLeft =
core._PX_ / 2 +
(76 * core.status.event.selection - 38) -
@ -3519,7 +3518,7 @@ ui.prototype._drawViewMaps = function (index, x, y) {
});
core.clearMap('data');
core.setTextAlign('data', 'left');
core.setFont('data', '16px Arial');
core.setFont('data', '20px normal');
var text = core.status.maps[data.floorId].title;
if (!data.all && (data.mw > core._WIDTH_ || data.mh > core._HEIGHT_))
text +=
@ -3531,7 +3530,7 @@ ui.prototype._drawViewMaps = function (index, x, y) {
if (core.markedFloorIds[data.floorId]) text += ' (已标记)';
var textX = 16,
textY = 18,
width = textX + core.calWidth('data', text) + 16,
width = textX + core.calWidth('data', text) / devicePixelRatio + 16,
height = 42;
core.fillRect('data', 5, 5, width, height, 'rgba(0,0,0,0.4)');
core.fillText('data', text, textX + 5, textY + 15, 'rgba(255,255,255,0.6)');