Skip to content

Commit

Permalink
dia.CellView: update typings for ES6 class extension (#1512)
Browse files Browse the repository at this point in the history
  • Loading branch information
kumilingus committed Sep 6, 2021
1 parent 3bbc440 commit 32660d1
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 4 deletions.
1 change: 1 addition & 0 deletions types/geometry.d.ts
@@ -1,5 +1,6 @@
export namespace g {

export type Shape = Path | Point | Line | Polyline | Rect | Ellipse;
export interface PlainPoint {

x: number;
Expand Down
39 changes: 35 additions & 4 deletions types/joint.d.ts
Expand Up @@ -607,6 +607,15 @@ export namespace dia {

type FlagLabel = string | string[];
type PresentationAttributes = { [key: string]: FlagLabel };

type NodeData = { [key: string]: any };

type NodeMetrics = {
data: NodeData;
boundingRect: g.Rect;
magnetMatrix: SVGMatrix;
geometryShape: g.Shape;
}
}

abstract class CellViewGeneric<T extends Cell> extends mvc.View<T> {
Expand All @@ -615,9 +624,9 @@ export namespace dia {

paper: Paper | null;

initFlag: CellView.FlagLabel;
initFlag(): CellView.FlagLabel;

presentationAttributes: CellView.PresentationAttributes;
presentationAttributes(): CellView.PresentationAttributes;

highlight(el?: SVGElement | JQuery | string, opt?: { [key: string]: any }): this;

Expand Down Expand Up @@ -707,11 +716,21 @@ export namespace dia {

protected onmagnet(evt: dia.Event, x: number, y: number): void;

static addPresentationAttributes(attributes: CellView.PresentationAttributes): CellView.PresentationAttributes;

protected getLinkEnd(magnet: SVGElement, x: number, y: number, link: dia.Link, endType: dia.LinkEnd): dia.Link.EndJSON;

protected getMagnetFromLinkEnd(end: dia.Link.EndJSON): SVGElement;

protected customizeLinkEnd(end: dia.Link.EndJSON, magnet: SVGElement, x: number, y: number, link: dia.Link, endType: dia.LinkEnd): dia.Link.EndJSON;

protected cleanNodesCache(): void;

protected nodeCache(magnet: SVGElement): CellView.NodeMetrics;

protected getNodeData(magnet: SVGElement): CellView.NodeData;

protected getNodeShape(magnet: SVGElement): g.Shape;

static addPresentationAttributes(attributes: CellView.PresentationAttributes): CellView.PresentationAttributes;
}

class CellView extends CellViewGeneric<Cell> {
Expand Down Expand Up @@ -756,6 +775,18 @@ export namespace dia {

protected renderStringMarkup(markup: string): void;

protected updateTransformation(): void;

protected resize(): void;

protected translate(): void;

protected rotate(): void;

protected getTranslateString(): string;

protected getRotateString(): string;

protected dragStart(evt: dia.Event, x: number, y: number): void;

protected dragMagnetStart(evt: dia.Event, x: number, y: number): void;
Expand Down
2 changes: 2 additions & 0 deletions types/vectorizer.d.ts
Expand Up @@ -210,6 +210,8 @@ export class Vectorizer {

findIntersection(ref: g.PlainPoint, target: SVGElement | Vectorizer): g.PlainPoint | undefined;

toGeometryShape(): g.Shape;

private setAttributes(attrs: { [key: string]: any }): this;

private setAttribute(name: string, value: string): this;
Expand Down

0 comments on commit 32660d1

Please sign in to comment.