mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-01-19 04:19:30 +08:00
完善高清化
This commit is contained in:
parent
d7bc60cdd2
commit
8f6df7bee8
@ -754,7 +754,7 @@ control.prototype._setAutomaticRoute_drawRoute = function (moveStep) {
|
|||||||
);
|
);
|
||||||
ctx.fillStyle = '#bfbfbf';
|
ctx.fillStyle = '#bfbfbf';
|
||||||
ctx.strokeStyle = '#bfbfbf';
|
ctx.strokeStyle = '#bfbfbf';
|
||||||
ctx.lineWidth = 8 * devicePixelRatio;
|
ctx.lineWidth = 8;
|
||||||
for (var m = 0; m < moveStep.length; m++) {
|
for (var m = 0; m < moveStep.length; m++) {
|
||||||
if (m == moveStep.length - 1) {
|
if (m == moveStep.length - 1) {
|
||||||
core.fillRect(
|
core.fillRect(
|
||||||
@ -771,13 +771,13 @@ control.prototype._setAutomaticRoute_drawRoute = function (moveStep) {
|
|||||||
var currDir = moveStep[m].direction,
|
var currDir = moveStep[m].direction,
|
||||||
nextDir = moveStep[m + 1].direction;
|
nextDir = moveStep[m + 1].direction;
|
||||||
ctx.moveTo(
|
ctx.moveTo(
|
||||||
(cx - core.utils.scan[currDir].x * 11) * devicePixelRatio,
|
cx - core.utils.scan[currDir].x * 11,
|
||||||
(cy - core.utils.scan[currDir].y * 11) * devicePixelRatio
|
cy - core.utils.scan[currDir].y * 11
|
||||||
);
|
);
|
||||||
ctx.lineTo(cx * devicePixelRatio, cy * devicePixelRatio);
|
ctx.lineTo(cx, cy);
|
||||||
ctx.lineTo(
|
ctx.lineTo(
|
||||||
(cx + core.utils.scan[nextDir].x * 11) * devicePixelRatio,
|
cx + core.utils.scan[nextDir].x * 11,
|
||||||
(cy + core.utils.scan[nextDir].y * 11) * devicePixelRatio
|
cy + core.utils.scan[nextDir].y * 11
|
||||||
);
|
);
|
||||||
ctx.stroke();
|
ctx.stroke();
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ maps.prototype._setHDCanvasSize = function (ctx, width, height, isTempCanvas) {
|
|||||||
if (isTempCanvas) ratio = core.domStyle.ratio;
|
if (isTempCanvas) ratio = core.domStyle.ratio;
|
||||||
if (width != null) ctx.canvas.width = width * ratio * devicePixelRatio;
|
if (width != null) ctx.canvas.width = width * ratio * devicePixelRatio;
|
||||||
if (height != null) ctx.canvas.height = height * ratio * devicePixelRatio;
|
if (height != null) ctx.canvas.height = height * ratio * devicePixelRatio;
|
||||||
ctx.scale(ratio, ratio);
|
ctx.scale(ratio * devicePixelRatio, ratio * devicePixelRatio);
|
||||||
ctx.canvas.setAttribute('isHD', 1);
|
ctx.canvas.setAttribute('isHD', 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -640,8 +640,8 @@ maps.prototype.resizeMap = function (floorId) {
|
|||||||
core.canvas[cn].canvas.style.height =
|
core.canvas[cn].canvas.style.height =
|
||||||
height * core.domStyle.scale + 'px';
|
height * core.domStyle.scale + 'px';
|
||||||
core.canvas[cn].translate(
|
core.canvas[cn].translate(
|
||||||
core.bigmap.v2 ? 32 * devicePixelRatio : 0,
|
core.bigmap.v2 ? 32 : 0,
|
||||||
core.bigmap.v2 ? 32 * devicePixelRatio : 0
|
core.bigmap.v2 ? 32 : 0
|
||||||
);
|
);
|
||||||
if (main.mode === 'editor' && editor.isMobile) {
|
if (main.mode === 'editor' && editor.isMobile) {
|
||||||
core.canvas[cn].canvas.style.width =
|
core.canvas[cn].canvas.style.width =
|
||||||
@ -2578,20 +2578,13 @@ maps.prototype._drawThumbnail_drawTempCanvas = function (
|
|||||||
|
|
||||||
// 如果是大地图模式?
|
// 如果是大地图模式?
|
||||||
if (options.all) {
|
if (options.all) {
|
||||||
// 计算比例
|
|
||||||
var scale = Math.max(core._WIDTH_ / width, core._HEIGHT_ / height);
|
|
||||||
if (options.noHD) {
|
if (options.noHD) {
|
||||||
tempCanvas.canvas.width = width * 32 * scale;
|
tempCanvas.canvas.width = width * 32;
|
||||||
tempCanvas.canvas.height = height * 32 * scale;
|
tempCanvas.canvas.height = height * 32;
|
||||||
tempCanvas.canvas.removeAttribute('isHD');
|
tempCanvas.canvas.removeAttribute('isHD');
|
||||||
} else
|
} else {
|
||||||
core.resizeCanvas(
|
core.resizeCanvas(tempCanvas, width * 32, height * 32, false, true);
|
||||||
tempCanvas,
|
}
|
||||||
width * 32 * scale,
|
|
||||||
height * 32 * scale,
|
|
||||||
false,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
} else if (width * height > core.bigmap.threshold) {
|
} else if (width * height > core.bigmap.threshold) {
|
||||||
options.v2 = true;
|
options.v2 = true;
|
||||||
if (options.noHD) {
|
if (options.noHD) {
|
||||||
@ -2704,6 +2697,7 @@ maps.prototype._drawThumbnail_drawToTarget = function (floorId, options) {
|
|||||||
if (centerY == null) centerY = Math.floor(height / 2);
|
if (centerY == null) centerY = Math.floor(height / 2);
|
||||||
var tempCanvas = core.bigmap.tempCanvas;
|
var tempCanvas = core.bigmap.tempCanvas;
|
||||||
|
|
||||||
|
const scale = core.domStyle.scale * devicePixelRatio;
|
||||||
if (options.all) {
|
if (options.all) {
|
||||||
var tempWidth = tempCanvas.canvas.width,
|
var tempWidth = tempCanvas.canvas.width,
|
||||||
tempHeight = tempCanvas.canvas.height;
|
tempHeight = tempCanvas.canvas.height;
|
||||||
@ -2758,7 +2752,6 @@ maps.prototype._drawThumbnail_drawToTarget = function (floorId, options) {
|
|||||||
hw = hh = core.__HALF_SIZE__;
|
hw = hh = core.__HALF_SIZE__;
|
||||||
W = H = core.__SIZE__;
|
W = H = core.__SIZE__;
|
||||||
}
|
}
|
||||||
const scale = devicePixelRatio * core.domStyle.scale;
|
|
||||||
if (options.v2) {
|
if (options.v2) {
|
||||||
if (options.noHD) {
|
if (options.noHD) {
|
||||||
core.drawImage(
|
core.drawImage(
|
||||||
|
@ -60,12 +60,6 @@ ui.prototype.clearMap = function (name, x, y, width, height) {
|
|||||||
var ctx = this.getContextByName(name);
|
var ctx = this.getContextByName(name);
|
||||||
if (ctx) {
|
if (ctx) {
|
||||||
if (x != null && y != null && width != null && height != null) {
|
if (x != null && y != null && width != null && height != null) {
|
||||||
if (ctx.canvas.getAttribute('isHD') === '1') {
|
|
||||||
x *= devicePixelRatio;
|
|
||||||
y *= devicePixelRatio;
|
|
||||||
width *= devicePixelRatio;
|
|
||||||
height *= devicePixelRatio;
|
|
||||||
}
|
|
||||||
ctx.clearRect(x, y, width, height);
|
ctx.clearRect(x, y, width, height);
|
||||||
} else {
|
} else {
|
||||||
ctx.clearRect(
|
ctx.clearRect(
|
||||||
@ -106,10 +100,6 @@ ui.prototype.fillText = function (name, text, x, y, style, font, maxWidth) {
|
|||||||
if (font) core.setFont(name, font);
|
if (font) core.setFont(name, font);
|
||||||
var ctx = this.getContextByName(name);
|
var ctx = this.getContextByName(name);
|
||||||
if (!ctx) return;
|
if (!ctx) return;
|
||||||
if (ctx.canvas.getAttribute('isHD') === '1') {
|
|
||||||
x *= devicePixelRatio;
|
|
||||||
y *= devicePixelRatio;
|
|
||||||
}
|
|
||||||
text = (text + '').replace(/\\r/g, '\r');
|
text = (text + '').replace(/\\r/g, '\r');
|
||||||
var originText = text.replace(/\r(\[.*\])?/g, '');
|
var originText = text.replace(/\r(\[.*\])?/g, '');
|
||||||
var index = text.indexOf('\r');
|
var index = text.indexOf('\r');
|
||||||
@ -182,10 +172,6 @@ ui.prototype.fillBoldText = function (
|
|||||||
if (!ctx) return;
|
if (!ctx) return;
|
||||||
if (font) ctx.font = font;
|
if (font) ctx.font = font;
|
||||||
if (!style) style = ctx.fillStyle;
|
if (!style) style = ctx.fillStyle;
|
||||||
if (ctx.canvas.getAttribute('isHD') === '1') {
|
|
||||||
x *= devicePixelRatio;
|
|
||||||
y *= devicePixelRatio;
|
|
||||||
}
|
|
||||||
style = core.arrayToRGBA(style);
|
style = core.arrayToRGBA(style);
|
||||||
strokeStyle ??= '#000';
|
strokeStyle ??= '#000';
|
||||||
strokeStyle = core.arrayToRGBA(strokeStyle);
|
strokeStyle = core.arrayToRGBA(strokeStyle);
|
||||||
@ -195,8 +181,7 @@ ui.prototype.fillBoldText = function (
|
|||||||
ctx.strokeStyle = strokeStyle;
|
ctx.strokeStyle = strokeStyle;
|
||||||
ctx.lineWidth =
|
ctx.lineWidth =
|
||||||
1 *
|
1 *
|
||||||
(core.domStyle.isVertical ? core.domStyle.ratio : core.domStyle.scale) *
|
(core.domStyle.isVertical ? core.domStyle.ratio : core.domStyle.scale);
|
||||||
devicePixelRatio;
|
|
||||||
ctx.fillStyle = style;
|
ctx.fillStyle = style;
|
||||||
ctx.strokeText(text, x, y);
|
ctx.strokeText(text, x, y);
|
||||||
ctx.fillText(text, x, y);
|
ctx.fillText(text, x, y);
|
||||||
@ -220,12 +205,6 @@ ui.prototype.fillRect = function (name, x, y, width, height, style, angle) {
|
|||||||
if (style) core.setFillStyle(name, style);
|
if (style) core.setFillStyle(name, style);
|
||||||
var ctx = this.getContextByName(name);
|
var ctx = this.getContextByName(name);
|
||||||
if (ctx) {
|
if (ctx) {
|
||||||
if (ctx.canvas.getAttribute('isHD') === '1') {
|
|
||||||
x *= devicePixelRatio;
|
|
||||||
y *= devicePixelRatio;
|
|
||||||
width *= devicePixelRatio;
|
|
||||||
height *= devicePixelRatio;
|
|
||||||
}
|
|
||||||
if (angle) {
|
if (angle) {
|
||||||
ctx.save();
|
ctx.save();
|
||||||
ctx.translate(x + width / 2, y + height / 2);
|
ctx.translate(x + width / 2, y + height / 2);
|
||||||
@ -280,12 +259,6 @@ ui.prototype.strokeRect = function (
|
|||||||
if (lineWidth) core.setLineWidth(name, lineWidth);
|
if (lineWidth) core.setLineWidth(name, lineWidth);
|
||||||
var ctx = this.getContextByName(name);
|
var ctx = this.getContextByName(name);
|
||||||
if (ctx) {
|
if (ctx) {
|
||||||
if (ctx.canvas.getAttribute('isHD') === '1') {
|
|
||||||
x *= devicePixelRatio;
|
|
||||||
y *= devicePixelRatio;
|
|
||||||
width *= devicePixelRatio;
|
|
||||||
height *= devicePixelRatio;
|
|
||||||
}
|
|
||||||
if (angle) {
|
if (angle) {
|
||||||
ctx.save();
|
ctx.save();
|
||||||
ctx.translate(x + width / 2, y + height / 2);
|
ctx.translate(x + width / 2, y + height / 2);
|
||||||
@ -341,13 +314,6 @@ ui.prototype.fillRoundRect = function (
|
|||||||
if (style) core.setFillStyle(name, style);
|
if (style) core.setFillStyle(name, style);
|
||||||
var ctx = this.getContextByName(name);
|
var ctx = this.getContextByName(name);
|
||||||
if (ctx) {
|
if (ctx) {
|
||||||
if (ctx.canvas.getAttribute('isHD') === '1') {
|
|
||||||
x *= devicePixelRatio;
|
|
||||||
y *= devicePixelRatio;
|
|
||||||
width *= devicePixelRatio;
|
|
||||||
height *= devicePixelRatio;
|
|
||||||
radius *= devicePixelRatio;
|
|
||||||
}
|
|
||||||
if (angle) {
|
if (angle) {
|
||||||
ctx.save();
|
ctx.save();
|
||||||
ctx.translate(x + width / 2, y + height / 2);
|
ctx.translate(x + width / 2, y + height / 2);
|
||||||
@ -378,13 +344,6 @@ ui.prototype.strokeRoundRect = function (
|
|||||||
if (lineWidth) core.setLineWidth(name, lineWidth);
|
if (lineWidth) core.setLineWidth(name, lineWidth);
|
||||||
var ctx = this.getContextByName(name);
|
var ctx = this.getContextByName(name);
|
||||||
if (ctx) {
|
if (ctx) {
|
||||||
if (ctx.canvas.getAttribute('isHD') === '1') {
|
|
||||||
x *= devicePixelRatio;
|
|
||||||
y *= devicePixelRatio;
|
|
||||||
width *= devicePixelRatio;
|
|
||||||
height *= devicePixelRatio;
|
|
||||||
radius *= devicePixelRatio;
|
|
||||||
}
|
|
||||||
if (angle) {
|
if (angle) {
|
||||||
ctx.save();
|
ctx.save();
|
||||||
ctx.translate(x + width / 2, y + height / 2);
|
ctx.translate(x + width / 2, y + height / 2);
|
||||||
@ -425,12 +384,6 @@ ui.prototype.fillPolygon = function (name, nodes, style) {
|
|||||||
if (style) core.setFillStyle(name, style);
|
if (style) core.setFillStyle(name, style);
|
||||||
var ctx = this.getContextByName(name);
|
var ctx = this.getContextByName(name);
|
||||||
if (!ctx) return;
|
if (!ctx) return;
|
||||||
if (ctx.canvas.getAttribute('isHD') === '1') {
|
|
||||||
nodes = nodes.map(([x, y]) => [
|
|
||||||
x * devicePixelRatio,
|
|
||||||
y * devicePixelRatio
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
if (!nodes || nodes.length < 3) return;
|
if (!nodes || nodes.length < 3) return;
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
for (var i = 0; i < nodes.length; ++i) {
|
for (var i = 0; i < nodes.length; ++i) {
|
||||||
@ -454,12 +407,6 @@ ui.prototype.strokePolygon = function (name, nodes, style, lineWidth) {
|
|||||||
if (lineWidth) core.setLineWidth(name, lineWidth);
|
if (lineWidth) core.setLineWidth(name, lineWidth);
|
||||||
var ctx = this.getContextByName(name);
|
var ctx = this.getContextByName(name);
|
||||||
if (!ctx) return;
|
if (!ctx) return;
|
||||||
if (ctx.canvas.getAttribute('isHD') === '1') {
|
|
||||||
nodes = nodes.map(([x, y]) => [
|
|
||||||
x * devicePixelRatio,
|
|
||||||
y * devicePixelRatio
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
if (!nodes || nodes.length < 3) return;
|
if (!nodes || nodes.length < 3) return;
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
for (var i = 0; i < nodes.length; ++i) {
|
for (var i = 0; i < nodes.length; ++i) {
|
||||||
@ -482,12 +429,6 @@ ui.prototype.fillEllipse = function (name, x, y, a, b, angle, style) {
|
|||||||
if (style) core.setFillStyle(name, style);
|
if (style) core.setFillStyle(name, style);
|
||||||
var ctx = this.getContextByName(name);
|
var ctx = this.getContextByName(name);
|
||||||
if (!ctx) return;
|
if (!ctx) return;
|
||||||
if (ctx.canvas.getAttribute('isHD') === '1') {
|
|
||||||
x *= devicePixelRatio;
|
|
||||||
y *= devicePixelRatio;
|
|
||||||
a *= devicePixelRatio;
|
|
||||||
b *= devicePixelRatio;
|
|
||||||
}
|
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.ellipse(x, y, a, b, angle, 0, 2 * Math.PI);
|
ctx.ellipse(x, y, a, b, angle, 0, 2 * Math.PI);
|
||||||
ctx.fill();
|
ctx.fill();
|
||||||
@ -525,12 +466,6 @@ ui.prototype.strokeEllipse = function (
|
|||||||
if (lineWidth) core.setLineWidth(name, lineWidth);
|
if (lineWidth) core.setLineWidth(name, lineWidth);
|
||||||
var ctx = this.getContextByName(name);
|
var ctx = this.getContextByName(name);
|
||||||
if (!ctx) return;
|
if (!ctx) return;
|
||||||
if (ctx.canvas.getAttribute('isHD') === '1') {
|
|
||||||
x *= devicePixelRatio;
|
|
||||||
y *= devicePixelRatio;
|
|
||||||
a *= devicePixelRatio;
|
|
||||||
b *= devicePixelRatio;
|
|
||||||
}
|
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.ellipse(x, y, a, b, angle, 0, 2 * Math.PI);
|
ctx.ellipse(x, y, a, b, angle, 0, 2 * Math.PI);
|
||||||
ctx.stroke();
|
ctx.stroke();
|
||||||
@ -558,11 +493,6 @@ ui.prototype.fillArc = function (name, x, y, r, start, end, style) {
|
|||||||
if (style) core.setFillStyle(name, style);
|
if (style) core.setFillStyle(name, style);
|
||||||
var ctx = this.getContextByName(name);
|
var ctx = this.getContextByName(name);
|
||||||
if (!ctx) return;
|
if (!ctx) return;
|
||||||
if (ctx.canvas.getAttribute('isHD') === '1') {
|
|
||||||
x *= devicePixelRatio;
|
|
||||||
y *= devicePixelRatio;
|
|
||||||
r *= devicePixelRatio;
|
|
||||||
}
|
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.moveTo(x, y);
|
ctx.moveTo(x, y);
|
||||||
ctx.arc(x, y, r, start, end);
|
ctx.arc(x, y, r, start, end);
|
||||||
@ -597,11 +527,6 @@ ui.prototype.strokeArc = function (
|
|||||||
if (lineWidth) core.setLineWidth(name, lineWidth);
|
if (lineWidth) core.setLineWidth(name, lineWidth);
|
||||||
var ctx = this.getContextByName(name);
|
var ctx = this.getContextByName(name);
|
||||||
if (!ctx) return;
|
if (!ctx) return;
|
||||||
if (ctx.canvas.getAttribute('isHD') === '1') {
|
|
||||||
x *= devicePixelRatio;
|
|
||||||
y *= devicePixelRatio;
|
|
||||||
r *= devicePixelRatio;
|
|
||||||
}
|
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.arc(x, y, r, start, end);
|
ctx.arc(x, y, r, start, end);
|
||||||
ctx.stroke();
|
ctx.stroke();
|
||||||
@ -627,12 +552,6 @@ ui.prototype.drawLine = function (name, x1, y1, x2, y2, style, lineWidth) {
|
|||||||
if (lineWidth != null) core.setLineWidth(name, lineWidth);
|
if (lineWidth != null) core.setLineWidth(name, lineWidth);
|
||||||
var ctx = this.getContextByName(name);
|
var ctx = this.getContextByName(name);
|
||||||
if (!ctx) return;
|
if (!ctx) return;
|
||||||
if (ctx.canvas.getAttribute('isHD') === '1') {
|
|
||||||
x1 *= devicePixelRatio;
|
|
||||||
y1 *= devicePixelRatio;
|
|
||||||
x2 *= devicePixelRatio;
|
|
||||||
y2 *= devicePixelRatio;
|
|
||||||
}
|
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.moveTo(x1, y1);
|
ctx.moveTo(x1, y1);
|
||||||
ctx.lineTo(x2, y2);
|
ctx.lineTo(x2, y2);
|
||||||
@ -659,12 +578,6 @@ ui.prototype.drawArrow = function (name, x1, y1, x2, y2, style, lineWidth) {
|
|||||||
if (lineWidth != null) core.setLineWidth(name, lineWidth);
|
if (lineWidth != null) core.setLineWidth(name, lineWidth);
|
||||||
var ctx = this.getContextByName(name);
|
var ctx = this.getContextByName(name);
|
||||||
if (!ctx) return;
|
if (!ctx) return;
|
||||||
if (ctx.canvas.getAttribute('isHD') === '1') {
|
|
||||||
x1 *= devicePixelRatio;
|
|
||||||
y1 *= devicePixelRatio;
|
|
||||||
x2 *= devicePixelRatio;
|
|
||||||
y2 *= devicePixelRatio;
|
|
||||||
}
|
|
||||||
var head = 10;
|
var head = 10;
|
||||||
var dx = x2 - x1,
|
var dx = x2 - x1,
|
||||||
dy = y2 - y1;
|
dy = y2 - y1;
|
||||||
@ -705,11 +618,6 @@ ui.prototype._uievent_drawArrow = function (data) {
|
|||||||
ui.prototype.setFont = function (name, font) {
|
ui.prototype.setFont = function (name, font) {
|
||||||
var ctx = this.getContextByName(name);
|
var ctx = this.getContextByName(name);
|
||||||
if (ctx) {
|
if (ctx) {
|
||||||
if (ctx.canvas.getAttribute('isHD') === '1') {
|
|
||||||
font = font.replace(/(\d+)(px|em|vh|vw)/, (str, $1, $2) => {
|
|
||||||
return `${parseFloat($1) * devicePixelRatio}${$2}`;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
ctx.font = font;
|
ctx.font = font;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -718,9 +626,6 @@ ui.prototype.setFont = function (name, font) {
|
|||||||
ui.prototype.setLineWidth = function (name, lineWidth) {
|
ui.prototype.setLineWidth = function (name, lineWidth) {
|
||||||
var ctx = this.getContextByName(name);
|
var ctx = this.getContextByName(name);
|
||||||
if (ctx) {
|
if (ctx) {
|
||||||
if (ctx.canvas.getAttribute('isHD') === '1') {
|
|
||||||
lineWidth *= devicePixelRatio;
|
|
||||||
}
|
|
||||||
ctx.lineWidth = lineWidth;
|
ctx.lineWidth = lineWidth;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -904,12 +809,6 @@ ui.prototype.drawImage = function (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (x1 != null && y1 != null && w1 != null && h1 != null) {
|
if (x1 != null && y1 != null && w1 != null && h1 != null) {
|
||||||
if (ctx.canvas.getAttribute('isHD') === '1') {
|
|
||||||
x1 *= devicePixelRatio;
|
|
||||||
y1 *= devicePixelRatio;
|
|
||||||
w1 *= devicePixelRatio;
|
|
||||||
h1 *= devicePixelRatio;
|
|
||||||
}
|
|
||||||
if (!reverse && !angle) {
|
if (!reverse && !angle) {
|
||||||
ctx.drawImage(image, x, y, w, h, x1, y1, w1, h1);
|
ctx.drawImage(image, x, y, w, h, x1, y1, w1, h1);
|
||||||
} else {
|
} else {
|
||||||
@ -922,12 +821,6 @@ ui.prototype.drawImage = function (
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ctx.canvas.getAttribute('isHD') === '1') {
|
|
||||||
x *= devicePixelRatio;
|
|
||||||
y *= devicePixelRatio;
|
|
||||||
w *= devicePixelRatio;
|
|
||||||
h *= devicePixelRatio;
|
|
||||||
}
|
|
||||||
if (!reverse && !angle) {
|
if (!reverse && !angle) {
|
||||||
ctx.drawImage(image, x, y, w, h);
|
ctx.drawImage(image, x, y, w, h);
|
||||||
} else {
|
} else {
|
||||||
@ -1054,9 +947,7 @@ ui.prototype.drawTip = function (text, id, frame) {
|
|||||||
var one = {
|
var one = {
|
||||||
text: text,
|
text: text,
|
||||||
textX: 21,
|
textX: 21,
|
||||||
width:
|
width: 26 + core.calWidth('data', realText, '16px Arial'),
|
||||||
26 +
|
|
||||||
core.calWidth('data', realText, '16px Arial') / devicePixelRatio,
|
|
||||||
opacity: 0.1,
|
opacity: 0.1,
|
||||||
stage: 1,
|
stage: 1,
|
||||||
frame: frame || 0,
|
frame: frame || 0,
|
||||||
@ -1748,7 +1639,7 @@ ui.prototype._buildFont = function (fontSize, bold, italic, font, isHD) {
|
|||||||
return (
|
return (
|
||||||
(bold ? 'bold ' : '') +
|
(bold ? 'bold ' : '') +
|
||||||
(italic ? 'italic ' : '') +
|
(italic ? 'italic ' : '') +
|
||||||
(fontSize || textAttribute.textfont) * (isHD ? devicePixelRatio : 1) +
|
(fontSize || textAttribute.textfont) +
|
||||||
'px ' +
|
'px ' +
|
||||||
(font || globalAttribute.font)
|
(font || globalAttribute.font)
|
||||||
);
|
);
|
||||||
@ -1817,8 +1708,7 @@ ui.prototype.drawTextContent = function (ctx, content, config) {
|
|||||||
config.fontSize,
|
config.fontSize,
|
||||||
config.bold,
|
config.bold,
|
||||||
config.italic,
|
config.italic,
|
||||||
config.font,
|
config.font
|
||||||
config.isHD
|
|
||||||
);
|
);
|
||||||
tempCtx.fillStyle = config.color;
|
tempCtx.fillStyle = config.color;
|
||||||
config = this._drawTextContent_draw(ctx, tempCtx, content, config);
|
config = this._drawTextContent_draw(ctx, tempCtx, content, config);
|
||||||
@ -1848,14 +1738,16 @@ ui.prototype._drawTextContent_draw = function (ctx, tempCtx, content, config) {
|
|||||||
if (config.index >= config.blocks.length) return false;
|
if (config.index >= config.blocks.length) return false;
|
||||||
var block = config.blocks[config.index++];
|
var block = config.blocks[config.index++];
|
||||||
if (block != null) {
|
if (block != null) {
|
||||||
var ratio = config.isHD ? core.domStyle.ratio : 1;
|
const scale = config.isHD
|
||||||
|
? devicePixelRatio * core.domStyle.scale
|
||||||
|
: 1;
|
||||||
core.drawImage(
|
core.drawImage(
|
||||||
ctx,
|
ctx,
|
||||||
tempCtx.canvas,
|
tempCtx.canvas,
|
||||||
block.left * ratio * devicePixelRatio,
|
block.left * scale,
|
||||||
block.top * ratio * devicePixelRatio,
|
block.top * scale,
|
||||||
block.width * ratio * devicePixelRatio,
|
block.width * scale,
|
||||||
block.height * ratio * devicePixelRatio,
|
block.height * scale,
|
||||||
config.left + block.left + block.marginLeft,
|
config.left + block.left + block.marginLeft,
|
||||||
config.top + block.top + block.marginTop,
|
config.top + block.top + block.marginTop,
|
||||||
block.width,
|
block.width,
|
||||||
@ -1937,8 +1829,7 @@ ui.prototype._drawTextContent_drawChar = function (
|
|||||||
config.currfont,
|
config.currfont,
|
||||||
config.bold,
|
config.bold,
|
||||||
config.italic,
|
config.italic,
|
||||||
config.font,
|
config.font
|
||||||
config.isHD
|
|
||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1948,9 +1839,7 @@ ui.prototype._drawTextContent_drawChar = function (
|
|||||||
return this._drawTextContent_emptyChar(tempCtx, content, config);
|
return this._drawTextContent_emptyChar(tempCtx, content, config);
|
||||||
}
|
}
|
||||||
// 检查是不是自动换行
|
// 检查是不是自动换行
|
||||||
var charwidth =
|
var charwidth = core.calWidth(tempCtx, ch) + config.letterSpacing;
|
||||||
core.calWidth(tempCtx, ch) / (config.isHD ? devicePixelRatio : 1) +
|
|
||||||
config.letterSpacing;
|
|
||||||
if (config.maxWidth != null) {
|
if (config.maxWidth != null) {
|
||||||
if (config.offsetX + charwidth > config.maxWidth) {
|
if (config.offsetX + charwidth > config.maxWidth) {
|
||||||
// --- 当前应当换行,然而还是检查一下是否是forbidStart
|
// --- 当前应当换行,然而还是检查一下是否是forbidStart
|
||||||
@ -2763,9 +2652,10 @@ ui.prototype._drawChoices_getHorizontalPosition = function (
|
|||||||
for (var i = 0; i < choices.length; i++) {
|
for (var i = 0; i < choices.length; i++) {
|
||||||
if (typeof choices[i] === 'string') choices[i] = { text: choices[i] };
|
if (typeof choices[i] === 'string') choices[i] = { text: choices[i] };
|
||||||
choices[i].text = core.replaceText(choices[i].text);
|
choices[i].text = core.replaceText(choices[i].text);
|
||||||
choices[i].width =
|
choices[i].width = core.calWidth(
|
||||||
core.calWidth(ctx, core.replaceText(choices[i].text)) /
|
ctx,
|
||||||
devicePixelRatio;
|
core.replaceText(choices[i].text)
|
||||||
|
);
|
||||||
if (choices[i].icon != null) choices[i].width += 28;
|
if (choices[i].icon != null) choices[i].width += 28;
|
||||||
width = Math.max(width, choices[i].width + 30);
|
width = Math.max(width, choices[i].width + 30);
|
||||||
}
|
}
|
||||||
@ -3035,7 +2925,7 @@ ui.prototype.drawConfirmBox = function (text, yesCallback, noCallback, ctx) {
|
|||||||
);
|
);
|
||||||
core.fillText(ctx, '取消', core._PX_ / 2 + 38, rect.bottom - 35);
|
core.fillText(ctx, '取消', core._PX_ / 2 + 38, rect.bottom - 35);
|
||||||
if (core.status.event.selection != 'none') {
|
if (core.status.event.selection != 'none') {
|
||||||
var len = core.calWidth(ctx, '确定') / devicePixelRatio;
|
var len = core.calWidth(ctx, '确定');
|
||||||
var strokeLeft =
|
var strokeLeft =
|
||||||
core._PX_ / 2 +
|
core._PX_ / 2 +
|
||||||
(76 * core.status.event.selection - 38) -
|
(76 * core.status.event.selection - 38) -
|
||||||
@ -3530,7 +3420,7 @@ ui.prototype._drawViewMaps = function (index, x, y) {
|
|||||||
if (core.markedFloorIds[data.floorId]) text += ' (已标记)';
|
if (core.markedFloorIds[data.floorId]) text += ' (已标记)';
|
||||||
var textX = 16,
|
var textX = 16,
|
||||||
textY = 18,
|
textY = 18,
|
||||||
width = textX + core.calWidth('data', text) / devicePixelRatio + 16,
|
width = textX + core.calWidth('data', text) + 16,
|
||||||
height = 42;
|
height = 42;
|
||||||
core.fillRect('data', 5, 5, width, height, 'rgba(0,0,0,0.4)');
|
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)');
|
core.fillText('data', text, textX + 5, textY + 15, 'rgba(255,255,255,0.6)');
|
||||||
|
@ -1248,13 +1248,13 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
|||||||
"name": "系统设置",
|
"name": "系统设置",
|
||||||
"canUseItemEffect": "true",
|
"canUseItemEffect": "true",
|
||||||
"text": "内含所有系统设置项",
|
"text": "内含所有系统设置项",
|
||||||
"useItemEffect": "if (!main.replayChecking) {\n\tcore.plugin.settingsOpened.value = true;\n}"
|
"useItemEffect": "if (!core.isReplaying()) core.plugin.settingsOpened.value = true;"
|
||||||
},
|
},
|
||||||
"I560": {
|
"I560": {
|
||||||
"cls": "constants",
|
"cls": "constants",
|
||||||
"name": "百科全书",
|
"name": "百科全书",
|
||||||
"canUseItemEffect": "true",
|
"canUseItemEffect": "true",
|
||||||
"text": "一个包含游戏中所有功能详细说明的百科全书,可以查看游戏中所有的功能",
|
"text": "一个包含游戏中所有功能详细说明的百科全书,可以查看游戏中所有的功能",
|
||||||
"useItemEffect": "core.plugin.descOpened.value = true;"
|
"useItemEffect": "if (!core.isPlaying()) core.plugin.descOpened.value = true;"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -203,7 +203,7 @@ function draw() {
|
|||||||
function click(e: MouseEvent) {
|
function click(e: MouseEvent) {
|
||||||
const px = e.offsetX;
|
const px = e.offsetX;
|
||||||
const py = e.offsetY;
|
const py = e.offsetY;
|
||||||
const w = canvas.width / devicePixelRatio;
|
const w = canvas.width;
|
||||||
const per = w / 11;
|
const per = w / 11;
|
||||||
const x = Math.floor(px / per);
|
const x = Math.floor(px / per);
|
||||||
const y = Math.floor(py / per);
|
const y = Math.floor(py / per);
|
||||||
|
Loading…
Reference in New Issue
Block a user