Skip to content

Commit

Permalink
refactor: complete graph comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Aarebecca committed Jun 20, 2024
1 parent 5fa26c9 commit 740d54e
Show file tree
Hide file tree
Showing 13 changed files with 361 additions and 118 deletions.
4 changes: 2 additions & 2 deletions packages/g6/src/elements/effect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { getCachedStyle, setCacheStyle } from '../utils/cache';
* <en/> Control whether the function is executed based on whether the style attribute changes
* @param styler - <zh/> 获取样式属性函数 | <en/> Get style attribute function
* @returns <zh/> 装饰器 | <en/> Decorator
* @description
* @remarks
* <zh/> 仅指定 getStyle 的情况下,会分别使用当前的 attributes 和 新的 attributes 调用函数,若两者相同,则不执行函数。
*
* 如果指定了 shapeKey, 则会直接获取该图形的 attributes 作为原始样式属性,通常在 getStyle 函数中获取了包围盒时使用。
Expand Down Expand Up @@ -49,7 +49,7 @@ export function effect(styler: (self: any, attributes: Record<string, unknown>)
* @param b - <zh/> 样式属性 b | <en/> Style attribute b
* @param depth - <zh/> 比较深度 | <en/> Comparison depth
* @returns <zh/> 是否相等 | <en/> Whether they are equal
* @description
* @remarks
* <zh/> 进行第二层浅比较用于比较 badges、ports 等复合图形属性
*
* <en/> Perform a second-level shallow comparison to compare complex shape attributes such as badges and ports
Expand Down
2 changes: 1 addition & 1 deletion packages/g6/src/elements/shapes/badge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface BadgeStyleProps extends LabelStyleProps {}
* <zh/> 徽标
*
* <en/> Badge
* @description
* @remarks
* <zh/> 徽标是一种特殊的标签,通常用于展示数量或状态信息。
*
* <en/> Badge is a special label, usually used to display quantity or status information.
Expand Down
2 changes: 1 addition & 1 deletion packages/g6/src/elements/shapes/icon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface IconStyleProps extends BaseShapeStyleProps, Partial<TextStylePr
* <zh/> 图标
*
* <en/> Icon
* @description
* @remarks
* <zh/> 图标是一种特殊的图形,可以是图片或者文字。传入 src 属性时,会渲染图片;传入 text 属性时,会渲染文字。
*
* <en/> Icon is a special shape, which can be an image or text. When the src attribute is passed in, an image will be rendered; when the text attribute is passed in, text will be rendered.
Expand Down
2 changes: 1 addition & 1 deletion packages/g6/src/elements/shapes/label.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export interface LabelStyleProps extends TextStyleProps, Prefix<'background', Re
* <zh/> 标签
*
* <en/> Label
* @description
* @remarks
* <zh/> 标签是一种具有背景的文本图形。
*
* <en/> Label is a text shape with background.
Expand Down
2 changes: 2 additions & 0 deletions packages/g6/src/exports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ export type {
TooltipOptions,
WatermarkOptions,
} from './plugins';
export type { DataURLOptions } from './runtime/canvas';
export type { RuntimeContext } from './runtime/types';
export type {
BehaviorOptions,
Expand Down Expand Up @@ -197,6 +198,7 @@ export type {
DirectionalPlacement,
Edge,
EdgeArrowStyleProps,
EdgeDirection,
EdgeLabelStyleProps,
Element,
ElementDatum,
Expand Down
25 changes: 15 additions & 10 deletions packages/g6/src/runtime/canvas.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
import type {
Cursor,
DisplayObject,
CanvasConfig as GCanvasConfig,
DataURLOptions as GDataURLOptions,
IAnimation,
IRenderer,
PointLike,
} from '@antv/g';
import type { Cursor, DisplayObject, CanvasConfig as GCanvasConfig, IAnimation, IRenderer, PointLike } from '@antv/g';
import { CanvasEvent, Canvas as GCanvas } from '@antv/g';
import { Renderer as CanvasRenderer } from '@antv/g-canvas';
import { Plugin as DragNDropPlugin } from '@antv/g-plugin-dragndrop';
Expand All @@ -21,7 +13,7 @@ export interface CanvasConfig
background?: string;
}

export interface DataURLOptions extends GDataURLOptions {
export interface DataURLOptions {
/**
* <zh/> 导出模式
* - viewport: 导出视口内容
Expand All @@ -32,6 +24,19 @@ export interface DataURLOptions extends GDataURLOptions {
* - overall: export the entire canvas
*/
mode?: 'viewport' | 'overall';
/**
* <zh/> 图片类型
*
* <en/> image type
* @defaultValue 'image/png'
*/
type: 'image/png' | 'image/jpeg' | 'image/webp' | 'image/bmp';
/**
* <zh/> 图片质量, 仅对 image/jpeg 和 image/webp 有效,取值范围 0 ~ 1
*
* <en/> image quality, only valid for image/jpeg and image/webp, range 0 ~ 1
*/
encoderOptions: number;
}

/**
Expand Down
Loading

0 comments on commit 740d54e

Please sign in to comment.