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

antvis / L7Plot / 3730327136

pending completion
3730327136

push

github

yunji
chore: publish

731 of 1962 branches covered (37.26%)

Branch coverage included in aggregate %.

3048 of 4600 relevant lines covered (66.26%)

175.69 hits per line

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

25.0
/packages/composite-layers/src/composite-layers/icon-layer/icon-font.ts
1
import { IconFontLayerOptions } from './types';
2
import { Scene } from '../../types';
1✔
3
import { DEFAULT_OPTIONS } from './constants';
1✔
4
import { IconLayer } from './icon';
1✔
5
import { CompositeLayerEvent } from '../../core/constants';
1✔
6
import { CompositeLayer } from '../../core/composite-layer';
1✔
7

1✔
8
export class IconFontLayer extends IconLayer<IconFontLayerOptions> {
1✔
9
  /**
1✔
10
   * 默认配置项
1✔
11
   */
12
  static DefaultOptions = DEFAULT_OPTIONS;
×
13
  /**
14
   * 复合图层类型
15
   */
16
  public type = CompositeLayer.LayerType.IconFontLayer;
×
17
  /**
18
   * 字体是否加载完成
19
   */
20
  private fontLoaded = true;
×
21

×
22
  /**
23
   * 添加到场景
24
   */
25
  public addTo(scene: Scene) {
26
    this.scene = scene;
1✔
27
    this.initAssets();
×
28
    if (this.fontLoaded) {
×
29
      this.subLayers.addTo(scene);
×
30
      this.emit(CompositeLayerEvent.ADD);
×
31
    } else {
×
32
      this.on('fontloaded', () => {
×
33
        this.subLayers.addTo(scene);
34
        this.emit(CompositeLayerEvent.ADD);
35
      });
×
36
    }
×
37
  }
×
38

39
  /**
40
   * 初始化资源
41
   */
42
  protected initAssets() {
43
    this.loadIconFontAtlas();
44
  }
1✔
45

×
46
  /**
47
   * load 字体资源
48
   */
49
  protected loadIconFontAtlas() {
50
    const { fontFamily, fontPath, iconFonts } = this.options.iconAtlas;
1✔
51
    const scene = this.scene;
×
52
    if (fontFamily && fontPath) {
×
53
      this.fontLoaded = false;
×
54
      scene?.once('fontloaded', (e) => {
×
55
        this.emit('fontloaded', e);
×
56
        this.fontLoaded = true;
×
57
      });
×
58
      scene?.addFontFace(fontFamily, fontPath);
×
59
    }
60

×
61
    scene?.addIconFonts(iconFonts);
62
  }
×
63
}
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