Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions src/interaction.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable no-underscore-dangle */
/* eslint-disable @typescript-eslint/unbound-method */

import { BaseType, select } from 'd3-selection';
import { timer } from 'd3-timer';
import { D3ZoomEvent, zoom, zoomIdentity } from 'd3-zoom';
import { BaseType, ContainerElement, select } from 'd3-selection';
import { Selection } from 'd3-selection';
import { Timer, timer } from 'd3-timer';
import { D3ZoomEvent, zoom, ZoomBehavior, zoomIdentity, ZoomTransform } from 'd3-zoom';
import { mean } from 'd3-array';
import { ScaleLinear, scaleLinear } from 'd3-scale';
// import { annotation, annotationLabel } from 'd3-svg-annotation';
Expand Down Expand Up @@ -37,8 +39,8 @@ export type ScaleSet = {

export class Zoom {
public prefs: DS.APICall;
public svg_element_selection: d3.Selection<
d3.ContainerElement,
public svg_element_selection: Selection<
ContainerElement,
Record<string, BaseType>,
HTMLElement,
any
Expand All @@ -47,10 +49,10 @@ export class Zoom {
public height: number;
public renderers: Map<string, Renderer>;
public deeptable?: Deeptable;
public _timer?: d3.Timer;
public _timer?: Timer;
public _scales?: ScaleSet;
public zoomer?: d3.ZoomBehavior<Element, unknown>;
public transform?: d3.ZoomTransform;
public zoomer?: ZoomBehavior<Element, unknown>;
public transform?: ZoomTransform;
public _start?: number;
public scatterplot: Scatterplot;
private stopTimerAt?: number;
Expand Down Expand Up @@ -78,6 +80,7 @@ export class Zoom {
}

attach_renderer(key: string, renderer: Renderer) {
console.log("ATTACHING RENDERER")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This console.log statement appears to be a debugging artifact and should be removed before merging to production.

Spotted by Graphite Reviewer

Is this helpful? React 👍 or 👎 to let us know.

this.renderers.set(key, renderer);
renderer.bind_zoom(this);
renderer.zoom.initialize_zoom();
Expand All @@ -92,6 +95,7 @@ export class Zoom {
.translate(width / 2, height / 2)
.scale(k)
.translate(-scales.x(x), -scales.y(y));
//@ts-expect-error something weird
canvas.transition().duration(duration).call(zoomer.transform, t);
}

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

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

Expand Down
Loading