@equinor/videx-map
Version:
Component for Pixi-overlay in Leaflet.
47 lines (46 loc) • 1.34 kB
TypeScript
import * as PIXI from 'pixi.js';
import Vector2 from '@equinor/videx-vector2';
/** Data for label. */
export type GeoJSONLabelData = {
position: Vector2;
mass: number;
};
interface Label {
name: string;
position: Vector2;
instance?: PIXI.BitmapText;
}
/** Class used to manage field labels. Handles scaling and grouping of labels. */
export default class GeoJSONLabels {
/**PIXI container to hold all labels*/
container: PIXI.Container;
/** The textstyle used for labels. */
textStyle: PIXI.TextStyle;
/** The font used for labels. */
font: PIXI.BitmapFont;
/** font name */
fontName: string;
/** Scale of labels when size is set to 1. */
baseScale: number;
/** Collection of single-polygon fields. */
labels: Label[];
/** Visibility */
visible: boolean;
/** construct a new label container. */
constructor(root: PIXI.Container, textStyle: PIXI.TextStyle, baseScale: number, fontName?: string);
/**
* Add a new label.
* @param name label name
* @param data Data for each label
*/
addLabel(name: string, data: GeoJSONLabelData): void;
/**
* Draw all labels
* @param root Target root for labels
*/
draw(): void;
hideLabels(): void;
showLabels(): void;
resize(scale: number): void;
}
export {};