From 98783c3585d7669619e313ff2c3942063d0f2299 Mon Sep 17 00:00:00 2001 From: ShakeFlower Date: Mon, 23 Feb 2026 15:55:39 +0800 Subject: [PATCH] =?UTF-8?q?feat:resize=E6=97=B6=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E7=94=BB=E5=B8=83=E5=8F=AF=E6=89=A7=E8=A1=8C=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libs/control.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/libs/control.js b/libs/control.js index 5a8ae715..31680323 100644 --- a/libs/control.js +++ b/libs/control.js @@ -19,6 +19,8 @@ control.prototype._init = function () { this.weathers = {}; this.resizes = []; this.noAutoEvents = true; + /** @type {{[canvasName:string]:Function}} */ + this.dymCanvasResizeEvents = {}; // --- 注册系统的animationFrame this.registerAnimationFrame("totalTime", false, this._animationFrame_totalTime); this.registerAnimationFrame("autoSave", true, this._animationFrame_autoSave); @@ -3638,6 +3640,14 @@ control.prototype._resize_gameGroup = function (obj) { } } +control.prototype.registerDymCanvasResizeEvent = function (name, event){ + this.dymCanvasResizeEvents[name] = event; +} + +control.prototype.unregisterDymCanvasResizeEvent = function (name){ + delete this.dymCanvasResizeEvents[name]; +} + control.prototype._resize_canvas = function (obj) { var innerSize = (obj.CANVAS_WIDTH * core.domStyle.scale) + "px"; if (!core.isPlaying()) { @@ -3681,6 +3691,10 @@ control.prototype._resize_canvas = function (obj) { canvas.style.left = parseFloat(canvas.getAttribute("_left")) * core.domStyle.scale + "px"; canvas.style.top = parseFloat(canvas.getAttribute("_top")) * core.domStyle.scale + "px"; } + if (this.dymCanvasResizeEvents[name]) { + const event = this.dymCanvasResizeEvents[name]; + event(); + } } // resize next main.dom.next.style.width = main.dom.next.style.height = 5 * core.domStyle.scale + "px";