diff --git a/libs/control.js b/libs/control.js index a4a221bc..4b176d52 100644 --- a/libs/control.js +++ b/libs/control.js @@ -3511,9 +3511,7 @@ control.prototype._resize_canvas = function (obj) { } else { for (var name in core.dymCanvas) { var ctx = core.dymCanvas[name], canvas = ctx.canvas; - var ratio = canvas.hasAttribute('isHD') ? core.domStyle.ratio : 1; - canvas.style.width = canvas.width / ratio * core.domStyle.scale + "px"; - canvas.style.height = canvas.height / ratio * core.domStyle.scale + "px"; + core.resizeCanvas(ctx, parseFloat(canvas.getAttribute("_width")), parseFloat(canvas.getAttribute("_height"))); canvas.style.left = parseFloat(canvas.getAttribute("_left")) * core.domStyle.scale + "px"; canvas.style.top = parseFloat(canvas.getAttribute("_top")) * core.domStyle.scale + "px"; } diff --git a/libs/ui.js b/libs/ui.js index 5ca53c49..1e178ef4 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -64,7 +64,13 @@ ui.prototype.clearMap = function (name, x, y, width, height) { if (x != null && y != null && width != null && height != null) { ctx.clearRect(x, y, width, height); } else { - ctx.clearRect(-32, -32, ctx.canvas.width + 32, ctx.canvas.height + 32); + if (ctx.canvas.getAttribute('isHD')) { + const width = ctx.canvas.width / core.domStyle.scale / devicePixelRatio; + const height = ctx.canvas.height / core.domStyle.scale / devicePixelRatio; + ctx.clearRect(0, 0, width, height); + } else { + ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height); + } } } } @@ -3446,6 +3452,8 @@ ui.prototype.createCanvas = function (name, x, y, width, height, z) { newCanvas.style.display = 'block'; newCanvas.setAttribute("_left", x); newCanvas.setAttribute("_top", y); + newCanvas.setAttribute("_width", width); + newCanvas.setAttribute("_height", height); newCanvas.style.width = width * core.domStyle.scale + 'px'; newCanvas.style.height = height * core.domStyle.scale + 'px'; newCanvas.style.left = x * core.domStyle.scale + 'px';