@wcardinal/wcardinal-ui 0.375.0 → 0.376.0
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/index.d.ts +0 -1
- package/dist/types/wcardinal/ui/shape/variant/e-shape-base.d.ts +3 -3
- package/dist/types/wcardinal/ui/shape/variant/e-shape-connector-line.d.ts +1 -1
- package/dist/types/wcardinal/ui/shape/variant/e-shape-group-size-layout.d.ts +3 -1
- package/dist/types/wcardinal/ui/shape/variant/e-shape-lock-part.d.ts +8 -5
- package/dist/wcardinal/ui/shape/index.js +0 -1
- package/dist/wcardinal/ui/shape/index.js.map +1 -1
- package/dist/wcardinal/ui/shape/variant/e-shape-base.js +64 -44
- package/dist/wcardinal/ui/shape/variant/e-shape-base.js.map +1 -1
- package/dist/wcardinal/ui/shape/variant/e-shape-connector-line.js +9 -6
- package/dist/wcardinal/ui/shape/variant/e-shape-connector-line.js.map +1 -1
- package/dist/wcardinal/ui/shape/variant/e-shape-group-size-editor.js +3 -2
- package/dist/wcardinal/ui/shape/variant/e-shape-group-size-editor.js.map +1 -1
- package/dist/wcardinal/ui/shape/variant/e-shape-group-size-layout.js +67 -4
- package/dist/wcardinal/ui/shape/variant/e-shape-group-size-layout.js.map +1 -1
- package/dist/wcardinal/ui/shape/variant/e-shape-lock-part.js +8 -5
- package/dist/wcardinal/ui/shape/variant/e-shape-lock-part.js.map +1 -1
- package/dist/wcardinal-ui-theme-dark.js +9 -4
- package/dist/wcardinal-ui-theme-dark.min.js +2 -2
- package/dist/wcardinal-ui-theme-dark.min.js.map +1 -1
- package/dist/wcardinal-ui-theme-white.js +9 -4
- package/dist/wcardinal-ui-theme-white.min.js +2 -2
- package/dist/wcardinal-ui-theme-white.min.js.map +1 -1
- package/dist/wcardinal-ui.cjs.js +156 -171
- package/dist/wcardinal-ui.js +156 -171
- package/dist/wcardinal-ui.min.js +2 -2
- package/dist/wcardinal-ui.min.js.map +1 -1
- package/package.json +8 -8
- package/dist/types/wcardinal/ui/shape/e-shape-transforms.d.ts +0 -9
- package/dist/wcardinal/ui/shape/e-shape-transforms.js +0 -115
- package/dist/wcardinal/ui/shape/e-shape-transforms.js.map +0 -1
|
@@ -25,7 +25,7 @@ var EShapeConnectorLine = /** @class */ (function (_super) {
|
|
|
25
25
|
_this._headNormalId = 0;
|
|
26
26
|
_this._headMargin = 0;
|
|
27
27
|
_this._bodyId = 0;
|
|
28
|
-
_this.
|
|
28
|
+
_this._lockConnector = new EShapeLock();
|
|
29
29
|
var sx = EShapeDefaults.SIZE_X;
|
|
30
30
|
var sy = EShapeDefaults.SIZE_Y;
|
|
31
31
|
var hx = sx * 0.5;
|
|
@@ -39,19 +39,20 @@ var EShapeConnectorLine = /** @class */ (function (_super) {
|
|
|
39
39
|
return _this;
|
|
40
40
|
}
|
|
41
41
|
EShapeConnectorLine.prototype.lock = function (part) {
|
|
42
|
-
_super.prototype.lock.call(this, part);
|
|
43
42
|
if (part & EShapeLockPart.CONNECTOR) {
|
|
44
|
-
this.
|
|
43
|
+
this._lockConnector.lock();
|
|
45
44
|
}
|
|
45
|
+
_super.prototype.lock.call(this, part);
|
|
46
46
|
return this;
|
|
47
47
|
};
|
|
48
48
|
EShapeConnectorLine.prototype.unlock = function (part, invoke) {
|
|
49
|
+
_super.prototype.unlock.call(this, part, invoke);
|
|
49
50
|
if (part & EShapeLockPart.CONNECTOR) {
|
|
50
|
-
if (this.
|
|
51
|
+
if (this._lockConnector.unlock() && invoke) {
|
|
51
52
|
this.onChange();
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
|
-
return
|
|
55
|
+
return this;
|
|
55
56
|
};
|
|
56
57
|
Object.defineProperty(EShapeConnectorLine.prototype, "points", {
|
|
57
58
|
get: function () {
|
|
@@ -84,7 +85,7 @@ var EShapeConnectorLine = /** @class */ (function (_super) {
|
|
|
84
85
|
};
|
|
85
86
|
EShapeConnectorLine.prototype.onChange = function () {
|
|
86
87
|
var _a;
|
|
87
|
-
if (this.
|
|
88
|
+
if (this._lockConnector.isLocked()) {
|
|
88
89
|
return;
|
|
89
90
|
}
|
|
90
91
|
var edge = this._edge;
|
|
@@ -210,11 +211,13 @@ var EShapeConnectorLine = /** @class */ (function (_super) {
|
|
|
210
211
|
};
|
|
211
212
|
EShapeConnectorLine.prototype.copy = function (source, part) {
|
|
212
213
|
if (part === void 0) { part = EShapeCopyPart.ALL; }
|
|
214
|
+
this.lock(EShapeLockPart.ALL);
|
|
213
215
|
_super.prototype.copy.call(this, source, part);
|
|
214
216
|
if (source instanceof EShapeConnectorLine) {
|
|
215
217
|
this._edge.copy(source.edge);
|
|
216
218
|
this._body.copy(source.body);
|
|
217
219
|
}
|
|
220
|
+
this.unlock(EShapeLockPart.ALL, true);
|
|
218
221
|
return this;
|
|
219
222
|
};
|
|
220
223
|
EShapeConnectorLine.prototype.clone = function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"e-shape-connector-line.js","sourceRoot":"","sources":["../../../../../src/main/typescript/wcardinal/ui/shape/variant/e-shape-connector-line.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C,OAAO,EAAE,gCAAgC,EAAE,MAAM,0CAA0C,CAAC;AAC5F,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAItD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C;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;IAED,kCAAI,GAAJ,UAAK,MAAc,EAAE,IAAyC;QAAzC,qBAAA,EAAA,OAAuB,cAAc,CAAC,GAAG;QAC7D,iBAAM,IAAI,YAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACzB,IAAI,MAAM,YAAY,mBAAmB,EAAE;YAC1C,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAC7B,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;SAC7B;QACD,OAAO,IAAI,CAAC;IACb,CAAC;IAED,mCAAK,GAAL;QACC,IAAM,WAAW,GAAG,IAAI,CAAC,WAAyC,CAAC;QACnE,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9C,CAAC;IAED,uCAAS,GAAT,UAAU,OAA2C;QACpD,IAAM,MAAM,GAAG,iBAAM,SAAS,YAAC,OAAO,CAAC,CAAC;QACxC,IAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAC7C,IAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAC7C,IAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QACjD,MAAM,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,WAAI,MAAM,cAAI,QAAQ,cAAI,MAAM,MAAG,CAAC,CAAC;QACtE,OAAO,MAAM,CAAC;IACf,CAAC;IACF,0BAAC;AAAD,CAAC,AAzPD,CAAyC,cAAc,GAyPtD","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { EShapeType } from \"../e-shape-type\";\nimport { EShapeConnector } from \"../e-shape-connector\";\nimport { EShapeConnectorEdgeContainer } from \"../e-shape-connector-edge-container\";\nimport { EShapeConnectorEdgeContainerImpl } from \"../e-shape-connector-edge-container-impl\";\nimport { EShapeLineBase } from \"./e-shape-line-base\";\nimport { EShapeLinePoints } from \"./e-shape-line-points\";\nimport { EShapeDefaults } from \"../e-shape-defaults\";\nimport { EShapeCopyPart } from \"../e-shape-copy-part\";\nimport { DDiagramSerializedItem } from \"../../d-diagram-serialized\";\nimport { EShapeResourceManagerSerialization } from \"../e-shape-resource-manager-serialization\";\nimport { EShape } from \"../e-shape\";\nimport { toPointsBoundary } from \"../e-shape-points-formatted\";\nimport { EShapeConnectorBody } from \"../e-shape-connector-body\";\nimport { EShapeConnectorBodyImpl } from \"../e-shape-connector-body-impl\";\nimport { EShapeConnectorEdge } from \"../e-shape-connector-edge\";\nimport { EShapeLockPart } from \"./e-shape-lock-part\";\nimport { EShapeLock } from \"./e-shape-lock\";\n\nexport class EShapeConnectorLine extends EShapeLineBase implements EShapeConnector {\n\tprotected static WORK_BOUNDARY: [number, number, number, number];\n\tprotected _edge: EShapeConnectorEdgeContainer;\n\tprotected _body: EShapeConnectorBody;\n\tprotected declare _points: EShapeLinePoints;\n\tprotected _tailLocalId: number;\n\tprotected _tailNormalId: number;\n\tprotected _tailMargin: number;\n\tprotected _headLocalId: number;\n\tprotected _headNormalId: number;\n\tprotected _headMargin: number;\n\tprotected _bodyId: number;\n\tprotected _lockChange: EShapeLock;\n\n\tconstructor(type: EShapeType = EShapeType.CONNECTOR_LINE) {\n\t\tsuper(type);\n\t\tthis._tailLocalId = 0;\n\t\tthis._tailNormalId = 0;\n\t\tthis._tailMargin = 0;\n\t\tthis._headLocalId = 0;\n\t\tthis._headNormalId = 0;\n\t\tthis._headMargin = 0;\n\t\tthis._bodyId = 0;\n\t\tthis._lockChange = new EShapeLock();\n\t\tconst sx = EShapeDefaults.SIZE_X;\n\t\tconst sy = EShapeDefaults.SIZE_Y;\n\t\tconst hx = sx * 0.5;\n\t\tconst hy = sy * 0.5;\n\t\tthis._points = new EShapeLinePoints(this).set([-hx, -hy, +hx, +hy]);\n\t\tconst onChangeBound = (): void => {\n\t\t\tthis.onChange();\n\t\t};\n\t\tthis._edge = new EShapeConnectorEdgeContainerImpl(this, onChangeBound);\n\t\tthis._body = new EShapeConnectorBodyImpl(this, onChangeBound);\n\t}\n\n\toverride lock(part: EShapeLockPart): this {\n\t\tsuper.lock(part);\n\t\tif (part & EShapeLockPart.CONNECTOR) {\n\t\t\tthis._lockChange.lock();\n\t\t}\n\t\treturn this;\n\t}\n\n\toverride unlock(part: EShapeLockPart, invoke: boolean): this {\n\t\tif (part & EShapeLockPart.CONNECTOR) {\n\t\t\tif (this._lockChange.unlock() && invoke) {\n\t\t\t\tthis.onChange();\n\t\t\t}\n\t\t}\n\t\treturn super.unlock(part, invoke);\n\t}\n\n\tget points(): EShapeLinePoints {\n\t\treturn this._points;\n\t}\n\n\tget edge(): EShapeConnectorEdgeContainer {\n\t\treturn this._edge;\n\t}\n\n\tget body(): EShapeConnectorBody {\n\t\treturn this._body;\n\t}\n\n\tonAttach(): void {\n\t\tsuper.onAttach();\n\t\tthis._edge.attach();\n\t}\n\n\tonDetach(exceptions?: Set<EShape>): void {\n\t\tthis._edge.detach(exceptions);\n\t\tsuper.onDetach(exceptions);\n\t}\n\n\tprotected onChange(): void {\n\t\tif (this._lockChange.isLocked()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst edge = this._edge;\n\t\tconst tail = edge.tail;\n\t\tconst tailLocalId = tail.localId;\n\t\tconst tailNormalId = tail.normalId;\n\t\tconst tailMargin = tail.margin;\n\t\tconst head = edge.head;\n\t\tconst headLocalId = head.localId;\n\t\tconst headNormalId = head.normalId;\n\t\tconst headMargin = head.margin;\n\t\tconst body = this._body;\n\t\tconst bodyId = body.id;\n\t\tif (\n\t\t\tthis._tailLocalId !== tailLocalId ||\n\t\t\tthis._tailNormalId !== tailNormalId ||\n\t\t\tthis._tailMargin !== tailMargin ||\n\t\t\tthis._headLocalId !== headLocalId ||\n\t\t\tthis._headNormalId !== headNormalId ||\n\t\t\tthis._headMargin !== headMargin ||\n\t\t\tthis._bodyId !== bodyId\n\t\t) {\n\t\t\tthis._tailLocalId = tailLocalId;\n\t\t\tthis._tailNormalId = tailNormalId;\n\t\t\tthis._tailMargin = tailMargin;\n\t\t\tthis._headLocalId = headLocalId;\n\t\t\tthis._headNormalId = headNormalId;\n\t\t\tthis._headMargin = headMargin;\n\t\t\tthis._bodyId !== bodyId;\n\n\t\t\tconst transform = this.transform;\n\t\t\tconst transformPosition = transform.position;\n\t\t\tconst px = transformPosition.x;\n\t\t\tconst py = transformPosition.y;\n\t\t\tconst points = this._points;\n\t\t\tconst values = points.values;\n\n\t\t\t// Fill points\n\t\t\tthis.fillPoints(tail, tailMargin, head, headMargin, body, px, py, values);\n\n\t\t\t// Center & size\n\t\t\tconst boundary = (EShapeConnectorLine.WORK_BOUNDARY ??= [0, 0, 0, 0]);\n\t\t\ttoPointsBoundary(values, boundary);\n\t\t\tconst cx = (boundary[2] + boundary[0]) * 0.5;\n\t\t\tconst cy = (boundary[3] + boundary[1]) * 0.5;\n\t\t\tconst sx = boundary[2] - boundary[0];\n\t\t\tconst sy = boundary[3] - boundary[1];\n\n\t\t\t// Adjust values\n\t\t\tfor (let i = 0, imax = values.length; i < imax; i += 2) {\n\t\t\t\tvalues[i + 0] -= cx;\n\t\t\t\tvalues[i + 1] -= cy;\n\t\t\t}\n\n\t\t\tthis.lock(EShapeLockPart.TRANSFORM_AND_UPLOADED);\n\t\t\ttransformPosition.set(px + cx, py + cy);\n\t\t\ttransform.scale.set(1, 1);\n\t\t\ttransform.rotation = 0;\n\t\t\ttransform.skew.set(0, 0);\n\t\t\tpoints.toFitted(sx, sy);\n\t\t\tthis.size.set(sx, sy);\n\t\t\tpoints.set(values);\n\t\t\tthis.unlock(EShapeLockPart.TRANSFORM_AND_UPLOADED, true);\n\t\t}\n\t}\n\n\tprotected fillPoints(\n\t\ttail: EShapeConnectorEdge,\n\t\ttailMargin: number,\n\t\thead: EShapeConnectorEdge,\n\t\theadMargin: number,\n\t\tbody: EShapeConnectorBody,\n\t\tpx: number,\n\t\tpy: number,\n\t\tvalues: number[]\n\t): void {\n\t\t// Tail\n\t\tconst threshold = 0.000001;\n\t\tconst tailLocal = tail.local;\n\t\tconst tailLocalX = tailLocal.x;\n\t\tconst tailLocalY = tailLocal.y;\n\t\tconst x0 = tailLocalX - px;\n\t\tconst y0 = tailLocalY - py;\n\n\t\t// Head\n\t\tconst headLocal = head.local;\n\t\tconst headLocalX = headLocal.x;\n\t\tconst headLocalY = headLocal.y;\n\t\tconst x1 = headLocalX - px;\n\t\tconst y1 = headLocalY - py;\n\n\t\t// Body\n\t\tconst bodyValues = body.values;\n\t\tconst bodyValuesLength = bodyValues.length;\n\n\t\t// Tail points\n\t\tvalues[0] = x0;\n\t\tvalues[1] = y0;\n\n\t\t// Body points\n\t\tif (0 < bodyValuesLength) {\n\t\t\tconst cx = (x1 + x0) * 0.5;\n\t\t\tconst cy = (y1 + y0) * 0.5;\n\t\t\tconst dx = x1 - x0;\n\t\t\tconst dy = y1 - y0;\n\t\t\tconst a = Math.atan2(dy, dx);\n\t\t\tconst c = Math.cos(a);\n\t\t\tconst s = Math.sin(a);\n\t\t\tconst l = Math.sqrt(dx * dx + dy * dy);\n\t\t\tfor (let i = 0; i < bodyValuesLength; i += 2) {\n\t\t\t\tconst x = bodyValues[i + 0];\n\t\t\t\tconst y = bodyValues[i + 1];\n\t\t\t\tvalues[i + 2] = cx + (c * x - s * y) * l;\n\t\t\t\tvalues[i + 3] = cy + (c * y + s * x) * l;\n\t\t\t}\n\t\t}\n\n\t\t// Head points\n\t\tvalues[2 + bodyValuesLength] = x1;\n\t\tvalues[3 + bodyValuesLength] = y1;\n\n\t\t// Tail margin\n\t\tif (tailMargin !== 0) {\n\t\t\tconst dx = values[2] - x0;\n\t\t\tconst dy = values[3] - y0;\n\t\t\tconst d = dx * dx + dy * dy;\n\t\t\tif (threshold < d) {\n\t\t\t\tconst f = tailMargin / Math.sqrt(dx * dx + dy * dy);\n\t\t\t\tvalues[0] = x0 + dx * f;\n\t\t\t\tvalues[1] = y0 + dy * f;\n\t\t\t}\n\t\t}\n\n\t\t// Head margin\n\t\tif (headMargin !== 0) {\n\t\t\tconst dx = values[0 + bodyValuesLength] - x1;\n\t\t\tconst dy = values[1 + bodyValuesLength] - y1;\n\t\t\tconst d = dx * dx + dy * dy;\n\t\t\tif (threshold < d) {\n\t\t\t\tconst f = headMargin / Math.sqrt(dx * dx + dy * dy);\n\t\t\t\tvalues[2 + bodyValuesLength] = x1 + dx * f;\n\t\t\t\tvalues[3 + bodyValuesLength] = y1 + dy * f;\n\t\t\t}\n\t\t}\n\n\t\t// Remove the rest\n\t\tvalues.length = bodyValuesLength + 4;\n\t}\n\n\tcopy(source: EShape, part: EShapeCopyPart = EShapeCopyPart.ALL): this {\n\t\tsuper.copy(source, part);\n\t\tif (source instanceof EShapeConnectorLine) {\n\t\t\tthis._edge.copy(source.edge);\n\t\t\tthis._body.copy(source.body);\n\t\t}\n\t\treturn this;\n\t}\n\n\tclone(): EShapeConnectorLine {\n\t\tconst constructor = this.constructor as typeof EShapeConnectorLine;\n\t\treturn new constructor(this.type).copy(this);\n\t}\n\n\tserialize(manager: EShapeResourceManagerSerialization): DDiagramSerializedItem {\n\t\tconst result = super.serialize(manager);\n\t\tconst edgeId = this._edge.serialize(manager);\n\t\tconst bodyId = this._body.serialize(manager);\n\t\tconst pointsId = this._points.serialize(manager);\n\t\tresult[15] = manager.addResource(`[${edgeId},${pointsId},${bodyId}]`);\n\t\treturn result;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"e-shape-connector-line.js","sourceRoot":"","sources":["../../../../../src/main/typescript/wcardinal/ui/shape/variant/e-shape-connector-line.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C,OAAO,EAAE,gCAAgC,EAAE,MAAM,0CAA0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,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAC7C,IAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAC7C,IAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QACjD,MAAM,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,WAAI,MAAM,cAAI,QAAQ,cAAI,MAAM,MAAG,CAAC,CAAC;QACtE,OAAO,MAAM,CAAC;IACf,CAAC;IACF,0BAAC;AAAD,CAAC,AA5PD,CAAyC,cAAc,GA4PtD","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { EShapeType } from \"../e-shape-type\";\nimport { EShapeConnector } from \"../e-shape-connector\";\nimport { EShapeConnectorEdgeContainer } from \"../e-shape-connector-edge-container\";\nimport { EShapeConnectorEdgeContainerImpl } from \"../e-shape-connector-edge-container-impl\";\nimport { EShapeLineBase } from \"./e-shape-line-base\";\nimport { EShapeLinePoints } from \"./e-shape-line-points\";\nimport { EShapeDefaults } from \"../e-shape-defaults\";\nimport { EShapeCopyPart } from \"../e-shape-copy-part\";\nimport { DDiagramSerializedItem } from \"../../d-diagram-serialized\";\nimport { EShapeResourceManagerSerialization } from \"../e-shape-resource-manager-serialization\";\nimport { EShape } from \"../e-shape\";\nimport { toPointsBoundary } from \"../e-shape-points-formatted\";\nimport { EShapeConnectorBody } from \"../e-shape-connector-body\";\nimport { EShapeConnectorBodyImpl } from \"../e-shape-connector-body-impl\";\nimport { EShapeConnectorEdge } from \"../e-shape-connector-edge\";\nimport { EShapeLockPart } from \"./e-shape-lock-part\";\nimport { EShapeLock } from \"./e-shape-lock\";\n\nexport class EShapeConnectorLine extends EShapeLineBase implements EShapeConnector {\n\tprotected static WORK_BOUNDARY: [number, number, number, number];\n\tprotected _edge: EShapeConnectorEdgeContainer;\n\tprotected _body: EShapeConnectorBody;\n\tprotected declare _points: EShapeLinePoints;\n\tprotected _tailLocalId: number;\n\tprotected _tailNormalId: number;\n\tprotected _tailMargin: number;\n\tprotected _headLocalId: number;\n\tprotected _headNormalId: number;\n\tprotected _headMargin: number;\n\tprotected _bodyId: number;\n\tprotected _lockConnector: EShapeLock;\n\n\tconstructor(type: EShapeType = EShapeType.CONNECTOR_LINE) {\n\t\tsuper(type);\n\t\tthis._tailLocalId = 0;\n\t\tthis._tailNormalId = 0;\n\t\tthis._tailMargin = 0;\n\t\tthis._headLocalId = 0;\n\t\tthis._headNormalId = 0;\n\t\tthis._headMargin = 0;\n\t\tthis._bodyId = 0;\n\t\tthis._lockConnector = new EShapeLock();\n\t\tconst sx = EShapeDefaults.SIZE_X;\n\t\tconst sy = EShapeDefaults.SIZE_Y;\n\t\tconst hx = sx * 0.5;\n\t\tconst hy = sy * 0.5;\n\t\tthis._points = new EShapeLinePoints(this).set([-hx, -hy, +hx, +hy]);\n\t\tconst onChangeBound = (): void => {\n\t\t\tthis.onChange();\n\t\t};\n\t\tthis._edge = new EShapeConnectorEdgeContainerImpl(this, onChangeBound);\n\t\tthis._body = new EShapeConnectorBodyImpl(this, onChangeBound);\n\t}\n\n\toverride lock(part: EShapeLockPart): this {\n\t\tif (part & EShapeLockPart.CONNECTOR) {\n\t\t\tthis._lockConnector.lock();\n\t\t}\n\t\tsuper.lock(part);\n\t\treturn this;\n\t}\n\n\toverride unlock(part: EShapeLockPart, invoke: boolean): this {\n\t\tsuper.unlock(part, invoke);\n\t\tif (part & EShapeLockPart.CONNECTOR) {\n\t\t\tif (this._lockConnector.unlock() && invoke) {\n\t\t\t\tthis.onChange();\n\t\t\t}\n\t\t}\n\t\treturn this;\n\t}\n\n\tget points(): EShapeLinePoints {\n\t\treturn this._points;\n\t}\n\n\tget edge(): EShapeConnectorEdgeContainer {\n\t\treturn this._edge;\n\t}\n\n\tget body(): EShapeConnectorBody {\n\t\treturn this._body;\n\t}\n\n\tonAttach(): void {\n\t\tsuper.onAttach();\n\t\tthis._edge.attach();\n\t}\n\n\tonDetach(exceptions?: Set<EShape>): void {\n\t\tthis._edge.detach(exceptions);\n\t\tsuper.onDetach(exceptions);\n\t}\n\n\tprotected onChange(): void {\n\t\tif (this._lockConnector.isLocked()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst edge = this._edge;\n\t\tconst tail = edge.tail;\n\t\tconst tailLocalId = tail.localId;\n\t\tconst tailNormalId = tail.normalId;\n\t\tconst tailMargin = tail.margin;\n\t\tconst head = edge.head;\n\t\tconst headLocalId = head.localId;\n\t\tconst headNormalId = head.normalId;\n\t\tconst headMargin = head.margin;\n\t\tconst body = this._body;\n\t\tconst bodyId = body.id;\n\t\tif (\n\t\t\tthis._tailLocalId !== tailLocalId ||\n\t\t\tthis._tailNormalId !== tailNormalId ||\n\t\t\tthis._tailMargin !== tailMargin ||\n\t\t\tthis._headLocalId !== headLocalId ||\n\t\t\tthis._headNormalId !== headNormalId ||\n\t\t\tthis._headMargin !== headMargin ||\n\t\t\tthis._bodyId !== bodyId\n\t\t) {\n\t\t\tthis._tailLocalId = tailLocalId;\n\t\t\tthis._tailNormalId = tailNormalId;\n\t\t\tthis._tailMargin = tailMargin;\n\t\t\tthis._headLocalId = headLocalId;\n\t\t\tthis._headNormalId = headNormalId;\n\t\t\tthis._headMargin = headMargin;\n\t\t\tthis._bodyId !== bodyId;\n\n\t\t\tconst transform = this.transform;\n\t\t\tconst transformPosition = transform.position;\n\t\t\tconst px = transformPosition.x;\n\t\t\tconst py = transformPosition.y;\n\t\t\tconst points = this._points;\n\t\t\tconst values = points.values;\n\n\t\t\t// Fill points\n\t\t\tthis.fillPoints(tail, tailMargin, head, headMargin, body, px, py, values);\n\n\t\t\t// Center & size\n\t\t\tconst boundary = (EShapeConnectorLine.WORK_BOUNDARY ??= [0, 0, 0, 0]);\n\t\t\ttoPointsBoundary(values, boundary);\n\t\t\tconst cx = (boundary[2] + boundary[0]) * 0.5;\n\t\t\tconst cy = (boundary[3] + boundary[1]) * 0.5;\n\t\t\tconst sx = boundary[2] - boundary[0];\n\t\t\tconst sy = boundary[3] - boundary[1];\n\n\t\t\t// Adjust values\n\t\t\tfor (let i = 0, imax = values.length; i < imax; i += 2) {\n\t\t\t\tvalues[i + 0] -= cx;\n\t\t\t\tvalues[i + 1] -= cy;\n\t\t\t}\n\n\t\t\tthis.lock(EShapeLockPart.TRANSFORM_AND_UPLOADED);\n\t\t\ttransformPosition.set(px + cx, py + cy);\n\t\t\ttransform.scale.set(1, 1);\n\t\t\ttransform.rotation = 0;\n\t\t\ttransform.skew.set(0, 0);\n\t\t\tpoints.toFitted(sx, sy);\n\t\t\tthis.size.set(sx, sy);\n\t\t\tpoints.set(values);\n\t\t\tthis.unlock(EShapeLockPart.TRANSFORM_AND_UPLOADED, true);\n\t\t}\n\t}\n\n\tprotected fillPoints(\n\t\ttail: EShapeConnectorEdge,\n\t\ttailMargin: number,\n\t\thead: EShapeConnectorEdge,\n\t\theadMargin: number,\n\t\tbody: EShapeConnectorBody,\n\t\tpx: number,\n\t\tpy: number,\n\t\tvalues: number[]\n\t): void {\n\t\t// Tail\n\t\tconst threshold = 0.000001;\n\t\tconst tailLocal = tail.local;\n\t\tconst tailLocalX = tailLocal.x;\n\t\tconst tailLocalY = tailLocal.y;\n\t\tconst x0 = tailLocalX - px;\n\t\tconst y0 = tailLocalY - py;\n\n\t\t// Head\n\t\tconst headLocal = head.local;\n\t\tconst headLocalX = headLocal.x;\n\t\tconst headLocalY = headLocal.y;\n\t\tconst x1 = headLocalX - px;\n\t\tconst y1 = headLocalY - py;\n\n\t\t// Body\n\t\tconst bodyValues = body.values;\n\t\tconst bodyValuesLength = bodyValues.length;\n\n\t\t// Tail points\n\t\tvalues[0] = x0;\n\t\tvalues[1] = y0;\n\n\t\t// Body points\n\t\tif (0 < bodyValuesLength) {\n\t\t\tconst cx = (x1 + x0) * 0.5;\n\t\t\tconst cy = (y1 + y0) * 0.5;\n\t\t\tconst dx = x1 - x0;\n\t\t\tconst dy = y1 - y0;\n\t\t\tconst a = Math.atan2(dy, dx);\n\t\t\tconst c = Math.cos(a);\n\t\t\tconst s = Math.sin(a);\n\t\t\tconst l = Math.sqrt(dx * dx + dy * dy);\n\t\t\tfor (let i = 0; i < bodyValuesLength; i += 2) {\n\t\t\t\tconst x = bodyValues[i + 0];\n\t\t\t\tconst y = bodyValues[i + 1];\n\t\t\t\tvalues[i + 2] = cx + (c * x - s * y) * l;\n\t\t\t\tvalues[i + 3] = cy + (c * y + s * x) * l;\n\t\t\t}\n\t\t}\n\n\t\t// Head points\n\t\tvalues[2 + bodyValuesLength] = x1;\n\t\tvalues[3 + bodyValuesLength] = y1;\n\n\t\t// Tail margin\n\t\tif (tailMargin !== 0) {\n\t\t\tconst dx = values[2] - x0;\n\t\t\tconst dy = values[3] - y0;\n\t\t\tconst d = dx * dx + dy * dy;\n\t\t\tif (threshold < d) {\n\t\t\t\tconst f = tailMargin / Math.sqrt(dx * dx + dy * dy);\n\t\t\t\tvalues[0] = x0 + dx * f;\n\t\t\t\tvalues[1] = y0 + dy * f;\n\t\t\t}\n\t\t}\n\n\t\t// Head margin\n\t\tif (headMargin !== 0) {\n\t\t\tconst dx = values[0 + bodyValuesLength] - x1;\n\t\t\tconst dy = values[1 + bodyValuesLength] - y1;\n\t\t\tconst d = dx * dx + dy * dy;\n\t\t\tif (threshold < d) {\n\t\t\t\tconst f = headMargin / Math.sqrt(dx * dx + dy * dy);\n\t\t\t\tvalues[2 + bodyValuesLength] = x1 + dx * f;\n\t\t\t\tvalues[3 + bodyValuesLength] = y1 + dy * f;\n\t\t\t}\n\t\t}\n\n\t\t// Remove the rest\n\t\tvalues.length = bodyValuesLength + 4;\n\t}\n\n\tcopy(source: EShape, part: EShapeCopyPart = EShapeCopyPart.ALL): this {\n\t\tthis.lock(EShapeLockPart.ALL);\n\t\tsuper.copy(source, part);\n\t\tif (source instanceof EShapeConnectorLine) {\n\t\t\tthis._edge.copy(source.edge);\n\t\t\tthis._body.copy(source.body);\n\t\t}\n\t\tthis.unlock(EShapeLockPart.ALL, true);\n\t\treturn this;\n\t}\n\n\tclone(): EShapeConnectorLine {\n\t\tconst constructor = this.constructor as typeof EShapeConnectorLine;\n\t\treturn new constructor(this.type).copy(this);\n\t}\n\n\tserialize(manager: EShapeResourceManagerSerialization): DDiagramSerializedItem {\n\t\tconst result = super.serialize(manager);\n\t\tconst edgeId = this._edge.serialize(manager);\n\t\tconst bodyId = this._body.serialize(manager);\n\t\tconst pointsId = this._points.serialize(manager);\n\t\tresult[15] = manager.addResource(`[${edgeId},${pointsId},${bodyId}]`);\n\t\treturn result;\n\t}\n}\n"]}
|
|
@@ -99,7 +99,7 @@ var EShapeGroupSizeEditor = /** @class */ (function () {
|
|
|
99
99
|
};
|
|
100
100
|
EShapeGroupSizeEditor.prototype.doFit = function () {
|
|
101
101
|
var parent = this._parent;
|
|
102
|
-
parent.lock(EShapeLockPart.TRANSFORM
|
|
102
|
+
parent.lock(EShapeLockPart.TRANSFORM);
|
|
103
103
|
// Calculate the rect
|
|
104
104
|
var rect = this.calcRect(this._workRectForFit);
|
|
105
105
|
// Set size
|
|
@@ -152,7 +152,8 @@ var EShapeGroupSizeEditor = /** @class */ (function () {
|
|
|
152
152
|
// Reset the data
|
|
153
153
|
this.reset(parent.children, this._layouts, size);
|
|
154
154
|
//
|
|
155
|
-
parent.unlock(EShapeLockPart.
|
|
155
|
+
parent.unlock(EShapeLockPart.TRANSFORM_CHILD | EShapeLockPart.TRANSFORM_THIS, true);
|
|
156
|
+
parent.unlock(EShapeLockPart.TRANSFORM_PARENT, false);
|
|
156
157
|
};
|
|
157
158
|
EShapeGroupSizeEditor.prototype.reset = function (children, layouts, size) {
|
|
158
159
|
for (var i = 0, imax = Math.min(layouts.length, children.length); i < imax; ++i) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"e-shape-group-size-editor.js","sourceRoot":"","sources":["../../../../../src/main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Content":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { IPoint, Point, Rectangle } from \"pixi.js\";\nimport { EShape } from \"../e-shape\";\nimport { EShapeLayout } from \"../e-shape-layout\";\nimport { EShapeGroupSize } from \"./e-shape-group-size\";\nimport { EShapeGroupSizeLayout } from \"./e-shape-group-size-layout\";\nimport { EShapeGroupSizeParent } from \"./e-shape-group-size-parent\";\nimport { EShapeLockPart } from \"./e-shape-lock-part\";\n\nexport class EShapeGroupSizeEditor implements EShapeGroupSize {\n\tprotected _parent: EShapeGroupSizeParent;\n\tprotected _size: Point;\n\tprotected _layouts: EShapeLayout[];\n\tprotected _workRectForCalcRect: Rectangle = new Rectangle();\n\tprotected _workRectForFit: Rectangle = new Rectangle();\n\tprotected _isFittable: boolean;\n\n\tconstructor(parent: EShapeGroupSizeParent, x: number, y: number, isFittable: boolean) {\n\t\tthis._parent = parent;\n\t\tthis._layouts = [];\n\t\tthis._size = new Point(x, y);\n\t\tthis._isFittable = isFittable;\n\t}\n\n\tinit(): this {\n\t\treturn this;\n\t}\n\n\tget x(): number {\n\t\treturn this._size.x;\n\t}\n\n\tset x(x: number) {\n\t\tconst size = this._size;\n\t\tif (size.x !== x) {\n\t\t\tconst ox = size.x;\n\t\t\tsize.x = x;\n\t\t\tthis.onChange(ox, size.y);\n\t\t}\n\t}\n\n\tget y(): number {\n\t\treturn this._size.y;\n\t}\n\n\tset y(y: number) {\n\t\tconst size = this._size;\n\t\tif (size.y !== y) {\n\t\t\tconst oy = size.y;\n\t\t\tsize.y = y;\n\t\t\tthis.onChange(size.x, oy);\n\t\t}\n\t}\n\n\tset(x?: number, y?: number): this {\n\t\tlet isChanged = false;\n\t\tconst size = this._size;\n\t\tconst ox = size.x;\n\t\tconst oy = size.y;\n\t\tif (x != null && ox !== x) {\n\t\t\tisChanged = true;\n\t\t\tsize.x = x;\n\t\t}\n\t\tif (y != null && oy !== y) {\n\t\t\tisChanged = true;\n\t\t\tsize.y = y;\n\t\t}\n\t\tif (isChanged) {\n\t\t\tthis.onChange(ox, oy);\n\t\t}\n\t\treturn this;\n\t}\n\n\tclone(): EShapeGroupSizeEditor {\n\t\tconst size = this._size;\n\t\treturn new EShapeGroupSizeEditor(this._parent, size.x, size.y, this._isFittable);\n\t}\n\n\tcopy(): void {\n\t\t// DO NOTHING\n\t}\n\n\tcopyFrom(point: IPoint): this {\n\t\tconst x = point.x;\n\t\tconst y = point.y;\n\t\tconst size = this._size;\n\t\tconst ox = size.x;\n\t\tconst oy = size.y;\n\t\tif (ox !== x || oy !== y) {\n\t\t\tsize.x = x;\n\t\t\tsize.y = y;\n\t\t\tthis.onChange(ox, oy);\n\t\t}\n\t\treturn this;\n\t}\n\n\tcopyTo(point: IPoint): IPoint {\n\t\treturn this._size.copyTo(point);\n\t}\n\n\tequals(point: IPoint): boolean {\n\t\treturn this._size.equals(point);\n\t}\n\n\tfit(): this {\n\t\tif (this._isFittable) {\n\t\t\tthis.doFit();\n\t\t}\n\t\treturn this;\n\t}\n\n\tprotected doFit(): void {\n\t\tconst parent = this._parent;\n\t\tparent.lock(EShapeLockPart.TRANSFORM | EShapeLockPart.TRANSFORM_PARENT);\n\n\t\t// Calculate the rect\n\t\tconst rect = this.calcRect(this._workRectForFit);\n\n\t\t// Set size\n\t\tconst size = this._size;\n\t\tsize.set(rect.width, rect.height);\n\n\t\t// Calculating new position & pivot\n\t\t//\n\t\t// cx := rect.x + rect.width * 0.5\n\t\t// cy := rect.y + rect.height * 0.5\n\t\t//\n\t\t// Since the local transform need to be unchanged:\n\t\t//\n\t\t// | a c tx | | a c px' - (a * pvx' + c * pvy') |\n\t\t// | b d ty | = | b d py' - (b * pvx' + d * pvy') |\n\t\t// | 0 0 1 | | 0 0 1 |\n\t\t//\n\t\t// Here, (px', py') and (pvx', pvy') are the new position\n\t\t// and the new pivot, respectively.\n\t\t//\n\t\t// Setting the new pivot (pvx', pvy') to (cx, cy) leads to\n\t\t//\n\t\t// | a c tx | | a c px' - (a * cx + c * cy) |\n\t\t// | b d ty | = | b d py' - (b * cx + d * cy) |\n\t\t// | 0 0 1 | | 0 0 1 |\n\t\t//\n\t\t// tx = px - (a * pvx + c * pvy) = px' - (a * cx + c * cy)\n\t\t// ty = py - (b * pvx + d * pvy) = py' - (b * cx + d * cy)\n\t\t//\n\t\t// Thus, the new position (px', py') is\n\t\t//\n\t\t// px' = px + (a * (cx - pvx) + c * (cy - pvy))\n\t\t// py' = py + (b * (cy - pvx) + d * (cy - pvy))\n\t\tparent.updateTransform();\n\t\tconst transform = parent.transform;\n\t\tconst cx = rect.x + rect.width * 0.5;\n\t\tconst cy = rect.y + rect.height * 0.5;\n\t\tconst position = transform.position;\n\t\tconst localTransform = transform.localTransform;\n\t\tconst a = localTransform.a;\n\t\tconst b = localTransform.b;\n\t\tconst c = localTransform.c;\n\t\tconst d = localTransform.d;\n\t\tconst pivot = transform.pivot;\n\t\tconst pvx = pivot.x;\n\t\tconst pvy = pivot.y;\n\t\tconst dpvx = cx - pvx;\n\t\tconst dpvy = cy - pvy;\n\t\tposition.set(position.x + (a * dpvx + c * dpvy), position.y + (b * dpvx + d * dpvy));\n\t\tpivot.set(cx, cy);\n\n\t\t// Reset the data\n\t\tthis.reset(parent.children, this._layouts, size);\n\n\t\t//\n\t\tparent.unlock(EShapeLockPart.TRANSFORM | EShapeLockPart.TRANSFORM_PARENT, true);\n\t}\n\n\tprotected reset(children: EShape[], layouts: EShapeLayout[], size: IPoint): void {\n\t\tfor (let i = 0, imax = Math.min(layouts.length, children.length); i < imax; ++i) {\n\t\t\tconst child = children[i];\n\t\t\tconst layout = layouts[i];\n\t\t\tif (layout.isCompatible(child)) {\n\t\t\t\tlayout.reset(child, size.x, size.y);\n\t\t\t} else {\n\t\t\t\tlayouts.length = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (children.length < layouts.length) {\n\t\t\tlayouts.length = children.length;\n\t\t}\n\t}\n\n\tcalcRect(result: Rectangle): Rectangle {\n\t\tconst parent = this._parent;\n\t\tconst children = parent.children;\n\t\tif (children.length <= 0) {\n\t\t\tresult.x = 0;\n\t\t\tresult.y = 0;\n\t\t\tresult.width = 0;\n\t\t\tresult.height = 0;\n\t\t} else {\n\t\t\tconst workRect = this._workRectForCalcRect;\n\t\t\tchildren[0].getBoundsLocal(false, result);\n\t\t\tfor (let i = 1, imax = children.length; i < imax; ++i) {\n\t\t\t\tconst child = children[i];\n\t\t\t\tchild.getBoundsLocal(false, workRect);\n\t\t\t\tresult.enlarge(workRect);\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected onChange(ox: number, oy: number): void {\n\t\tconst parent = this._parent;\n\t\tconst size = this._size;\n\t\tconst pivot = parent.transform.pivot;\n\t\tthis.onChange_(parent.children, this._layouts, size.x, size.y, pivot.x, pivot.y, ox, oy);\n\t\tparent.onSizeChange();\n\t}\n\n\tprotected onChange_(\n\t\tchildren: EShape[],\n\t\tlayouts: EShapeLayout[],\n\t\tsx: number,\n\t\tsy: number,\n\t\tpx: number,\n\t\tpy: number,\n\t\tox: number,\n\t\toy: number\n\t): void {\n\t\tfor (let i = 0, imax = Math.min(layouts.length, children.length); i < imax; ++i) {\n\t\t\tconst child = children[i];\n\t\t\tconst layout = layouts[i];\n\t\t\tif (layout.isCompatible(child)) {\n\t\t\t\tlayout.update(child, sx, sy, px, py);\n\t\t\t} else {\n\t\t\t\tlayouts.length = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tfor (let i = layouts.length, imax = children.length; i < imax; ++i) {\n\t\t\tconst child = children[i];\n\t\t\tconst layout = this.newLayout(child, ox, oy);\n\t\t\tlayout.update(child, sx, sy, px, py);\n\t\t\tlayouts.push(layout);\n\t\t}\n\t\tif (layouts.length !== children.length) {\n\t\t\tlayouts.length = children.length;\n\t\t}\n\t}\n\n\tprotected newLayout(shape: EShape, ox: number, oy: number): EShapeLayout {\n\t\treturn shape.layout || new EShapeGroupSizeLayout(shape, ox, oy);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"e-shape-group-size-editor.js","sourceRoot":"","sources":["../../../../../src/main/typescript/wcardinal/ui/shape/variant/e-shape-group-size-editor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAU,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAInD,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEpE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD;IAQC,+BAAY,MAA6B,EAAE,CAAS,EAAE,CAAS,EAAE,UAAmB;QAJ1E,yBAAoB,GAAc,IAAI,SAAS,EAAE,CAAC;QAClD,oBAAe,GAAc,IAAI,SAAS,EAAE,CAAC;QAItD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC7B,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAC/B,CAAC;IAED,oCAAI,GAAJ;QACC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,sBAAI,oCAAC;aAAL;YACC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QACrB,CAAC;aAED,UAAM,CAAS;YACd,IAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;YACxB,IAAI,IAAI,CAAC,CAAC,KAAK,CAAC,EAAE;gBACjB,IAAM,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;gBAClB,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;gBACX,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;aAC1B;QACF,CAAC;;;OATA;IAWD,sBAAI,oCAAC;aAAL;YACC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QACrB,CAAC;aAED,UA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CAAC,MAAM,IAAI,IAAI,qBAAqB,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IACjE,CAAC;IACF,4BAAC;AAAD,CAAC,AApPD,IAoPC","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { IPoint, Point, Rectangle } from \"pixi.js\";\nimport { EShape } from \"../e-shape\";\nimport { EShapeLayout } from \"../e-shape-layout\";\nimport { EShapeGroupSize } from \"./e-shape-group-size\";\nimport { EShapeGroupSizeLayout } from \"./e-shape-group-size-layout\";\nimport { EShapeGroupSizeParent } from \"./e-shape-group-size-parent\";\nimport { EShapeLockPart } from \"./e-shape-lock-part\";\n\nexport class EShapeGroupSizeEditor implements EShapeGroupSize {\n\tprotected _parent: EShapeGroupSizeParent;\n\tprotected _size: Point;\n\tprotected _layouts: EShapeLayout[];\n\tprotected _workRectForCalcRect: Rectangle = new Rectangle();\n\tprotected _workRectForFit: Rectangle = new Rectangle();\n\tprotected _isFittable: boolean;\n\n\tconstructor(parent: EShapeGroupSizeParent, x: number, y: number, isFittable: boolean) {\n\t\tthis._parent = parent;\n\t\tthis._layouts = [];\n\t\tthis._size = new Point(x, y);\n\t\tthis._isFittable = isFittable;\n\t}\n\n\tinit(): this {\n\t\treturn this;\n\t}\n\n\tget x(): number {\n\t\treturn this._size.x;\n\t}\n\n\tset x(x: number) {\n\t\tconst size = this._size;\n\t\tif (size.x !== x) {\n\t\t\tconst ox = size.x;\n\t\t\tsize.x = x;\n\t\t\tthis.onChange(ox, size.y);\n\t\t}\n\t}\n\n\tget y(): number {\n\t\treturn this._size.y;\n\t}\n\n\tset y(y: number) {\n\t\tconst size = this._size;\n\t\tif (size.y !== y) {\n\t\t\tconst oy = size.y;\n\t\t\tsize.y = y;\n\t\t\tthis.onChange(size.x, oy);\n\t\t}\n\t}\n\n\tset(x?: number, y?: number): this {\n\t\tlet isChanged = false;\n\t\tconst size = this._size;\n\t\tconst ox = size.x;\n\t\tconst oy = size.y;\n\t\tif (x != null && ox !== x) {\n\t\t\tisChanged = true;\n\t\t\tsize.x = x;\n\t\t}\n\t\tif (y != null && oy !== y) {\n\t\t\tisChanged = true;\n\t\t\tsize.y = y;\n\t\t}\n\t\tif (isChanged) {\n\t\t\tthis.onChange(ox, oy);\n\t\t}\n\t\treturn this;\n\t}\n\n\tclone(): EShapeGroupSizeEditor {\n\t\tconst size = this._size;\n\t\treturn new EShapeGroupSizeEditor(this._parent, size.x, size.y, this._isFittable);\n\t}\n\n\tcopy(): void {\n\t\t// DO NOTHING\n\t}\n\n\tcopyFrom(point: IPoint): this {\n\t\tconst x = point.x;\n\t\tconst y = point.y;\n\t\tconst size = this._size;\n\t\tconst ox = size.x;\n\t\tconst oy = size.y;\n\t\tif (ox !== x || oy !== y) {\n\t\t\tsize.x = x;\n\t\t\tsize.y = y;\n\t\t\tthis.onChange(ox, oy);\n\t\t}\n\t\treturn this;\n\t}\n\n\tcopyTo(point: IPoint): IPoint {\n\t\treturn this._size.copyTo(point);\n\t}\n\n\tequals(point: IPoint): boolean {\n\t\treturn this._size.equals(point);\n\t}\n\n\tfit(): this {\n\t\tif (this._isFittable) {\n\t\t\tthis.doFit();\n\t\t}\n\t\treturn this;\n\t}\n\n\tprotected doFit(): void {\n\t\tconst parent = this._parent;\n\t\tparent.lock(EShapeLockPart.TRANSFORM);\n\n\t\t// Calculate the rect\n\t\tconst rect = this.calcRect(this._workRectForFit);\n\n\t\t// Set size\n\t\tconst size = this._size;\n\t\tsize.set(rect.width, rect.height);\n\n\t\t// Calculating new position & pivot\n\t\t//\n\t\t// cx := rect.x + rect.width * 0.5\n\t\t// cy := rect.y + rect.height * 0.5\n\t\t//\n\t\t// Since the local transform need to be unchanged:\n\t\t//\n\t\t// | a c tx | | a c px' - (a * pvx' + c * pvy') |\n\t\t// | b d ty | = | b d py' - (b * pvx' + d * pvy') |\n\t\t// | 0 0 1 | | 0 0 1 |\n\t\t//\n\t\t// Here, (px', py') and (pvx', pvy') are the new position\n\t\t// and the new pivot, respectively.\n\t\t//\n\t\t// Setting the new pivot (pvx', pvy') to (cx, cy) leads to\n\t\t//\n\t\t// | a c tx | | a c px' - (a * cx + c * cy) |\n\t\t// | b d ty | = | b d py' - (b * cx + d * cy) |\n\t\t// | 0 0 1 | | 0 0 1 |\n\t\t//\n\t\t// tx = px - (a * pvx + c * pvy) = px' - (a * cx + c * cy)\n\t\t// ty = py - (b * pvx + d * pvy) = py' - (b * cx + d * cy)\n\t\t//\n\t\t// Thus, the new position (px', py') is\n\t\t//\n\t\t// px' = px + (a * (cx - pvx) + c * (cy - pvy))\n\t\t// py' = py + (b * (cy - pvx) + d * (cy - pvy))\n\t\tparent.updateTransform();\n\t\tconst transform = parent.transform;\n\t\tconst cx = rect.x + rect.width * 0.5;\n\t\tconst cy = rect.y + rect.height * 0.5;\n\t\tconst position = transform.position;\n\t\tconst localTransform = transform.localTransform;\n\t\tconst a = localTransform.a;\n\t\tconst b = localTransform.b;\n\t\tconst c = localTransform.c;\n\t\tconst d = localTransform.d;\n\t\tconst pivot = transform.pivot;\n\t\tconst pvx = pivot.x;\n\t\tconst pvy = pivot.y;\n\t\tconst dpvx = cx - pvx;\n\t\tconst dpvy = cy - pvy;\n\t\tposition.set(position.x + (a * dpvx + c * dpvy), position.y + (b * dpvx + d * dpvy));\n\t\tpivot.set(cx, cy);\n\n\t\t// Reset the data\n\t\tthis.reset(parent.children, this._layouts, size);\n\n\t\t//\n\t\tparent.unlock(EShapeLockPart.TRANSFORM_CHILD | EShapeLockPart.TRANSFORM_THIS, true);\n\t\tparent.unlock(EShapeLockPart.TRANSFORM_PARENT, false);\n\t}\n\n\tprotected reset(children: EShape[], layouts: EShapeLayout[], size: IPoint): void {\n\t\tfor (let i = 0, imax = Math.min(layouts.length, children.length); i < imax; ++i) {\n\t\t\tconst child = children[i];\n\t\t\tconst layout = layouts[i];\n\t\t\tif (layout.isCompatible(child)) {\n\t\t\t\tlayout.reset(child, size.x, size.y);\n\t\t\t} else {\n\t\t\t\tlayouts.length = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (children.length < layouts.length) {\n\t\t\tlayouts.length = children.length;\n\t\t}\n\t}\n\n\tcalcRect(result: Rectangle): Rectangle {\n\t\tconst parent = this._parent;\n\t\tconst children = parent.children;\n\t\tif (children.length <= 0) {\n\t\t\tresult.x = 0;\n\t\t\tresult.y = 0;\n\t\t\tresult.width = 0;\n\t\t\tresult.height = 0;\n\t\t} else {\n\t\t\tconst workRect = this._workRectForCalcRect;\n\t\t\tchildren[0].getBoundsLocal(false, result);\n\t\t\tfor (let i = 1, imax = children.length; i < imax; ++i) {\n\t\t\t\tconst child = children[i];\n\t\t\t\tchild.getBoundsLocal(false, workRect);\n\t\t\t\tresult.enlarge(workRect);\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected onChange(ox: number, oy: number): void {\n\t\tconst parent = this._parent;\n\t\tconst size = this._size;\n\t\tconst pivot = parent.transform.pivot;\n\t\tthis.onChange_(parent.children, this._layouts, size.x, size.y, pivot.x, pivot.y, ox, oy);\n\t\tparent.onSizeChange();\n\t}\n\n\tprotected onChange_(\n\t\tchildren: EShape[],\n\t\tlayouts: EShapeLayout[],\n\t\tsx: number,\n\t\tsy: number,\n\t\tpx: number,\n\t\tpy: number,\n\t\tox: number,\n\t\toy: number\n\t): void {\n\t\tfor (let i = 0, imax = Math.min(layouts.length, children.length); i < imax; ++i) {\n\t\t\tconst child = children[i];\n\t\t\tconst layout = layouts[i];\n\t\t\tif (layout.isCompatible(child)) {\n\t\t\t\tlayout.update(child, sx, sy, px, py);\n\t\t\t} else {\n\t\t\t\tlayouts.length = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tfor (let i = layouts.length, imax = children.length; i < imax; ++i) {\n\t\t\tconst child = children[i];\n\t\t\tconst layout = this.newLayout(child, ox, oy);\n\t\t\tlayout.update(child, sx, sy, px, py);\n\t\t\tlayouts.push(layout);\n\t\t}\n\t\tif (layouts.length !== children.length) {\n\t\t\tlayouts.length = children.length;\n\t\t}\n\t}\n\n\tprotected newLayout(shape: EShape, ox: number, oy: number): EShapeLayout {\n\t\treturn shape.layout || new EShapeGroupSizeLayout(shape, ox, oy);\n\t}\n}\n"]}
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import { Matrix, Point } from "pixi.js";
|
|
6
6
|
import { EShapeCapabilities } from "../e-shape-capabilities";
|
|
7
7
|
import { EShapeCapability } from "../e-shape-capability";
|
|
8
|
-
import { EShapeTransforms } from "../e-shape-transforms";
|
|
9
8
|
import { EShapeLockPart } from "./e-shape-lock-part";
|
|
9
|
+
import { toSizeNormalized } from "./to-size-normalized";
|
|
10
10
|
var EShapeGroupSizeLayout = /** @class */ (function () {
|
|
11
11
|
function EShapeGroupSizeLayout(shape, bx, by) {
|
|
12
12
|
this.shape = shape;
|
|
@@ -52,9 +52,72 @@ var EShapeGroupSizeLayout = /** @class */ (function () {
|
|
|
52
52
|
.translate(-pivotX, -pivotY)
|
|
53
53
|
.scale(sx, sy)
|
|
54
54
|
.translate(+pivotX, +pivotY);
|
|
55
|
-
shape.lock(EShapeLockPart.
|
|
56
|
-
|
|
57
|
-
shape.unlock(EShapeLockPart.
|
|
55
|
+
shape.lock(EShapeLockPart.TRANSFORM_AND_UPLOADED);
|
|
56
|
+
this.apply(shape, transform, EShapeCapability.ALL, childBase);
|
|
57
|
+
shape.unlock(EShapeLockPart.TRANSFORM_CHILD, false);
|
|
58
|
+
shape.unlock(EShapeLockPart.TRANSFORM_THIS |
|
|
59
|
+
EShapeLockPart.TRANSFORM_PARENT |
|
|
60
|
+
EShapeLockPart.UPLOADED, true);
|
|
61
|
+
};
|
|
62
|
+
EShapeGroupSizeLayout.prototype.apply = function (shape, localTransform, capability, size) {
|
|
63
|
+
// Reconstruct the position, the rotation and the size
|
|
64
|
+
var a = localTransform.a;
|
|
65
|
+
var b = localTransform.b;
|
|
66
|
+
var c = localTransform.c;
|
|
67
|
+
var d = localTransform.d;
|
|
68
|
+
var tx = localTransform.tx;
|
|
69
|
+
var ty = localTransform.ty;
|
|
70
|
+
// Transform
|
|
71
|
+
var transform = shape.transform;
|
|
72
|
+
// Capability
|
|
73
|
+
var cposition = !!(capability & EShapeCapability.POSITION);
|
|
74
|
+
var crotation = !!(capability & EShapeCapability.ROTATION);
|
|
75
|
+
var cskew = !!(capability & EShapeCapability.SKEW);
|
|
76
|
+
var cwidth = !!(capability & EShapeCapability.WIDTH);
|
|
77
|
+
var cheight = !!(capability & EShapeCapability.HEIGHT);
|
|
78
|
+
// Rotation and skew
|
|
79
|
+
if (crotation || cskew) {
|
|
80
|
+
// Rotation
|
|
81
|
+
var rx = Math.atan2(-c, d); // rotation - skewX
|
|
82
|
+
var ry = Math.atan2(+b, a); // rotation + skewY
|
|
83
|
+
if (crotation) {
|
|
84
|
+
transform.rotation = (rx + ry) * 0.5; // Here, assumes `skewX` === `skewY`
|
|
85
|
+
}
|
|
86
|
+
// Skew
|
|
87
|
+
if (cskew) {
|
|
88
|
+
var skew = (ry - rx) * 0.5;
|
|
89
|
+
transform.skew.set(skew, skew);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
// Position
|
|
93
|
+
if (cposition) {
|
|
94
|
+
// Assumes the pivot is invariant.
|
|
95
|
+
// tx = position.x - (a * px + c * py)
|
|
96
|
+
// ty = position.y - (b * px + d * py)
|
|
97
|
+
//
|
|
98
|
+
// Thus,
|
|
99
|
+
// position.x = tx + (a * px + c * py)
|
|
100
|
+
// position.y = ty + (b * px + d * py)
|
|
101
|
+
var pivot = transform.pivot;
|
|
102
|
+
var px = pivot.x;
|
|
103
|
+
var py = pivot.y;
|
|
104
|
+
transform.position.set(tx + (a * px + c * py), ty + (b * px + d * py));
|
|
105
|
+
}
|
|
106
|
+
// Scale
|
|
107
|
+
if (size != null && (cwidth || cheight)) {
|
|
108
|
+
var w = toSizeNormalized(size.x * Math.sqrt(a * a + b * b));
|
|
109
|
+
var h = toSizeNormalized(size.y * Math.sqrt(c * c + d * d));
|
|
110
|
+
var s = shape.size;
|
|
111
|
+
if (cwidth && cheight) {
|
|
112
|
+
s.set(w, h);
|
|
113
|
+
}
|
|
114
|
+
else if (cwidth) {
|
|
115
|
+
s.x = w;
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
s.y = h;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
58
121
|
};
|
|
59
122
|
EShapeGroupSizeLayout.WORK_TRANSFORM = new Matrix();
|
|
60
123
|
return EShapeGroupSizeLayout;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"e-shape-group-size-layout.js","sourceRoot":"","sources":["../../../../../src/main/typescript/wcardinal/ui/shape/variant/e-shape-group-size-layout.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"e-shape-group-size-layout.js","sourceRoot":"","sources":["../../../../../src/main/typescript/wcardinal/ui/shape/variant/e-shape-group-size-layout.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAU,MAAM,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD;IAUC,+BAAY,KAAa,EAAE,EAAU,EAAE,EAAU;QAChD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QAEnB,kBAAkB;QAClB,IAAI,CAAC,IAAI,GAAG,IAAI,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAE9B,kBAAkB;QAClB,IAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QACxB,IAAI,CAAC,SAAS,GAAG,IAAI,KAAK,CAAC,IAA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from \"pixi.js\";\nimport { EShape } from \"../e-shape\";\nimport { EShapeCapabilities } from \"../e-shape-capabilities\";\nimport { EShapeCapability } from \"../e-shape-capability\";\nimport { EShapeLayout } from \"../e-shape-layout\";\nimport { EShapeLockPart } from \"./e-shape-lock-part\";\nimport { toSizeNormalized } from \"./to-size-normalized\";\n\nexport class EShapeGroupSizeLayout implements EShapeLayout {\n\tprotected static WORK_TRANSFORM: Matrix = new Matrix();\n\n\tprotected shape: EShape;\n\tprotected base: Point;\n\tprotected shapeBase: Point;\n\tprotected transform: Matrix;\n\n\tprotected capable: boolean;\n\n\tconstructor(shape: EShape, bx: number, by: number) {\n\t\tthis.shape = shape;\n\n\t\t// Base group size\n\t\tthis.base = new Point(bx, by);\n\n\t\t// Base shape size\n\t\tconst size = shape.size;\n\t\tthis.shapeBase = new Point(size.x, size.y);\n\n\t\t// Transform\n\t\tthis.transform = new Matrix();\n\t\tshape.updateTransform();\n\t\tshape.transform.localTransform.copyTo(this.transform);\n\n\t\tthis.capable =\n\t\t\tEShapeCapabilities.contains(shape, EShapeCapability.POSITION) &&\n\t\t\tEShapeCapabilities.contains(shape, EShapeCapability.WIDTH) &&\n\t\t\tEShapeCapabilities.contains(shape, EShapeCapability.HEIGHT) &&\n\t\t\tEShapeCapabilities.contains(shape, EShapeCapability.ROTATION) &&\n\t\t\tEShapeCapabilities.contains(shape, EShapeCapability.SKEW);\n\t}\n\n\tisCompatible(shape: EShape): boolean {\n\t\treturn this.shape === shape;\n\t}\n\n\treset(shape: EShape, baseX: number, baseY: number): void {\n\t\tthis.base.set(baseX, baseY);\n\n\t\t// Base shape size\n\t\tconst size = shape.size;\n\t\tthis.shapeBase.copyFrom(size);\n\n\t\t// Transform\n\t\tshape.updateTransform();\n\t\tshape.transform.localTransform.copyTo(this.transform);\n\t}\n\n\tupdate(shape: EShape, baseX: number, baseY: number, pivotX: number, pivotY: number): void {\n\t\tif (!this.capable) {\n\t\t\treturn;\n\t\t}\n\t\tconst sx = baseX / this.base.x;\n\t\tconst sy = baseY / this.base.y;\n\t\tconst childBase = this.shapeBase;\n\t\tconst transform = EShapeGroupSizeLayout.WORK_TRANSFORM;\n\t\ttransform\n\t\t\t.identity()\n\t\t\t.append(this.transform)\n\t\t\t.translate(-pivotX, -pivotY)\n\t\t\t.scale(sx, sy)\n\t\t\t.translate(+pivotX, +pivotY);\n\t\tshape.lock(EShapeLockPart.TRANSFORM_AND_UPLOADED);\n\t\tthis.apply(shape, transform, EShapeCapability.ALL, childBase);\n\t\tshape.unlock(EShapeLockPart.TRANSFORM_CHILD, false);\n\t\tshape.unlock(\n\t\t\tEShapeLockPart.TRANSFORM_THIS |\n\t\t\t\tEShapeLockPart.TRANSFORM_PARENT |\n\t\t\t\tEShapeLockPart.UPLOADED,\n\t\t\ttrue\n\t\t);\n\t}\n\n\tprotected apply(\n\t\tshape: EShape,\n\t\tlocalTransform: Matrix,\n\t\tcapability: EShapeCapability,\n\t\tsize?: IPoint\n\t): void {\n\t\t// Reconstruct the position, the rotation and the size\n\t\tconst a = localTransform.a;\n\t\tconst b = localTransform.b;\n\t\tconst c = localTransform.c;\n\t\tconst d = localTransform.d;\n\t\tconst tx = localTransform.tx;\n\t\tconst ty = localTransform.ty;\n\n\t\t// Transform\n\t\tconst transform = shape.transform;\n\n\t\t// Capability\n\t\tconst cposition = !!(capability & EShapeCapability.POSITION);\n\t\tconst crotation = !!(capability & EShapeCapability.ROTATION);\n\t\tconst cskew = !!(capability & EShapeCapability.SKEW);\n\t\tconst cwidth = !!(capability & EShapeCapability.WIDTH);\n\t\tconst cheight = !!(capability & EShapeCapability.HEIGHT);\n\n\t\t// Rotation and skew\n\t\tif (crotation || cskew) {\n\t\t\t// Rotation\n\t\t\tconst rx = Math.atan2(-c, d); // rotation - skewX\n\t\t\tconst ry = Math.atan2(+b, a); // rotation + skewY\n\t\t\tif (crotation) {\n\t\t\t\ttransform.rotation = (rx + ry) * 0.5; // Here, assumes `skewX` === `skewY`\n\t\t\t}\n\n\t\t\t// Skew\n\t\t\tif (cskew) {\n\t\t\t\tconst skew = (ry - rx) * 0.5;\n\t\t\t\ttransform.skew.set(skew, skew);\n\t\t\t}\n\t\t}\n\n\t\t// Position\n\t\tif (cposition) {\n\t\t\t// Assumes the pivot is invariant.\n\t\t\t// tx = position.x - (a * px + c * py)\n\t\t\t// ty = position.y - (b * px + d * py)\n\t\t\t//\n\t\t\t// Thus,\n\t\t\t// position.x = tx + (a * px + c * py)\n\t\t\t// position.y = ty + (b * px + d * py)\n\t\t\tconst pivot = transform.pivot;\n\t\t\tconst px = pivot.x;\n\t\t\tconst py = pivot.y;\n\t\t\ttransform.position.set(tx + (a * px + c * py), ty + (b * px + d * py));\n\t\t}\n\n\t\t// Scale\n\t\tif (size != null && (cwidth || cheight)) {\n\t\t\tconst w = toSizeNormalized(size.x * Math.sqrt(a * a + b * b));\n\t\t\tconst h = toSizeNormalized(size.y * Math.sqrt(c * c + d * d));\n\t\t\tconst s = shape.size;\n\t\t\tif (cwidth && cheight) {\n\t\t\t\ts.set(w, h);\n\t\t\t} else if (cwidth) {\n\t\t\t\ts.x = w;\n\t\t\t} else {\n\t\t\t\ts.y = h;\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
export var EShapeLockPart = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
TRANSFORM_CHILD: 1,
|
|
3
|
+
TRANSFORM_THIS: 2,
|
|
4
|
+
TRANSFORM_PARENT: 4,
|
|
5
|
+
TRANSFORM: 7,
|
|
6
|
+
UPLOADED: 8,
|
|
7
|
+
TRANSFORM_AND_UPLOADED: 15,
|
|
8
|
+
CONNECTOR: 16,
|
|
9
|
+
ALL: 31
|
|
7
10
|
};
|
|
8
11
|
//# sourceMappingURL=e-shape-lock-part.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"e-shape-lock-part.js","sourceRoot":"","sources":["../../../../../src/main/typescript/wcardinal/ui/shape/variant/e-shape-lock-part.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,cAAc,GAAG;IAC7B,
|
|
1
|
+
{"version":3,"file":"e-shape-lock-part.js","sourceRoot":"","sources":["../../../../../src/main/typescript/wcardinal/ui/shape/variant/e-shape-lock-part.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,cAAc,GAAG;IAC7B,eAAe,EAAE,CAAC;IAClB,cAAc,EAAE,CAAC;IACjB,gBAAgB,EAAE,CAAC;IACnB,SAAS,EAAE,CAAC;IACZ,QAAQ,EAAE,CAAC;IACX,sBAAsB,EAAE,EAAE;IAC1B,SAAS,EAAE,EAAE;IACb,GAAG,EAAE,EAAE;CACE,CAAC","sourcesContent":["export const EShapeLockPart = {\n\tTRANSFORM_CHILD: 1,\n\tTRANSFORM_THIS: 2,\n\tTRANSFORM_PARENT: 4,\n\tTRANSFORM: 7,\n\tUPLOADED: 8,\n\tTRANSFORM_AND_UPLOADED: 15,\n\tCONNECTOR: 16,\n\tALL: 31\n} as const;\n\nexport type EShapeLockPart = number;\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Winter Cardinal UI v0.
|
|
2
|
+
Winter Cardinal UI v0.376.0
|
|
3
3
|
Copyright (C) 2019 Toshiba Corporation
|
|
4
4
|
SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
DThemes.setDefaultThemeClass(DThemeDark);
|
|
79
79
|
};
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
/******************************************************************************
|
|
82
82
|
Copyright (c) Microsoft Corporation.
|
|
83
83
|
|
|
84
84
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
93
93
|
PERFORMANCE OF THIS SOFTWARE.
|
|
94
94
|
***************************************************************************** */
|
|
95
|
-
/* global Reflect, Promise */
|
|
95
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
96
96
|
|
|
97
97
|
var extendStatics = function(d, b) {
|
|
98
98
|
extendStatics = Object.setPrototypeOf ||
|
|
@@ -107,7 +107,12 @@
|
|
|
107
107
|
extendStatics(d, b);
|
|
108
108
|
function __() { this.constructor = d; }
|
|
109
109
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
110
|
-
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
113
|
+
var e = new Error(message);
|
|
114
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
115
|
+
};
|
|
111
116
|
|
|
112
117
|
const DBaseInteractive = wcardinal.ui.DBaseInteractive;
|
|
113
118
|
|