@antv/s2
Version:
effective spreadsheet render core lib
40 lines (39 loc) • 1.42 kB
TypeScript
/**
* @description: 请严格要求 svg 的 viewBox,若设计产出的 svg 不是此规格,请叫其修改为 '0 0 1024 1024'
*/
import { Group, PointLike, type ImageStyleProps } from '@antv/g';
import { CustomImage } from '../../engine';
export interface GuiIconCfg extends Omit<ImageStyleProps, 'fill'> {
readonly name: string;
readonly fill?: string | null;
}
/**
* 使用 iconfont 上的 svg 来创建 Icon
*/
export declare class GuiIcon extends Group {
static type: string;
iconImageShape: CustomImage;
private cfg;
constructor(cfg: GuiIconCfg);
getCfg(): GuiIconCfg;
getImage(name: string, cacheKey: string, fill?: string | null): Promise<HTMLImageElement>;
/**
* 1. https://xxx.svg
* 2. http://xxx.svg
* 3. //xxx.svg
*/
isOnlineLink: (src: string) => boolean;
private render;
reRender(cfg: GuiIconCfg): void;
updatePosition(position: PointLike): void;
setImageAttrs(attrs: Partial<{
name: string;
fill: string | null;
}>): void;
/**
* https://github.com/antvis/S2/issues/2772
* G 6.0 如果是多图层, 需要手动全部隐藏, 直接隐藏父容器 Group 还不行, 或者使用 icon.show()
* https://github.com/antvis/G/blob/277abff24936ef6f7c43407a16c5bc9260992511/packages/g-lite/src/display-objects/DisplayObject.ts#L853
*/
toggleVisibility(visible: boolean): void;
}