From 183a0ffecb3c83b4c5e49681fdb67a30a307ad5b Mon Sep 17 00:00:00 2001 From: Amrit Date: Mon, 6 Jan 2025 10:32:28 +0530 Subject: [PATCH 1/2] todo: apply array destructuring --- js/blockfactory.js | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/js/blockfactory.js b/js/blockfactory.js index 653db1cc60..438404b93d 100644 --- a/js/blockfactory.js +++ b/js/blockfactory.js @@ -187,18 +187,12 @@ class SVG { /** * @public - * @param {number} w - * @param {number} h - * @param {number} w2 - * @param {number} h2 + * @param {[number, number, number, number]} dimensions * @returns {void} */ - setExpand(w, h, w2, h2) { - // TODO: make this an array - this._expandX = w; - this._expandY = h; - this._expandX2 = w2; - this._expandY2 = h2; + setExpand(dimensions) { + // Store expansion dimensions as array [w, h, w2, h2] + [this._expandX, this._expandY, this._expandX2, this._expandY2] = dimensions; } /** From 443d54106629548788df3d74963844a393177da8 Mon Sep 17 00:00:00 2001 From: Amrit Date: Thu, 9 Jan 2025 12:13:27 +0530 Subject: [PATCH 2/2] enable backward compatibility --- js/blockfactory.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/js/blockfactory.js b/js/blockfactory.js index 438404b93d..6e8e6d19ac 100644 --- a/js/blockfactory.js +++ b/js/blockfactory.js @@ -187,12 +187,17 @@ class SVG { /** * @public - * @param {[number, number, number, number]} dimensions + * @param {number} w - width + * @param {number} h - height + * @param {number} w2 - width2 + * @param {number} h2 - height2 * @returns {void} */ - setExpand(dimensions) { - // Store expansion dimensions as array [w, h, w2, h2] - [this._expandX, this._expandY, this._expandX2, this._expandY2] = dimensions; + setExpand(w, h, w2, h2) { + // Store expansion dimensions as array internally + this._expandDimensions = [w, h, w2, h2]; + // Keep individual properties in sync for backward compatibility + [this._expandX, this._expandY, this._expandX2, this._expandY2] = this._expandDimensions; } /**