Skip to content

Commit

Permalink
fix: make server-side compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
arturovt authored and walkerkay committed Mar 21, 2022
1 parent d57c056 commit 27f5f16
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/gantt/src/components/bar/bar.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ $gantt-bar-link-drop-border: 5px;
height: calc(100% + #{$gantt-bar-layer-append-height});
position: absolute;
border-radius: 4px;
left: $gantt-bar-layer-append-width / 2 * -1;
top: $gantt-bar-layer-append-height / 2 * -1;
left: math.div($gantt-bar-layer-append-width, 2) * -1;
top: math.div($gantt-bar-layer-append-height, 2) * -1;
display: none;
@include drag-handles();
@include link-handles();
Expand Down
13 changes: 7 additions & 6 deletions packages/gantt/src/gantt-dom.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Injectable, ElementRef, OnDestroy } from '@angular/core';
import { fromEvent, Subject, merge } from 'rxjs';
import { pairwise, map, auditTime, takeUntil, take, startWith } from 'rxjs/operators';
import { isPlatformServer } from '@angular/common';
import { Injectable, ElementRef, OnDestroy, Inject, PLATFORM_ID } from '@angular/core';
import { fromEvent, Subject, merge, EMPTY, Observable } from 'rxjs';
import { pairwise, map, auditTime, takeUntil, startWith } from 'rxjs/operators';
import { isNumber } from './utils/helpers';

const scrollThreshold = 50;
Expand Down Expand Up @@ -34,7 +35,7 @@ export class GanttDomService implements OnDestroy {

private unsubscribe$ = new Subject<void>();

constructor() {}
constructor(@Inject(PLATFORM_ID) private platformId: string) {}

private monitorScrollChange() {
merge(fromEvent(this.mainContainer, 'scroll'), fromEvent(this.sideContainer, 'scroll'))
Expand Down Expand Up @@ -115,8 +116,8 @@ export class GanttDomService implements OnDestroy {
);
}

getResize() {
return fromEvent(window, 'resize').pipe(auditTime(150));
getResize(): Observable<Event> {
return isPlatformServer(this.platformId) ? EMPTY : fromEvent(window, 'resize').pipe(auditTime(150));
}

scrollMainContainer(left: number) {
Expand Down

0 comments on commit 27f5f16

Please sign in to comment.