UNPKG

@maxgraph/core

Version:

maxGraph is a fully client side JavaScript diagramming library that uses SVG and HTML for rendering.

111 lines (110 loc) 3.6 kB
import Rectangle from '../../geometry/Rectangle.js'; import RectangleShape from './RectangleShape.js'; import { ColorValue } from '../../../types.js'; import AbstractCanvas2D from '../../canvas/AbstractCanvas2D.js'; /** * Extends {@link RectangleShape} to implement an image shape with a label. * * This shape is registered under `label` in {@link CellRenderer} when using {@link Graph} or calling {@link registerDefaultShapes}. * * @category Vertex Shapes */ declare class LabelShape extends RectangleShape { /** * Constructs a new label shape. * * @param bounds {@link Rectangle} that defines the bounds. This is stored in {@link bounds}. * @param fill String that defines the fill color. This is stored in {@link fill}. * @param stroke String that defines the stroke color. This is stored in {@link stroke}. * @param strokeWidth Optional integer that defines the stroke width. Default is 1. This is stored in {@link strokeWidth}. */ constructor(bounds: Rectangle, fill: ColorValue, stroke: ColorValue, strokeWidth: number); /** * Default width and height for the image. * @default mxConstants.DEFAULT_IMAGESIZE */ imageSize: number; imageSrc: string | null; /** * Default value for image spacing * @type {number} * @default 2 */ spacing: number; /** * Default width and height for the indicicator. * @type {number} * @default 10 */ indicatorSize: number; /** * Default spacing between image and indicator * @default 2 * @type {number} */ indicatorSpacing: number; indicatorImageSrc: string | null; /** * Initializes the shape and the <indicator>. */ init(container: SVGElement): void; /** * Reconfigures this shape. This will update the colors of the indicator * and reconfigure it if required. */ redraw(): void; /** * Returns true for non-rounded, non-rotated shapes with no glass gradient and * no indicator shape. */ isHtmlAllowed(): boolean; /** * Generic background painting implementation. * @param {mxAbstractCanvas2D} c * @param {number} x * @param {number} y * @param {number} w * @param {number} h */ paintForeground(c: AbstractCanvas2D, x: number, y: number, w: number, h: number): void; /** * Generic background painting implementation. * @param {mxAbstractCanvas2D} c * @param {number} x * @param {number} y * @param {number} w * @param {number} h */ paintImage(c: AbstractCanvas2D, x: number, y: number, w: number, h: number): void; /** * Generic background painting implementation. * @param {number} x * @param {number} y * @param {number} w * @param {number} h */ getImageBounds(x: number, y: number, w: number, h: number): Rectangle; /** * Generic background painting implementation. * @param {AbstractCanvas2D} c * @param {number} x * @param {number} y * @param {number} w * @param {number} h */ paintIndicator(c: AbstractCanvas2D, x: number, y: number, w: number, h: number): void; /** * Generic background painting implementation. * @param {number} x * @param {number} y * @param {number} w * @param {number} h * @returns {Rectangle} */ getIndicatorBounds(x: number, y: number, w: number, h: number): Rectangle; /** * Generic background painting implementation. */ redrawHtmlShape(): void; } export default LabelShape;