import type { NormalizedShape } from 'modern-idoc'; import type { Vector2Like } from 'modern-path2d'; import type { Element2D } from './Element2D'; import { Path2D, Path2DSet } from 'modern-path2d'; import { CoreObject } from '../../../core'; export declare class Element2DShape extends CoreObject implements NormalizedShape { protected _parent: Element2D; enabled: boolean; preset: NormalizedShape['preset']; svg: NormalizedShape['svg']; viewBox: NormalizedShape['viewBox']; paths: NormalizedShape['paths']; connectionPoints: NormalizedShape['connectionPoints']; /** * Bumped whenever `connectionPoints` is replaced. Connections use it to tell * whether their anchors moved without re-resolving them every frame. * Mutating the array in place doesn't bump it — same as every other property. */ connectionPointsDirtyId: number; protected _path2DSet: Path2DSet; /** * A derived path in the element's local pixel space (NOT normalized to the unit * box). Used by connections so the routed polyline is drawn 1:1 — going through * the normalize→size scaling would distort the stroke width non-uniformly. */ protected _localPath?: Path2D; /** * Pixel-space copy of `_path2DSet` (scaled to the element size), used for hit * testing so fill/stroke slack stay in pixel units. Rebuilt when the size * changes; cleared by `_updatePath2DSet` when the paths themselves change. */ protected _hitPath2DSet?: Path2DSet; protected _hitWidth: number; protected _hitHeight: number; constructor(_parent: Element2D); /** Set/clear the local-space derived path (e.g. a connection route). */ setLocalPath(path: Path2D | undefined): void; get localPath(): Path2D | undefined; setProperties(properties?: Record): this; protected _updateProperty(key: string, value: any, oldValue: any): void; isValid(): boolean; /** * Hit-test a point given in the element's local pixel space against the real * geometry, mirroring {@link draw}'s path selection: * * - a connection route (`_localPath`, already in pixel space) → stroke hit * - a normalized shape (`_path2DSet`) → fill hit, falling back to stroke for * `fill: none` outlines (handled by {@link Path2DSet.hitTest}) * * `strokeWidth` should be the element's outline width (pixels) so line/stroke * hits line up with what's drawn. Returns `false` when there's no valid geometry * — callers then fall back to the element's rectangle. */ isPointInside(localPos: Vector2Like, options?: { strokeWidth?: number; tolerance?: number; }): boolean; /** * Lazily build the pixel-space path set. `_path2DSet` is normalized to the unit * box, so it's scaled to the element size here. Rebuilt only on size change. */ protected _getHitPath2DSet(): Path2DSet | undefined; protected _updatePath2DSet(): void; draw(rect?: boolean): void; protected _drawRect(): void; }