@wcardinal/wcardinal-ui 0.204.3 → 0.205.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/types/wcardinal/ui/shape/e-shape-acceptor-impl.d.ts +3 -1
- package/dist/types/wcardinal/ui/shape/e-shape-acceptor.d.ts +6 -0
- package/dist/types/wcardinal/ui/shape/e-shape-connector-edge-impl.d.ts +12 -3
- package/dist/types/wcardinal/ui/shape/e-shape-connector-edge.d.ts +13 -3
- package/dist/types/wcardinal/ui/shape/e-shape-type.d.ts +1 -0
- package/dist/types/wcardinal/ui/shape/load/index.d.ts +1 -0
- package/dist/types/wcardinal/ui/shape/load/load-shape-connector-elbow.d.ts +1 -0
- package/dist/types/wcardinal/ui/shape/variant/deserialize-connector-elbow.d.ts +4 -0
- package/dist/types/wcardinal/ui/shape/variant/e-shape-connector-elbow-points-fillter.d.ts +17 -0
- package/dist/types/wcardinal/ui/shape/variant/e-shape-connector-elbow.d.ts +8 -0
- package/dist/types/wcardinal/ui/shape/variant/e-shape-connector-line.d.ts +4 -0
- package/dist/types/wcardinal/ui/shape/variant/index.d.ts +3 -0
- package/dist/wcardinal/ui/shape/e-shape-acceptor-impl.js +27 -2
- package/dist/wcardinal/ui/shape/e-shape-acceptor-impl.js.map +1 -1
- package/dist/wcardinal/ui/shape/e-shape-acceptor.js.map +1 -1
- package/dist/wcardinal/ui/shape/e-shape-acceptors.js +9 -9
- package/dist/wcardinal/ui/shape/e-shape-acceptors.js.map +1 -1
- package/dist/wcardinal/ui/shape/e-shape-connector-edge-impl.js +139 -28
- package/dist/wcardinal/ui/shape/e-shape-connector-edge-impl.js.map +1 -1
- package/dist/wcardinal/ui/shape/e-shape-connector-edge.js.map +1 -1
- package/dist/wcardinal/ui/shape/e-shape-points-marker-base.js +1 -1
- package/dist/wcardinal/ui/shape/e-shape-points-marker-base.js.map +1 -1
- package/dist/wcardinal/ui/shape/e-shape-type.js +1 -0
- package/dist/wcardinal/ui/shape/e-shape-type.js.map +1 -1
- package/dist/wcardinal/ui/shape/load/index.js +1 -0
- package/dist/wcardinal/ui/shape/load/index.js.map +1 -1
- package/dist/wcardinal/ui/shape/load/load-shape-all.js +2 -0
- package/dist/wcardinal/ui/shape/load/load-shape-all.js.map +1 -1
- package/dist/wcardinal/ui/shape/load/load-shape-connector-elbow.js +19 -0
- package/dist/wcardinal/ui/shape/load/load-shape-connector-elbow.js.map +1 -0
- package/dist/wcardinal/ui/shape/variant/deserialize-connector-elbow.js +10 -0
- package/dist/wcardinal/ui/shape/variant/deserialize-connector-elbow.js.map +1 -0
- package/dist/wcardinal/ui/shape/variant/e-shape-connector-elbow-points-fillter.js +194 -0
- package/dist/wcardinal/ui/shape/variant/e-shape-connector-elbow-points-fillter.js.map +1 -0
- package/dist/wcardinal/ui/shape/variant/e-shape-connector-elbow.js +84 -0
- package/dist/wcardinal/ui/shape/variant/e-shape-connector-elbow.js.map +1 -0
- package/dist/wcardinal/ui/shape/variant/e-shape-connector-line.js +77 -67
- package/dist/wcardinal/ui/shape/variant/e-shape-connector-line.js.map +1 -1
- package/dist/wcardinal/ui/shape/variant/index.js +3 -0
- package/dist/wcardinal/ui/shape/variant/index.js.map +1 -1
- package/dist/wcardinal-ui-theme-dark.js +1 -1
- package/dist/wcardinal-ui-theme-dark.min.js +1 -1
- package/dist/wcardinal-ui-theme-white.js +1 -1
- package/dist/wcardinal-ui-theme-white.min.js +1 -1
- package/dist/wcardinal-ui.cjs.js +549 -107
- package/dist/wcardinal-ui.js +549 -107
- package/dist/wcardinal-ui.min.js +2 -2
- package/dist/wcardinal-ui.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { EShapeAcceptor, EShapeAcceptorEdge } from "./e-shape-acceptor";
|
|
1
|
+
import { EShapeAcceptor, EShapeAcceptorEdge, EShapeAcceptorEdgeNormal } from "./e-shape-acceptor";
|
|
2
2
|
import { EShapeAcceptorType } from "./e-shape-acceptor-type";
|
|
3
3
|
export declare class EShapeAcceptorImpl implements EShapeAcceptor {
|
|
4
4
|
protected _edges: Map<string, EShapeAcceptorEdge>;
|
|
5
5
|
constructor();
|
|
6
6
|
add(id: string, type: EShapeAcceptorType, x: number, y: number): boolean;
|
|
7
|
+
add(id: string, type: EShapeAcceptorType, x: number, y: number, nx: number, ny: number): boolean;
|
|
8
|
+
protected toNormal(x: number, y: number, nx?: number, ny?: number): EShapeAcceptorEdgeNormal;
|
|
7
9
|
remove(id: string): EShapeAcceptorEdge | null;
|
|
8
10
|
size(): number;
|
|
9
11
|
get(id: string): EShapeAcceptorEdge | null;
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { EShapeAcceptorType } from "./e-shape-acceptor-type";
|
|
2
|
+
export interface EShapeAcceptorEdgeNormal {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
}
|
|
2
6
|
export interface EShapeAcceptorEdge {
|
|
3
7
|
type: EShapeAcceptorType;
|
|
4
8
|
x: number;
|
|
5
9
|
y: number;
|
|
10
|
+
normal: EShapeAcceptorEdgeNormal;
|
|
6
11
|
}
|
|
7
12
|
export interface EShapeAcceptor {
|
|
8
13
|
size(): number;
|
|
9
14
|
add(id: string, type: EShapeAcceptorType, x: number, y: number): boolean;
|
|
15
|
+
add(id: string, type: EShapeAcceptorType, x: number, y: number, nx: number, ny: number): boolean;
|
|
10
16
|
remove(id: string): EShapeAcceptorEdge | null;
|
|
11
17
|
get(id: string): EShapeAcceptorEdge | null;
|
|
12
18
|
each(iteratee: (edge: EShapeAcceptorEdge, id: string) => void): this;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IPoint,
|
|
1
|
+
import { IPoint, Matrix } from "pixi.js";
|
|
2
2
|
import { EShape } from "./e-shape";
|
|
3
3
|
import { EShapeConnector } from "./e-shape-connector";
|
|
4
4
|
import { EShapeConnectorEdge } from "./e-shape-connector-edge";
|
|
@@ -7,17 +7,21 @@ import { EShapeResourceManagerDeserialization } from "./e-shape-resource-manager
|
|
|
7
7
|
import { EShapeResourceManagerSerialization } from "./e-shape-resource-manager-serialization";
|
|
8
8
|
import { EShapeUuidMapping } from "./e-shape-uuid-mapping";
|
|
9
9
|
export declare class EShapeConnectorEdgeImpl implements EShapeConnectorEdge {
|
|
10
|
-
protected static
|
|
10
|
+
protected static WORK_MATRIX?: Matrix;
|
|
11
11
|
protected _parent: EShapeConnector;
|
|
12
12
|
protected _onChange: () => void;
|
|
13
13
|
protected _acceptor: EShapeConnectorEdgeAcceptor;
|
|
14
14
|
protected _localIdRequired: number;
|
|
15
15
|
protected _localId: number;
|
|
16
16
|
protected _local: IPoint;
|
|
17
|
+
protected _normalIdRequired: number;
|
|
18
|
+
protected _normalId: number;
|
|
19
|
+
protected _normal: IPoint;
|
|
17
20
|
protected _margin: number;
|
|
18
21
|
protected _lockCount: number;
|
|
19
22
|
protected _isAcceptorChanged: boolean;
|
|
20
23
|
protected _isLocalChanged: boolean;
|
|
24
|
+
protected _isNormalChanged: boolean;
|
|
21
25
|
protected _isOtherChanged: boolean;
|
|
22
26
|
constructor(parent: EShapeConnector, onChange: () => void);
|
|
23
27
|
lock(): void;
|
|
@@ -25,15 +29,20 @@ export declare class EShapeConnectorEdgeImpl implements EShapeConnectorEdge {
|
|
|
25
29
|
get acceptor(): EShapeConnectorEdgeAcceptor;
|
|
26
30
|
get local(): IPoint;
|
|
27
31
|
get localId(): number;
|
|
32
|
+
get normal(): IPoint;
|
|
33
|
+
get normalId(): number;
|
|
28
34
|
get margin(): number;
|
|
29
35
|
set margin(margin: number);
|
|
30
|
-
set(shape?: EShape | null, edge?: string | null, margin?: number,
|
|
36
|
+
set(shape?: EShape | null, edge?: string | null, margin?: number, x?: number, y?: number, nx?: number, ny?: number): this;
|
|
31
37
|
copy(source: EShapeConnectorEdge): this;
|
|
32
38
|
serialize(manager: EShapeResourceManagerSerialization): number;
|
|
33
39
|
deserialize(resourceId: number, mapping: EShapeUuidMapping, manager: EShapeResourceManagerDeserialization): void;
|
|
34
40
|
fit(forcibly?: boolean): this;
|
|
41
|
+
protected doFit(): boolean;
|
|
42
|
+
protected toAcceptorTransform(shape: EShape): Matrix;
|
|
35
43
|
onAcceptorChange(): void;
|
|
36
44
|
protected onLocalChange(): void;
|
|
45
|
+
protected onNormalChange(): void;
|
|
37
46
|
protected onOtherChange(): void;
|
|
38
47
|
attach(): this;
|
|
39
48
|
detach(): this;
|
|
@@ -4,15 +4,25 @@ import { EShapeConnectorEdgeAcceptor } from "./e-shape-connector-edge-acceptor";
|
|
|
4
4
|
import { EShapeResourceManagerDeserialization } from "./e-shape-resource-manager-deserialization";
|
|
5
5
|
import { EShapeResourceManagerSerialization } from "./e-shape-resource-manager-serialization";
|
|
6
6
|
import { EShapeUuidMapping } from "./e-shape-uuid-mapping";
|
|
7
|
-
export declare type EShapeConnectorEdgeSerialized = [
|
|
7
|
+
export declare type EShapeConnectorEdgeSerialized = [
|
|
8
|
+
number | null,
|
|
9
|
+
number,
|
|
10
|
+
number,
|
|
11
|
+
number,
|
|
12
|
+
number,
|
|
13
|
+
number?,
|
|
14
|
+
number?
|
|
15
|
+
];
|
|
8
16
|
export interface EShapeConnectorEdge {
|
|
9
17
|
readonly acceptor: EShapeConnectorEdgeAcceptor;
|
|
10
18
|
readonly local: IPoint;
|
|
11
|
-
localId: number;
|
|
19
|
+
readonly localId: number;
|
|
20
|
+
readonly normal: IPoint;
|
|
21
|
+
readonly normalId: number;
|
|
12
22
|
margin: number;
|
|
13
23
|
lock(): void;
|
|
14
24
|
unlock(): void;
|
|
15
|
-
set(shape?: EShape | null, edge?: string | null, margin?: number,
|
|
25
|
+
set(shape?: EShape | null, edge?: string | null, margin?: number, x?: number, y?: number, nx?: number, ny?: number): this;
|
|
16
26
|
copy(source: EShapeConnectorEdge): this;
|
|
17
27
|
fit(forcibly?: boolean): this;
|
|
18
28
|
serialize(manager: EShapeResourceManagerSerialization): number;
|
|
@@ -3,6 +3,7 @@ export * from "./load-shape-bar";
|
|
|
3
3
|
export * from "./load-shape-button";
|
|
4
4
|
export * from "./load-shape-circle";
|
|
5
5
|
export * from "./load-shape-clipper-ex";
|
|
6
|
+
export * from "./load-shape-connector-elbow";
|
|
6
7
|
export * from "./load-shape-connector-line";
|
|
7
8
|
export * from "./load-shape-embedded";
|
|
8
9
|
export * from "./load-shape-group-shadowed";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const loadShapeConnectorElbow: () => void;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { DDiagramSerializedItem } from "../../d-diagram-serialized";
|
|
2
|
+
import { EShapeResourceManagerDeserialization } from "../e-shape-resource-manager-deserialization";
|
|
3
|
+
import { EShapeConnectorLine } from "./e-shape-connector-line";
|
|
4
|
+
export declare const deserializeConnectorElbow: (item: DDiagramSerializedItem, manager: EShapeResourceManagerDeserialization, shape?: EShapeConnectorLine | undefined) => Promise<EShapeConnectorLine> | EShapeConnectorLine;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare class EShapeConnectorElbowPointsFillter {
|
|
2
|
+
protected _x: number;
|
|
3
|
+
protected _y: number;
|
|
4
|
+
protected _z: number;
|
|
5
|
+
protected _values: number[];
|
|
6
|
+
index: number;
|
|
7
|
+
protected _threshold: number;
|
|
8
|
+
constructor(x: number, y: number, values: number[]);
|
|
9
|
+
get x(): number;
|
|
10
|
+
set x(x: number);
|
|
11
|
+
get y(): number;
|
|
12
|
+
set y(y: number);
|
|
13
|
+
tail(x: number, y: number, nx: number, ny: number, sxh: number, syh: number, margin: number): void;
|
|
14
|
+
middle(x: number, y: number): void;
|
|
15
|
+
head(x: number, y: number, nx: number, ny: number, sxh: number, syh: number, margin: number): void;
|
|
16
|
+
margin(tail: number, head: number): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EShapeType } from "../e-shape-type";
|
|
2
|
+
import { EShapeConnectorBody } from "../e-shape-connector-body";
|
|
3
|
+
import { EShapeConnectorLine } from "./e-shape-connector-line";
|
|
4
|
+
import { EShapeConnectorEdge } from "../e-shape-connector-edge";
|
|
5
|
+
export declare class EShapeConnectorElbow extends EShapeConnectorLine {
|
|
6
|
+
constructor(type?: EShapeType);
|
|
7
|
+
protected fillPoints(tail: EShapeConnectorEdge, tailMargin: number, head: EShapeConnectorEdge, headMargin: number, body: EShapeConnectorBody, px: number, py: number, values: number[]): void;
|
|
8
|
+
}
|
|
@@ -8,14 +8,17 @@ import { DDiagramSerializedItem } from "../../d-diagram-serialized";
|
|
|
8
8
|
import { EShapeResourceManagerSerialization } from "../e-shape-resource-manager-serialization";
|
|
9
9
|
import { EShape } from "../e-shape";
|
|
10
10
|
import { EShapeConnectorBody } from "../e-shape-connector-body";
|
|
11
|
+
import { EShapeConnectorEdge } from "../e-shape-connector-edge";
|
|
11
12
|
export declare class EShapeConnectorLine extends EShapeLineBase implements EShapeConnector {
|
|
12
13
|
protected static WORK_BOUNDARY: [number, number, number, number];
|
|
13
14
|
protected _edge: EShapeConnectorEdgeContainer;
|
|
14
15
|
protected _body: EShapeConnectorBody;
|
|
15
16
|
protected _points: EShapeLinePoints;
|
|
16
17
|
protected _tailLocalId: number;
|
|
18
|
+
protected _tailNormalId: number;
|
|
17
19
|
protected _tailMargin: number;
|
|
18
20
|
protected _headLocalId: number;
|
|
21
|
+
protected _headNormalId: number;
|
|
19
22
|
protected _headMargin: number;
|
|
20
23
|
protected _bodyId: number;
|
|
21
24
|
protected _lockCount: number;
|
|
@@ -29,6 +32,7 @@ export declare class EShapeConnectorLine extends EShapeLineBase implements EShap
|
|
|
29
32
|
onAttach(): void;
|
|
30
33
|
onDetach(): void;
|
|
31
34
|
protected onChange(): void;
|
|
35
|
+
protected fillPoints(tail: EShapeConnectorEdge, tailMargin: number, head: EShapeConnectorEdge, headMargin: number, body: EShapeConnectorBody, px: number, py: number, values: number[]): void;
|
|
32
36
|
copy(source: EShape, part?: EShapeCopyPart): this;
|
|
33
37
|
clone(): EShapeConnectorLine;
|
|
34
38
|
serialize(manager: EShapeResourceManagerSerialization): DDiagramSerializedItem;
|
|
@@ -72,6 +72,7 @@ export * from "./deserialize-bar";
|
|
|
72
72
|
export * from "./deserialize-base";
|
|
73
73
|
export * from "./deserialize-button";
|
|
74
74
|
export * from "./deserialize-circle";
|
|
75
|
+
export * from "./deserialize-connector-elbow";
|
|
75
76
|
export * from "./deserialize-connector-line";
|
|
76
77
|
export * from "./deserialize-embedded";
|
|
77
78
|
export * from "./deserialize-embedded-layer";
|
|
@@ -104,6 +105,8 @@ export * from "./e-shape-button-runtime-action";
|
|
|
104
105
|
export * from "./e-shape-button-runtime";
|
|
105
106
|
export * from "./e-shape-button";
|
|
106
107
|
export * from "./e-shape-circle";
|
|
108
|
+
export * from "./e-shape-connector-elbow-points-fillter";
|
|
109
|
+
export * from "./e-shape-connector-elbow";
|
|
107
110
|
export * from "./e-shape-connector-line";
|
|
108
111
|
export * from "./e-shape-embedded-datum";
|
|
109
112
|
export * from "./e-shape-embedded-layer-container";
|
|
@@ -6,14 +6,39 @@ var EShapeAcceptorImpl = /** @class */ (function () {
|
|
|
6
6
|
function EShapeAcceptorImpl() {
|
|
7
7
|
this._edges = new Map();
|
|
8
8
|
}
|
|
9
|
-
EShapeAcceptorImpl.prototype.add = function (id, type, x, y) {
|
|
9
|
+
EShapeAcceptorImpl.prototype.add = function (id, type, x, y, nx, ny) {
|
|
10
10
|
this._edges.set(id, {
|
|
11
11
|
type: type,
|
|
12
12
|
x: x,
|
|
13
|
-
y: y
|
|
13
|
+
y: y,
|
|
14
|
+
normal: this.toNormal(x, y, nx, ny)
|
|
14
15
|
});
|
|
15
16
|
return true;
|
|
16
17
|
};
|
|
18
|
+
EShapeAcceptorImpl.prototype.toNormal = function (x, y, nx, ny) {
|
|
19
|
+
if (nx != null && ny != null) {
|
|
20
|
+
return {
|
|
21
|
+
x: nx,
|
|
22
|
+
y: ny
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
var d = x * x + y * y;
|
|
27
|
+
if (0.00001 < d) {
|
|
28
|
+
var m = 1 / Math.sqrt(d);
|
|
29
|
+
return {
|
|
30
|
+
x: x * m,
|
|
31
|
+
y: y * m
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
return {
|
|
36
|
+
x: 1,
|
|
37
|
+
y: 0
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
17
42
|
EShapeAcceptorImpl.prototype.remove = function (id) {
|
|
18
43
|
var edges = this._edges;
|
|
19
44
|
var result = edges.get(id);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"e-shape-acceptor-impl.js","sourceRoot":"","sources":["../../../../src/main/typescript/wcardinal/ui/shape/e-shape-acceptor-impl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;IAGC;QACC,IAAI,CAAC,MAAM,GAAG,IAAI,GAAG,EAA8B,CAAC;IACrD,CAAC;
|
|
1
|
+
{"version":3,"file":"e-shape-acceptor-impl.js","sourceRoot":"","sources":["../../../../src/main/typescript/wcardinal/ui/shape/e-shape-acceptor-impl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;IAGC;QACC,IAAI,CAAC,MAAM,GAAG,IAAI,GAAG,EAA8B,CAAC;IACrD,CAAC;IAWD,gCAAG,GAAH,UACC,EAAU,EACV,IAAwB,EACxB,CAAS,EACT,CAAS,EACT,EAAW,EACX,EAAW;QAEX,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE;YACnB,IAAI,MAAA;YACJ,CAAC,GAAA;YACD,CAAC,GAAA;YACD,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC;SACnC,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACb,CAAC;IAES,qCAAQ,GAAlB,UAAmB,CAAS,EAAE,CAAS,EAAE,EAAW,EAAE,EAAW;QACh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,EAAE,CAAC,CAAC;IAC5B,CAAC;IAED,kCAAK,GAAL;QACC,IAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,EAAE;YACnB,KAAK,CAAC,KAAK,EAAE,CAAC;YACd,OAAO,IAAI,CAAC;SACZ;QACD,OAAO,KAAK,CAAC;IACd,CAAC;IACF,yBAAC;AAAD,CAAC,AA3FD,IA2FC","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { EShapeAcceptor, EShapeAcceptorEdge, EShapeAcceptorEdgeNormal } from \"./e-shape-acceptor\";\nimport { EShapeAcceptorType } from \"./e-shape-acceptor-type\";\n\nexport class EShapeAcceptorImpl implements EShapeAcceptor {\n\tprotected _edges: Map<string, EShapeAcceptorEdge>;\n\n\tconstructor() {\n\t\tthis._edges = new Map<string, EShapeAcceptorEdge>();\n\t}\n\n\tadd(id: string, type: EShapeAcceptorType, x: number, y: number): boolean;\n\tadd(\n\t\tid: string,\n\t\ttype: EShapeAcceptorType,\n\t\tx: number,\n\t\ty: number,\n\t\tnx: number,\n\t\tny: number\n\t): boolean;\n\tadd(\n\t\tid: string,\n\t\ttype: EShapeAcceptorType,\n\t\tx: number,\n\t\ty: number,\n\t\tnx?: number,\n\t\tny?: number\n\t): boolean {\n\t\tthis._edges.set(id, {\n\t\t\ttype,\n\t\t\tx,\n\t\t\ty,\n\t\t\tnormal: this.toNormal(x, y, nx, ny)\n\t\t});\n\t\treturn true;\n\t}\n\n\tprotected toNormal(x: number, y: number, nx?: number, ny?: number): EShapeAcceptorEdgeNormal {\n\t\tif (nx != null && ny != null) {\n\t\t\treturn {\n\t\t\t\tx: nx,\n\t\t\t\ty: ny\n\t\t\t};\n\t\t} else {\n\t\t\tconst d = x * x + y * y;\n\t\t\tif (0.00001 < d) {\n\t\t\t\tconst m = 1 / Math.sqrt(d);\n\t\t\t\treturn {\n\t\t\t\t\tx: x * m,\n\t\t\t\t\ty: y * m\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\treturn {\n\t\t\t\t\tx: 1,\n\t\t\t\t\ty: 0\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t}\n\n\tremove(id: string): EShapeAcceptorEdge | null {\n\t\tconst edges = this._edges;\n\t\tconst result = edges.get(id);\n\t\tif (result != null) {\n\t\t\tedges.delete(id);\n\t\t\treturn result;\n\t\t}\n\t\treturn null;\n\t}\n\n\tsize(): number {\n\t\treturn this._edges.size;\n\t}\n\n\tget(id: string): EShapeAcceptorEdge | null {\n\t\treturn this._edges.get(id) || null;\n\t}\n\n\teach(iteratee: (edge: EShapeAcceptorEdge, id: string) => void): this {\n\t\tthis._edges.forEach(iteratee);\n\t\treturn this;\n\t}\n\n\tcontains(id: string): boolean {\n\t\treturn this._edges.has(id);\n\t}\n\n\tclear(): boolean {\n\t\tconst edges = this._edges;\n\t\tif (0 < edges.size) {\n\t\t\tedges.clear();\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"e-shape-acceptor.js","sourceRoot":"","sources":["../../../../src/main/typescript/wcardinal/ui/shape/e-shape-acceptor.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { EShapeAcceptorType } from \"./e-shape-acceptor-type\";\n\nexport interface EShapeAcceptorEdge {\n\ttype: EShapeAcceptorType;\n\tx: number;\n\ty: number;\n}\n\nexport interface EShapeAcceptor {\n\tsize(): number;\n\tadd(id: string, type: EShapeAcceptorType, x: number, y: number): boolean;\n\tremove(id: string): EShapeAcceptorEdge | null;\n\tget(id: string): EShapeAcceptorEdge | null;\n\teach(iteratee: (edge: EShapeAcceptorEdge, id: string) => void): this;\n\tcontains(id: string): boolean;\n\tclear(): boolean;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"e-shape-acceptor.js","sourceRoot":"","sources":["../../../../src/main/typescript/wcardinal/ui/shape/e-shape-acceptor.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { EShapeAcceptorType } from \"./e-shape-acceptor-type\";\n\nexport interface EShapeAcceptorEdgeNormal {\n\tx: number;\n\ty: number;\n}\n\nexport interface EShapeAcceptorEdge {\n\ttype: EShapeAcceptorType;\n\tx: number;\n\ty: number;\n\tnormal: EShapeAcceptorEdgeNormal;\n}\n\nexport interface EShapeAcceptor {\n\tsize(): number;\n\tadd(id: string, type: EShapeAcceptorType, x: number, y: number): boolean;\n\tadd(\n\t\tid: string,\n\t\ttype: EShapeAcceptorType,\n\t\tx: number,\n\t\ty: number,\n\t\tnx: number,\n\t\tny: number\n\t): boolean;\n\tremove(id: string): EShapeAcceptorEdge | null;\n\tget(id: string): EShapeAcceptorEdge | null;\n\teach(iteratee: (edge: EShapeAcceptorEdge, id: string) => void): this;\n\tcontains(id: string): boolean;\n\tclear(): boolean;\n}\n"]}
|
|
@@ -29,15 +29,15 @@ var EShapeAcceptors = /** @class */ (function () {
|
|
|
29
29
|
};
|
|
30
30
|
EShapeAcceptors.newDefault = function () {
|
|
31
31
|
var result = new EShapeAcceptorImpl();
|
|
32
|
-
result.add("TOP", EShapeAcceptorType.ALL, 0, -0.5);
|
|
33
|
-
result.add("LEFT", EShapeAcceptorType.ALL, -0.5, 0);
|
|
34
|
-
result.add("RIGHT", EShapeAcceptorType.ALL, 0.5, 0);
|
|
35
|
-
result.add("BOTTOM", EShapeAcceptorType.ALL, 0, 0.5);
|
|
36
|
-
result.add("CENTER", EShapeAcceptorType.ALL, 0, 0);
|
|
37
|
-
result.add("TOP_LEFT", EShapeAcceptorType.ALL, -0.5, -0.5);
|
|
38
|
-
result.add("TOP_RIGHT", EShapeAcceptorType.ALL, 0.5, -0.5);
|
|
39
|
-
result.add("BOTTOM_LEFT", EShapeAcceptorType.ALL, -0.5, 0.5);
|
|
40
|
-
result.add("BOTTOM_RIGHT", EShapeAcceptorType.ALL, 0.5, 0.5);
|
|
32
|
+
result.add("TOP", EShapeAcceptorType.ALL, 0, -0.5, 0, -1);
|
|
33
|
+
result.add("LEFT", EShapeAcceptorType.ALL, -0.5, 0, -1, 0);
|
|
34
|
+
result.add("RIGHT", EShapeAcceptorType.ALL, 0.5, 0, 1, 0);
|
|
35
|
+
result.add("BOTTOM", EShapeAcceptorType.ALL, 0, 0.5, 0, 1);
|
|
36
|
+
result.add("CENTER", EShapeAcceptorType.ALL, 0, 0, -1, 0);
|
|
37
|
+
result.add("TOP_LEFT", EShapeAcceptorType.ALL, -0.5, -0.5, -1, 0);
|
|
38
|
+
result.add("TOP_RIGHT", EShapeAcceptorType.ALL, 0.5, -0.5, 1, 0);
|
|
39
|
+
result.add("BOTTOM_LEFT", EShapeAcceptorType.ALL, -0.5, 0.5, -1, 0);
|
|
40
|
+
result.add("BOTTOM_RIGHT", EShapeAcceptorType.ALL, 0.5, 0.5, 1, 0);
|
|
41
41
|
return result;
|
|
42
42
|
};
|
|
43
43
|
return EShapeAcceptors;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"e-shape-acceptors.js","sourceRoot":"","sources":["../../../../src/main/typescript/wcardinal/ui/shape/e-shape-acceptors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAG7D;IAAA;IAuCA,CAAC;IAnCO,mBAAG,GAAV,UAAW,IAAgB,EAAE,QAAwB;QACpD,IAAI,cAAc,GAAG,IAAI,CAAC,eAAe,CAAC;QAC1C,IAAI,cAAc,IAAI,IAAI,EAAE;YAC3B,cAAc,GAAG,IAAI,GAAG,EAA8B,CAAC;YACvD,IAAI,CAAC,e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CAAC,EAAE,CAAC,CAAC,CAAC;QAClE,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACjE,MAAM,CAAC,GAAG,CAAC,aAAa,EAAE,kBAAkB,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACpE,MAAM,CAAC,GAAG,CAAC,cAAc,EAAE,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACnE,OAAO,MAAM,CAAC;IACf,CAAC;IACF,sBAAC;AAAD,CAAC,AAvCD,IAuCC","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { EShapeAcceptor } from \"./e-shape-acceptor\";\nimport { EShapeAcceptorImpl } from \"./e-shape-acceptor-impl\";\nimport { EShapeAcceptorType } from \"./e-shape-acceptor-type\";\nimport { EShapeType } from \"./e-shape-type\";\n\nexport class EShapeAcceptors {\n\tprotected static _default?: EShapeAcceptor;\n\tprotected static _typeToAcceptor?: Map<EShapeType, EShapeAcceptor>;\n\n\tstatic set(type: EShapeType, acceptor: EShapeAcceptor): void {\n\t\tlet typeToAcceptor = this._typeToAcceptor;\n\t\tif (typeToAcceptor == null) {\n\t\t\ttypeToAcceptor = new Map<EShapeType, EShapeAcceptor>();\n\t\t\tthis._typeToAcceptor = typeToAcceptor;\n\t\t}\n\t\ttypeToAcceptor.set(type, acceptor);\n\t}\n\n\tstatic get(type: EShapeType): EShapeAcceptor {\n\t\treturn this._typeToAcceptor?.get(type) || this.getDefault();\n\t}\n\n\tprotected static getDefault(): EShapeAcceptor {\n\t\tlet result = this._default;\n\t\tif (result == null) {\n\t\t\tresult = this.newDefault();\n\t\t\tthis._default = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected static newDefault(): EShapeAcceptor {\n\t\tconst result = new EShapeAcceptorImpl();\n\t\tresult.add(\"TOP\", EShapeAcceptorType.ALL, 0, -0.5, 0, -1);\n\t\tresult.add(\"LEFT\", EShapeAcceptorType.ALL, -0.5, 0, -1, 0);\n\t\tresult.add(\"RIGHT\", EShapeAcceptorType.ALL, 0.5, 0, 1, 0);\n\t\tresult.add(\"BOTTOM\", EShapeAcceptorType.ALL, 0, 0.5, 0, 1);\n\t\tresult.add(\"CENTER\", EShapeAcceptorType.ALL, 0, 0, -1, 0);\n\t\tresult.add(\"TOP_LEFT\", EShapeAcceptorType.ALL, -0.5, -0.5, -1, 0);\n\t\tresult.add(\"TOP_RIGHT\", EShapeAcceptorType.ALL, 0.5, -0.5, 1, 0);\n\t\tresult.add(\"BOTTOM_LEFT\", EShapeAcceptorType.ALL, -0.5, 0.5, -1, 0);\n\t\tresult.add(\"BOTTOM_RIGHT\", EShapeAcceptorType.ALL, 0.5, 0.5, 1, 0);\n\t\treturn result;\n\t}\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (C) 2019 Toshiba Corporation
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { Matrix, ObservablePoint } from "pixi.js";
|
|
6
6
|
import { EShapeAcceptors } from "./e-shape-acceptors";
|
|
7
7
|
import { EShapeConnectorEdgeAcceptorImpl } from "./e-shape-connector-edge-acceptor-impl";
|
|
8
8
|
var EShapeConnectorEdgeImpl = /** @class */ (function () {
|
|
@@ -16,10 +16,16 @@ var EShapeConnectorEdgeImpl = /** @class */ (function () {
|
|
|
16
16
|
}, undefined);
|
|
17
17
|
this._localIdRequired = 0;
|
|
18
18
|
this._localId = 0;
|
|
19
|
+
this._normal = new ObservablePoint(function () {
|
|
20
|
+
_this.onNormalChange();
|
|
21
|
+
}, undefined);
|
|
22
|
+
this._normalIdRequired = 0;
|
|
23
|
+
this._normalId = 0;
|
|
19
24
|
this._margin = 0;
|
|
20
25
|
this._lockCount = 0;
|
|
21
26
|
this._isAcceptorChanged = false;
|
|
22
27
|
this._isLocalChanged = false;
|
|
28
|
+
this._isNormalChanged = false;
|
|
23
29
|
this._isOtherChanged = false;
|
|
24
30
|
}
|
|
25
31
|
EShapeConnectorEdgeImpl.prototype.lock = function () {
|
|
@@ -27,20 +33,40 @@ var EShapeConnectorEdgeImpl = /** @class */ (function () {
|
|
|
27
33
|
if (this._lockCount === 1) {
|
|
28
34
|
this._isAcceptorChanged = false;
|
|
29
35
|
this._isLocalChanged = false;
|
|
36
|
+
this._isNormalChanged = false;
|
|
30
37
|
this._isOtherChanged = false;
|
|
31
38
|
}
|
|
32
39
|
};
|
|
33
40
|
EShapeConnectorEdgeImpl.prototype.unlock = function () {
|
|
34
41
|
this._lockCount -= 1;
|
|
35
42
|
if (this._lockCount === 0) {
|
|
43
|
+
var isChanged = false;
|
|
36
44
|
if (this._isLocalChanged) {
|
|
37
|
-
this.
|
|
45
|
+
this._localIdRequired += 1;
|
|
46
|
+
this._localId = this._localIdRequired;
|
|
47
|
+
isChanged = true;
|
|
38
48
|
}
|
|
39
|
-
|
|
40
|
-
this.
|
|
49
|
+
if (this._isNormalChanged) {
|
|
50
|
+
this._normalIdRequired += 1;
|
|
51
|
+
this._normalId = this._normalIdRequired;
|
|
52
|
+
isChanged = true;
|
|
41
53
|
}
|
|
42
|
-
|
|
43
|
-
|
|
54
|
+
if (this._isOtherChanged) {
|
|
55
|
+
isChanged = true;
|
|
56
|
+
}
|
|
57
|
+
if (this._isAcceptorChanged) {
|
|
58
|
+
if (!this._isLocalChanged) {
|
|
59
|
+
this._localIdRequired += 1;
|
|
60
|
+
}
|
|
61
|
+
if (!this._isNormalChanged) {
|
|
62
|
+
this._normalIdRequired += 1;
|
|
63
|
+
}
|
|
64
|
+
if (this.doFit()) {
|
|
65
|
+
isChanged = false;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (isChanged) {
|
|
69
|
+
this._onChange();
|
|
44
70
|
}
|
|
45
71
|
}
|
|
46
72
|
};
|
|
@@ -65,6 +91,20 @@ var EShapeConnectorEdgeImpl = /** @class */ (function () {
|
|
|
65
91
|
enumerable: false,
|
|
66
92
|
configurable: true
|
|
67
93
|
});
|
|
94
|
+
Object.defineProperty(EShapeConnectorEdgeImpl.prototype, "normal", {
|
|
95
|
+
get: function () {
|
|
96
|
+
return this._normal;
|
|
97
|
+
},
|
|
98
|
+
enumerable: false,
|
|
99
|
+
configurable: true
|
|
100
|
+
});
|
|
101
|
+
Object.defineProperty(EShapeConnectorEdgeImpl.prototype, "normalId", {
|
|
102
|
+
get: function () {
|
|
103
|
+
return this._normalId;
|
|
104
|
+
},
|
|
105
|
+
enumerable: false,
|
|
106
|
+
configurable: true
|
|
107
|
+
});
|
|
68
108
|
Object.defineProperty(EShapeConnectorEdgeImpl.prototype, "margin", {
|
|
69
109
|
get: function () {
|
|
70
110
|
return this._margin;
|
|
@@ -78,14 +118,28 @@ var EShapeConnectorEdgeImpl = /** @class */ (function () {
|
|
|
78
118
|
enumerable: false,
|
|
79
119
|
configurable: true
|
|
80
120
|
});
|
|
81
|
-
EShapeConnectorEdgeImpl.prototype.set = function (shape, edge, margin,
|
|
121
|
+
EShapeConnectorEdgeImpl.prototype.set = function (shape, edge, margin, x, y, nx, ny) {
|
|
82
122
|
this.lock();
|
|
83
123
|
this._acceptor.set(shape, edge);
|
|
84
|
-
|
|
85
|
-
|
|
124
|
+
var local = this._local;
|
|
125
|
+
if (x != null && y != null) {
|
|
126
|
+
local.set(x, y);
|
|
127
|
+
}
|
|
128
|
+
else if (x != null) {
|
|
129
|
+
local.x = x;
|
|
130
|
+
}
|
|
131
|
+
else if (y != null) {
|
|
132
|
+
local.y = y;
|
|
86
133
|
}
|
|
87
|
-
|
|
88
|
-
|
|
134
|
+
var normal = this._normal;
|
|
135
|
+
if (nx != null && ny != null) {
|
|
136
|
+
normal.set(nx, ny);
|
|
137
|
+
}
|
|
138
|
+
else if (nx != null) {
|
|
139
|
+
normal.x = nx;
|
|
140
|
+
}
|
|
141
|
+
else if (ny != null) {
|
|
142
|
+
normal.y = ny;
|
|
89
143
|
}
|
|
90
144
|
if (margin != null) {
|
|
91
145
|
this.margin = margin;
|
|
@@ -97,6 +151,7 @@ var EShapeConnectorEdgeImpl = /** @class */ (function () {
|
|
|
97
151
|
this.lock();
|
|
98
152
|
this._acceptor.copy(source.acceptor);
|
|
99
153
|
this._local.copyFrom(source.local);
|
|
154
|
+
this._normal.copyFrom(source.normal);
|
|
100
155
|
this.margin = source.margin;
|
|
101
156
|
this.unlock();
|
|
102
157
|
return this;
|
|
@@ -108,7 +163,8 @@ var EShapeConnectorEdgeImpl = /** @class */ (function () {
|
|
|
108
163
|
var edge = acceptor.edge;
|
|
109
164
|
var edgeId = edge != null ? manager.addResource(edge) : -1;
|
|
110
165
|
var local = this._local;
|
|
111
|
-
|
|
166
|
+
var normal = this._normal;
|
|
167
|
+
return manager.addResource("[".concat(shapeUuid, ",").concat(edgeId, ",").concat(local.x, ",").concat(local.y, ",").concat(this._margin, ",").concat(normal.x, ",").concat(normal.y, "]"));
|
|
112
168
|
};
|
|
113
169
|
EShapeConnectorEdgeImpl.prototype.deserialize = function (resourceId, mapping, manager) {
|
|
114
170
|
var resources = manager.resources;
|
|
@@ -129,6 +185,15 @@ var EShapeConnectorEdgeImpl = /** @class */ (function () {
|
|
|
129
185
|
var edgeId = parsed[1];
|
|
130
186
|
acceptor.edge = 0 <= edgeId && edgeId < resources.length ? resources[edgeId] : null;
|
|
131
187
|
this._local.set(parsed[2], parsed[3]);
|
|
188
|
+
var normalX = parsed[5];
|
|
189
|
+
var normalY = parsed[6];
|
|
190
|
+
var normal = this._normal;
|
|
191
|
+
if (normalX != null && normalY != null) {
|
|
192
|
+
normal.set(normalX, normalY);
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
normal.set(1, 0);
|
|
196
|
+
}
|
|
132
197
|
this.margin = parsed[4] || 0;
|
|
133
198
|
this.unlock();
|
|
134
199
|
if (shape) {
|
|
@@ -137,43 +202,80 @@ var EShapeConnectorEdgeImpl = /** @class */ (function () {
|
|
|
137
202
|
}
|
|
138
203
|
};
|
|
139
204
|
EShapeConnectorEdgeImpl.prototype.fit = function (forcibly) {
|
|
140
|
-
var _a;
|
|
141
205
|
if (forcibly) {
|
|
142
206
|
this._localIdRequired += 1;
|
|
207
|
+
this._normalIdRequired += 1;
|
|
143
208
|
}
|
|
209
|
+
this.doFit();
|
|
210
|
+
return this;
|
|
211
|
+
};
|
|
212
|
+
EShapeConnectorEdgeImpl.prototype.doFit = function () {
|
|
144
213
|
var localIdRequired = this._localIdRequired;
|
|
145
|
-
|
|
214
|
+
var isLocalDirty = this._localId !== localIdRequired;
|
|
215
|
+
var normalIdRequired = this._normalIdRequired;
|
|
216
|
+
var isNormalDirty = this._normalId !== normalIdRequired;
|
|
217
|
+
if (isLocalDirty || isNormalDirty) {
|
|
146
218
|
this._localId = localIdRequired;
|
|
219
|
+
this._normalId = normalIdRequired;
|
|
147
220
|
var acceptor = this._acceptor;
|
|
148
221
|
var acceptorShape = acceptor.shape;
|
|
149
222
|
var acceptorEdge = acceptor.edge;
|
|
150
223
|
if (acceptorShape != null && acceptorEdge != null) {
|
|
151
224
|
var edge = EShapeAcceptors.get(acceptorShape.type).get(acceptorEdge);
|
|
152
225
|
if (edge) {
|
|
153
|
-
var
|
|
154
|
-
var
|
|
155
|
-
var
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
var
|
|
159
|
-
var
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
226
|
+
var transform = this.toAcceptorTransform(acceptorShape);
|
|
227
|
+
var a = transform.a;
|
|
228
|
+
var b = transform.b;
|
|
229
|
+
var c = transform.c;
|
|
230
|
+
var d = transform.d;
|
|
231
|
+
var tx = transform.tx;
|
|
232
|
+
var ty = transform.ty;
|
|
233
|
+
this.lock();
|
|
234
|
+
if (isLocalDirty) {
|
|
235
|
+
var size = acceptorShape.size;
|
|
236
|
+
var pivot = acceptorShape.transform.pivot;
|
|
237
|
+
var lx = pivot.x + size.x * edge.x;
|
|
238
|
+
var ly = pivot.y + size.y * edge.y;
|
|
239
|
+
this._local.set(a * lx + c * ly + tx, b * lx + d * ly + ty);
|
|
240
|
+
}
|
|
241
|
+
if (isNormalDirty) {
|
|
242
|
+
var edgeNormal = edge.normal;
|
|
243
|
+
var nx = edgeNormal.x;
|
|
244
|
+
var ny = edgeNormal.y;
|
|
245
|
+
this._normal.set(a * nx + c * ny, b * nx + d * ny);
|
|
163
246
|
}
|
|
164
|
-
this.
|
|
247
|
+
var result = this._isLocalChanged || this._isNormalChanged;
|
|
248
|
+
this.unlock();
|
|
249
|
+
return result;
|
|
165
250
|
}
|
|
166
251
|
}
|
|
167
252
|
}
|
|
168
|
-
return
|
|
253
|
+
return false;
|
|
254
|
+
};
|
|
255
|
+
EShapeConnectorEdgeImpl.prototype.toAcceptorTransform = function (shape) {
|
|
256
|
+
var _a;
|
|
257
|
+
shape.updateTransform();
|
|
258
|
+
var parent = this._parent;
|
|
259
|
+
var parentParent = parent.parent;
|
|
260
|
+
if (parentParent) {
|
|
261
|
+
parent.updateTransform();
|
|
262
|
+
return ((_a = EShapeConnectorEdgeImpl.WORK_MATRIX) !== null && _a !== void 0 ? _a : (EShapeConnectorEdgeImpl.WORK_MATRIX = new Matrix()))
|
|
263
|
+
.copyFrom(parentParent.transform.worldTransform)
|
|
264
|
+
.invert()
|
|
265
|
+
.append(shape.transform.worldTransform);
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
return shape.transform.worldTransform;
|
|
269
|
+
}
|
|
169
270
|
};
|
|
170
271
|
EShapeConnectorEdgeImpl.prototype.onAcceptorChange = function () {
|
|
171
272
|
if (0 < this._lockCount) {
|
|
273
|
+
this._isLocalChanged = false;
|
|
274
|
+
this._isNormalChanged = false;
|
|
172
275
|
this._isAcceptorChanged = true;
|
|
173
276
|
return;
|
|
174
277
|
}
|
|
175
|
-
this.
|
|
176
|
-
this.fit();
|
|
278
|
+
this.fit(true);
|
|
177
279
|
};
|
|
178
280
|
EShapeConnectorEdgeImpl.prototype.onLocalChange = function () {
|
|
179
281
|
if (0 < this._lockCount) {
|
|
@@ -184,6 +286,15 @@ var EShapeConnectorEdgeImpl = /** @class */ (function () {
|
|
|
184
286
|
this._localId = this._localIdRequired;
|
|
185
287
|
this._onChange();
|
|
186
288
|
};
|
|
289
|
+
EShapeConnectorEdgeImpl.prototype.onNormalChange = function () {
|
|
290
|
+
if (0 < this._lockCount) {
|
|
291
|
+
this._isNormalChanged = true;
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
this._normalIdRequired += 1;
|
|
295
|
+
this._normalId = this._normalIdRequired;
|
|
296
|
+
this._onChange();
|
|
297
|
+
};
|
|
187
298
|
EShapeConnectorEdgeImpl.prototype.onOtherChange = function () {
|
|
188
299
|
if (0 < this._lockCount) {
|
|
189
300
|
this._isOtherChanged = true;
|