Skip to content

Commit 0ae3757

Browse files
committed
refactor buffer storage 2a
1 parent 9475c8a commit 0ae3757

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

src/interaction.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
/* eslint-disable @typescript-eslint/no-unsafe-call */
12
/* eslint-disable no-underscore-dangle */
23
/* eslint-disable @typescript-eslint/unbound-method */
34

4-
import { BaseType, select } from 'd3-selection';
5-
import { timer } from 'd3-timer';
6-
import { D3ZoomEvent, zoom, zoomIdentity } from 'd3-zoom';
5+
import { BaseType, ContainerElement, select } from 'd3-selection';
6+
import { Selection } from 'd3-selection';
7+
import { Timer, timer } from 'd3-timer';
8+
import { D3ZoomEvent, zoom, ZoomBehavior, zoomIdentity, ZoomTransform } from 'd3-zoom';
79
import { mean } from 'd3-array';
810
import { ScaleLinear, scaleLinear } from 'd3-scale';
911
// import { annotation, annotationLabel } from 'd3-svg-annotation';
@@ -37,8 +39,8 @@ export type ScaleSet = {
3739

3840
export class Zoom {
3941
public prefs: DS.APICall;
40-
public svg_element_selection: d3.Selection<
41-
d3.ContainerElement,
42+
public svg_element_selection: Selection<
43+
ContainerElement,
4244
Record<string, BaseType>,
4345
HTMLElement,
4446
any
@@ -47,10 +49,10 @@ export class Zoom {
4749
public height: number;
4850
public renderers: Map<string, Renderer>;
4951
public deeptable?: Deeptable;
50-
public _timer?: d3.Timer;
52+
public _timer?: Timer;
5153
public _scales?: ScaleSet;
52-
public zoomer?: d3.ZoomBehavior<Element, unknown>;
53-
public transform?: d3.ZoomTransform;
54+
public zoomer?: ZoomBehavior<Element, unknown>;
55+
public transform?: ZoomTransform;
5456
public _start?: number;
5557
public scatterplot: Scatterplot;
5658
private stopTimerAt?: number;
@@ -78,6 +80,7 @@ export class Zoom {
7880
}
7981

8082
attach_renderer(key: string, renderer: Renderer) {
83+
console.log("ATTACHING RENDERER")
8184
this.renderers.set(key, renderer);
8285
renderer.bind_zoom(this);
8386
renderer.zoom.initialize_zoom();
@@ -92,6 +95,7 @@ export class Zoom {
9295
.translate(width / 2, height / 2)
9396
.scale(k)
9497
.translate(-scales.x(x), -scales.y(y));
98+
//@ts-expect-error something weird
9599
canvas.transition().duration(duration).call(zoomer.transform, t);
96100
}
97101

@@ -150,6 +154,7 @@ export class Zoom {
150154
.scale(1 / buffer / Math.max((x1 - x0) / width, (y1 - y0) / height))
151155
.translate(-(x0 + x1) / 2, -(y0 + y1) / 2);
152156

157+
//@ts-expect-error something weird
153158
canvas.transition().duration(duration).call(zoomer.transform, t);
154159
}
155160

0 commit comments

Comments
 (0)