1
+ /* eslint-disable @typescript-eslint/no-unsafe-call */
1
2
/* eslint-disable no-underscore-dangle */
2
3
/* eslint-disable @typescript-eslint/unbound-method */
3
4
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' ;
7
9
import { mean } from 'd3-array' ;
8
10
import { ScaleLinear , scaleLinear } from 'd3-scale' ;
9
11
// import { annotation, annotationLabel } from 'd3-svg-annotation';
@@ -37,8 +39,8 @@ export type ScaleSet = {
37
39
38
40
export class Zoom {
39
41
public prefs : DS . APICall ;
40
- public svg_element_selection : d3 . Selection <
41
- d3 . ContainerElement ,
42
+ public svg_element_selection : Selection <
43
+ ContainerElement ,
42
44
Record < string , BaseType > ,
43
45
HTMLElement ,
44
46
any
@@ -47,10 +49,10 @@ export class Zoom {
47
49
public height : number ;
48
50
public renderers : Map < string , Renderer > ;
49
51
public deeptable ?: Deeptable ;
50
- public _timer ?: d3 . Timer ;
52
+ public _timer ?: Timer ;
51
53
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 ;
54
56
public _start ?: number ;
55
57
public scatterplot : Scatterplot ;
56
58
private stopTimerAt ?: number ;
@@ -78,6 +80,7 @@ export class Zoom {
78
80
}
79
81
80
82
attach_renderer ( key : string , renderer : Renderer ) {
83
+ console . log ( "ATTACHING RENDERER" )
81
84
this . renderers . set ( key , renderer ) ;
82
85
renderer . bind_zoom ( this ) ;
83
86
renderer . zoom . initialize_zoom ( ) ;
@@ -92,6 +95,7 @@ export class Zoom {
92
95
. translate ( width / 2 , height / 2 )
93
96
. scale ( k )
94
97
. translate ( - scales . x ( x ) , - scales . y ( y ) ) ;
98
+ //@ts -expect-error something weird
95
99
canvas . transition ( ) . duration ( duration ) . call ( zoomer . transform , t ) ;
96
100
}
97
101
@@ -150,6 +154,7 @@ export class Zoom {
150
154
. scale ( 1 / buffer / Math . max ( ( x1 - x0 ) / width , ( y1 - y0 ) / height ) )
151
155
. translate ( - ( x0 + x1 ) / 2 , - ( y0 + y1 ) / 2 ) ;
152
156
157
+ //@ts -expect-error something weird
153
158
canvas . transition ( ) . duration ( duration ) . call ( zoomer . transform , t ) ;
154
159
}
155
160
0 commit comments