From cb99bd2f64183f8c6131c6aac757440f26689b3b Mon Sep 17 00:00:00 2001 From: martinRenou Date: Wed, 29 Apr 2026 16:02:08 +0200 Subject: [PATCH 1/2] Keep ScatterGL in sync when an axis scale's type changes at runtime Porting https://github.com/bqplot/bqplot/pull/1699 --- src/ScatterGLView.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ScatterGLView.ts b/src/ScatterGLView.ts index 845b082..fcbd47d 100644 --- a/src/ScatterGLView.ts +++ b/src/ScatterGLView.ts @@ -280,8 +280,14 @@ export class ScatterGLView extends Mark { this.material.defines['USE_SCALE_X'] = true; this.material.defines['USE_SCALE_Y'] = true; - this.material.defines['SCALE_TYPE_X'] = ScaleType.SCALE_TYPE_LINEAR; - this.material.defines['SCALE_TYPE_Y'] = ScaleType.SCALE_TYPE_LINEAR; + + const scaleTypeMap = { date: ScaleType.SCALE_TYPE_LINEAR, linear: ScaleType.SCALE_TYPE_LINEAR, log: ScaleType.SCALE_TYPE_LOG }; + const x_scale = this.scales.x ? this.scales.x : this.parent.scale_x; + const y_scale = this.scales.y ? this.scales.y : this.parent.scale_y; + this.material.defines[`SCALE_TYPE_X`] = + scaleTypeMap[x_scale.model.type]; + this.material.defines[`SCALE_TYPE_Y`] = + scaleTypeMap[y_scale.model.type]; const opacity_parameters = this.getOpacityAttributeParameters(); this.opacity = this.initializeAttribute('opacity', opacity_parameters); From 9c6d66a46cfdca44ba6f178a5eee285781a0a1ae Mon Sep 17 00:00:00 2001 From: martinRenou Date: Wed, 29 Apr 2026 16:05:37 +0200 Subject: [PATCH 2/2] Should be pretty now --- src/ScatterGLView.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/ScatterGLView.ts b/src/ScatterGLView.ts index fcbd47d..9a596c2 100644 --- a/src/ScatterGLView.ts +++ b/src/ScatterGLView.ts @@ -281,13 +281,15 @@ export class ScatterGLView extends Mark { this.material.defines['USE_SCALE_X'] = true; this.material.defines['USE_SCALE_Y'] = true; - const scaleTypeMap = { date: ScaleType.SCALE_TYPE_LINEAR, linear: ScaleType.SCALE_TYPE_LINEAR, log: ScaleType.SCALE_TYPE_LOG }; + const scaleTypeMap = { + date: ScaleType.SCALE_TYPE_LINEAR, + linear: ScaleType.SCALE_TYPE_LINEAR, + log: ScaleType.SCALE_TYPE_LOG, + }; const x_scale = this.scales.x ? this.scales.x : this.parent.scale_x; const y_scale = this.scales.y ? this.scales.y : this.parent.scale_y; - this.material.defines[`SCALE_TYPE_X`] = - scaleTypeMap[x_scale.model.type]; - this.material.defines[`SCALE_TYPE_Y`] = - scaleTypeMap[y_scale.model.type]; + this.material.defines[`SCALE_TYPE_X`] = scaleTypeMap[x_scale.model.type]; + this.material.defines[`SCALE_TYPE_Y`] = scaleTypeMap[y_scale.model.type]; const opacity_parameters = this.getOpacityAttributeParameters(); this.opacity = this.initializeAttribute('opacity', opacity_parameters);