mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-07-23 22:50:11 +03:00
Zoom
This commit is contained in:
parent
166ee67057
commit
6c85884d34
|
@ -1,4 +1,4 @@
|
||||||
import d3, { ZoomEvent } from 'd3';
|
import d3, { D3ZoomEvent } from 'd3';
|
||||||
import { isEmpty } from 'ramda';
|
import { isEmpty } from 'ramda';
|
||||||
import { map2tree } from 'map2tree';
|
import { map2tree } from 'map2tree';
|
||||||
import deepmerge from 'deepmerge';
|
import deepmerge from 'deepmerge';
|
||||||
|
@ -225,7 +225,7 @@ export default function (
|
||||||
const fullHeight = size * aspectRatio;
|
const fullHeight = size * aspectRatio;
|
||||||
|
|
||||||
const root = d3.select(DOMNode);
|
const root = d3.select(DOMNode);
|
||||||
const zoom = d3.behavior.zoom().scaleExtent([0.1, 3]).scale(initialZoom);
|
const zoom = d3.zoom<SVGSVGElement, unknown>().scaleExtent([0.1, 3]);
|
||||||
|
|
||||||
let svgElement = root
|
let svgElement = root
|
||||||
.append('svg')
|
.append('svg')
|
||||||
|
@ -247,13 +247,12 @@ export default function (
|
||||||
}
|
}
|
||||||
|
|
||||||
const vis = svgElement
|
const vis = svgElement
|
||||||
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||||
|
.call(zoom.scaleTo, initialZoom)
|
||||||
.call(
|
.call(
|
||||||
zoom.on('zoom', () => {
|
zoom.on('zoom', () => {
|
||||||
const { translate, scale } = d3.event as ZoomEvent;
|
const { transform } = d3.event as D3ZoomEvent<SVGSVGElement, unknown>;
|
||||||
vis.attr(
|
vis.attr('transform', transform.toString());
|
||||||
'transform',
|
|
||||||
`translate(${translate.toString()})scale(${scale})`
|
|
||||||
);
|
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
.append('g')
|
.append('g')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user