Airblader commented on a change in pull request #17711:
URL: https://github.com/apache/flink/pull/17711#discussion_r770295492
##########
File path:
flink-runtime-web/web-dashboard/src/app/share/common/dagre/svg-container.component.ts
##########
@@ -73,20 +70,24 @@ export class SvgContainerComponent implements OnInit,
AfterContentInit {
.call(this.zoomController.transform, transform);
}
- constructor(private readonly el: ElementRef) {}
+ constructor(private readonly el: ElementRef, private cdr: ChangeDetectorRef)
{}
public ngOnInit(): void {
this.svgSelect = select(this.svgContainer.nativeElement);
this.zoomController = zoom()
.scaleExtent([this.nzMinZoom, this.nzMaxZoom])
- .on('zoom', () => {
- this.containerTransform = d3.event.transform;
- this.zoom = this.containerTransform.k;
- if (!isNaN(this.containerTransform.x)) {
- this.transform = `translate(${this.containerTransform.x}
,${this.containerTransform.y})scale(${this.containerTransform.k})`;
+ .on('zoom', ({ transform }: SafeAny) => {
+ const { x, y, k } = transform;
+ this.zoom = k;
+ this.zoomEvent.emit(k);
+ this.containerTransform = transform;
+ this.transformEvent.emit(transform);
Review comment:
Why do we need the additional emit here?
##########
File path: flink-runtime-web/web-dashboard/.husky/pre-commit
##########
@@ -0,0 +1,4 @@
+#!/bin/sh
Review comment:
Please use the more portable
```
#!/usr/bin/env bash
```
##########
File path:
flink-runtime-web/web-dashboard/src/app/share/common/dagre/svg-container.component.ts
##########
@@ -73,20 +70,24 @@ export class SvgContainerComponent implements OnInit,
AfterContentInit {
.call(this.zoomController.transform, transform);
}
- constructor(private readonly el: ElementRef) {}
+ constructor(private readonly el: ElementRef, private cdr: ChangeDetectorRef)
{}
public ngOnInit(): void {
this.svgSelect = select(this.svgContainer.nativeElement);
this.zoomController = zoom()
.scaleExtent([this.nzMinZoom, this.nzMaxZoom])
- .on('zoom', () => {
- this.containerTransform = d3.event.transform;
- this.zoom = this.containerTransform.k;
- if (!isNaN(this.containerTransform.x)) {
- this.transform = `translate(${this.containerTransform.x}
,${this.containerTransform.y})scale(${this.containerTransform.k})`;
+ .on('zoom', ({ transform }: SafeAny) => {
+ const { x, y, k } = transform;
+ this.zoom = k;
+ this.zoomEvent.emit(k);
Review comment:
Why do we need the additional emit here?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]