• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

atinc / ngx-tethys / d9ae709b-3c27-4b69-b125-b8b80b54f90b

pending completion
d9ae709b-3c27-4b69-b125-b8b80b54f90b

Pull #2757

circleci

mengshuicmq
fix: fix code review
Pull Request #2757: feat(color-picker): color-picker support disabled (#INFR-8645)

98 of 6315 branches covered (1.55%)

Branch coverage included in aggregate %.

1 of 1 new or added line in 1 file covered. (100.0%)

2392 of 13661 relevant lines covered (17.51%)

83.12 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/carousel/engine/carousel-base.ts
1
import { ChangeDetectorRef, Renderer2, QueryList } from '@angular/core';
2
import { Platform } from '@angular/cdk/platform';
3
import { Observable } from 'rxjs';
×
4
import { ThyCarouselItemDirective } from '../carousel-item.directive';
5
import { ThyCarouselComponent } from '../carousel.component';
6
import { ThyDistanceVector, ThyCarouselEngine } from '../typings';
×
7

8
export abstract class ThyCarouselBaseEngine implements ThyCarouselEngine {
9
    protected contentWidth: number;
×
10
    protected contentHeight: number;
11
    protected readonly carouselComponent: ThyCarouselComponent;
12
    protected wrapperEl: HTMLElement;
×
13
    protected playTime: number;
×
14
    protected length: number;
×
15
    protected contents: ThyCarouselItemDirective[];
×
16

17
    protected get maxIndex(): number {
18
        return this.length - 1;
×
19
    }
×
20

×
21
    protected get firstEl(): HTMLElement {
×
22
        return this.contents[0].el;
×
23
    }
×
24

×
25
    protected get lastEl(): HTMLElement {
×
26
        return this.contents[this.maxIndex].el;
×
27
    }
×
28

×
29
    protected constructor(
×
30
        thyCarouselComponent: ThyCarouselComponent,
31
        protected cdr: ChangeDetectorRef,
×
32
        protected renderer: Renderer2,
×
33
        protected platform: Platform
34
    ) {
35
        this.carouselComponent = thyCarouselComponent;
36
    }
×
37

×
38
    initializeContents(contents: QueryList<ThyCarouselItemDirective> | null) {
×
39
        const carousel = this.carouselComponent!;
×
40
        const { wrapperEl, playTime } = carousel;
×
41
        this.wrapperEl = wrapperEl;
42
        this.playTime = playTime;
43
        const { width, height } = wrapperEl.getBoundingClientRect();
44
        this.contentHeight = height;
45
        this.contentWidth = width;
46

47
        this.contents = contents?.toArray();
48
        this.length = this.contents.length;
49
        if (this.platform.isBrowser && this.contents.length) {
50
            this.renderer.setStyle(this.wrapperEl, 'transform', 'translate3d(0, 0, 0)');
51
            this.renderer.setStyle(this.wrapperEl, `height`, `${this.contentHeight}px`);
52
        }
53
        this.contents.forEach(content => {
54
            content.el.removeAttribute('style');
55
        });
56
    }
57

58
    abstract dragging(pointerVector: ThyDistanceVector, rect: DOMRect): void;
59

60
    abstract initializeCarouselContents(contents: QueryList<ThyCarouselItemDirective> | null): void;
61

62
    abstract switch(to: number, from: number): Observable<void>;
63

64
    correctionOffset(): void {
65
        const carousel = this.carouselComponent!;
66
        const { wrapperEl } = carousel;
67
        const { width, height } = wrapperEl.getBoundingClientRect();
68
        this.contentWidth = width;
69
        this.contentHeight = height;
70
    }
71
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc