Skip to content

Commit

Permalink
refactor(module:graph): replace selection with transition (#8062)
Browse files Browse the repository at this point in the history
  • Loading branch information
HyperLife1119 committed Sep 18, 2023
1 parent 295b333 commit ceb29a9
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions components/graph/graph-zoom.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@ import {
} from '@angular/core';
import { Subject } from 'rxjs';

import { select, Selection } from 'd3-selection';
import { transition as d3Transition } from 'd3-transition';
import { Selection } from 'd3-selection';
import { transition } from 'd3-transition';
import { zoom, ZoomBehavior, zoomIdentity, zoomTransform } from 'd3-zoom';

import { NzSafeAny } from 'ng-zorro-antd/core/types';

import { calculateTransform } from './core/utils';
import { NzZoomTransform, RelativePositionInfo } from './interface';
Selection.bind('transition', d3Transition);

@Directive({
selector: '[nz-graph-zoom]',
Expand Down Expand Up @@ -63,7 +62,9 @@ export class NzGraphZoomDirective implements OnDestroy, AfterViewInit {
this.svgElement = this.element.nativeElement.querySelector('svg') as SVGSVGElement;
this.gZoomElement = this.element.nativeElement.querySelector('svg > g') as SVGGElement;
const { width, height } = this.element.nativeElement.getBoundingClientRect();
this.svgSelection = select(this.svgElement);
this.svgSelection = transition()
.selection()
.select(() => this.svgElement);
this.zoomBehavior = zoom()
.extent([
[0, 0],
Expand Down

0 comments on commit ceb29a9

Please sign in to comment.