Workaround for scroll issue

This commit is contained in:
piotrpekala7 2020-09-30 12:11:49 +02:00
parent e16152edaf
commit 22c72f411b
4 changed files with 22 additions and 2 deletions

View File

@ -104,6 +104,14 @@ export class D3MapComponent implements OnInit, OnChanges, OnDestroy {
this.mapSettings.isReadOnly = value; this.mapSettings.isReadOnly = value;
} }
resize(val: boolean) {
if (val) {
this.svg.attr('height', window.innerHeight + window.scrollY - 16);
} else {
this.svg.attr('height', this.height);
}
}
ngOnChanges(changes: { [propKey: string]: SimpleChange }) { ngOnChanges(changes: { [propKey: string]: SimpleChange }) {
if ( if (
(changes['width'] && !changes['width'].isFirstChange()) || (changes['width'] && !changes['width'].isFirstChange()) ||
@ -158,6 +166,7 @@ export class D3MapComponent implements OnInit, OnChanges, OnDestroy {
); );
this.gridVisibility = localStorage.getItem('gridVisibility') === 'true' ? 1 : 0; this.gridVisibility = localStorage.getItem('gridVisibility') === 'true' ? 1 : 0;
this.mapSettingsService.isScrollDisabled.subscribe(val => this.resize(val));
} }
ngOnDestroy() { ngOnDestroy() {

View File

@ -53,7 +53,7 @@
<app-log-console [hidden]="!(selected.value===0) || isMinimized" [server]="server" [project]="project"></app-log-console> <app-log-console [hidden]="!(selected.value===0) || isMinimized" [server]="server" [project]="project"></app-log-console>
<div class="xterm-console" [hidden]="isMinimized" *ngFor="let node of nodes; let index = index"> <div (mouseover)="disableScroll($event)" (mouseout)="enableScroll($event)" class="xterm-console" [hidden]="isMinimized" *ngFor="let node of nodes; let index = index">
<app-web-console [hidden]="!(selected.value===(index+1))" [server]="server" [node]="nodes[index]"></app-web-console> <app-web-console [hidden]="!(selected.value===(index+1))" [server]="server" [node]="nodes[index]"></app-web-console>
</div> </div>
</div> </div>

View File

@ -7,6 +7,7 @@ import { ThemeService } from '../../../services/theme.service';
import { FormControl } from '@angular/forms'; import { FormControl } from '@angular/forms';
import { NodeConsoleService } from '../../../services/nodeConsole.service'; import { NodeConsoleService } from '../../../services/nodeConsole.service';
import { Node } from '../../../cartography/models/node'; import { Node } from '../../../cartography/models/node';
import { MapSettingsService } from '../../../services/mapsettings.service';
@Component({ @Component({
@ -33,7 +34,8 @@ export class ConsoleWrapperComponent implements OnInit {
constructor( constructor(
private consoleService: NodeConsoleService, private consoleService: NodeConsoleService,
private themeService: ThemeService private themeService: ThemeService,
private mapSettingsService: MapSettingsService
) {} ) {}
nodes: Node[] = []; nodes: Node[] = [];
@ -148,4 +150,12 @@ export class ConsoleWrapperComponent implements OnInit {
close() { close() {
this.closeConsole.emit(false); this.closeConsole.emit(false);
} }
enableScroll(e) {
this.mapSettingsService.isScrollDisabled.next(false);
}
disableScroll(e) {
this.mapSettingsService.isScrollDisabled.next(true);
}
} }

View File

@ -3,6 +3,7 @@ import { Subject } from 'rxjs';
@Injectable() @Injectable()
export class MapSettingsService { export class MapSettingsService {
public isScrollDisabled = new Subject<boolean>();
public isMapLocked = new Subject<boolean>(); public isMapLocked = new Subject<boolean>();
public isTopologySummaryVisible: boolean = true; public isTopologySummaryVisible: boolean = true;
public isLogConsoleVisible: boolean = false; public isLogConsoleVisible: boolean = false;