From 8f2228658e9beaa67db6f4bd78638767ae47a2d3 Mon Sep 17 00:00:00 2001 From: Aaron Dodson Date: Thu, 7 Nov 2024 12:16:55 -0800 Subject: [PATCH] feat: Allow customizing GRID_UNIT for the Zelos renderer. (#8636) --- core/renderers/zelos/constants.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/core/renderers/zelos/constants.ts b/core/renderers/zelos/constants.ts index ddb2bdeef..213d8a259 100644 --- a/core/renderers/zelos/constants.ts +++ b/core/renderers/zelos/constants.ts @@ -151,9 +151,19 @@ export class ConstantProvider extends BaseConstantProvider { */ SQUARED: Shape | null = null; - constructor() { + /** + * Creates a new ConstantProvider. + * + * @param gridUnit If set, defines the base unit used to calculate other + * constants. + */ + constructor(gridUnit?: number) { super(); + if (gridUnit) { + this.GRID_UNIT = gridUnit; + } + this.SMALL_PADDING = this.GRID_UNIT; this.MEDIUM_PADDING = 2 * this.GRID_UNIT;