@wcardinal/wcardinal-ui 0.330.0 → 0.332.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/d-animation-base.d.ts +3 -1
- package/dist/types/wcardinal/ui/d-animation.d.ts +21 -3
- package/dist/types/wcardinal/ui/d-view-gesture-impl.d.ts +7 -4
- package/dist/types/wcardinal/ui/d-view-impl.d.ts +2 -2
- package/dist/types/wcardinal/ui/d-view-parent.d.ts +5 -0
- package/dist/types/wcardinal/ui/d-view-transform-impl.d.ts +8 -4
- package/dist/types/wcardinal/ui/d-view.d.ts +35 -0
- package/dist/types/wcardinal/ui/index.d.ts +1 -1
- package/dist/types/wcardinal/ui/shape/e-shape-connector-edge-impl.d.ts +7 -1
- package/dist/types/wcardinal/ui/util/util-gesture.d.ts +12 -0
- package/dist/wcardinal/ui/d-animation-base.js +10 -0
- package/dist/wcardinal/ui/d-animation-base.js.map +1 -1
- package/dist/wcardinal/ui/d-animation.js.map +1 -1
- package/dist/wcardinal/ui/d-view-gesture-impl.js +30 -9
- package/dist/wcardinal/ui/d-view-gesture-impl.js.map +1 -1
- package/dist/wcardinal/ui/d-view-impl.js +44 -27
- package/dist/wcardinal/ui/d-view-impl.js.map +1 -1
- package/dist/wcardinal/ui/{d-view-stopper.js → d-view-parent.js} +1 -1
- package/dist/wcardinal/ui/d-view-parent.js.map +1 -0
- package/dist/wcardinal/ui/d-view-transform-impl.js +30 -5
- package/dist/wcardinal/ui/d-view-transform-impl.js.map +1 -1
- package/dist/wcardinal/ui/d-view.js.map +1 -1
- package/dist/wcardinal/ui/index.js +1 -1
- package/dist/wcardinal/ui/index.js.map +1 -1
- package/dist/wcardinal/ui/shape/e-shape-connector-edge-container-impl.js +6 -2
- package/dist/wcardinal/ui/shape/e-shape-connector-edge-container-impl.js.map +1 -1
- package/dist/wcardinal/ui/shape/e-shape-connector-edge-impl.js +88 -26
- package/dist/wcardinal/ui/shape/e-shape-connector-edge-impl.js.map +1 -1
- package/dist/wcardinal/ui/util/util-gesture.js +22 -0
- package/dist/wcardinal/ui/util/util-gesture.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 +229 -69
- package/dist/wcardinal-ui.js +229 -69
- package/dist/wcardinal-ui.min.js +2 -2
- package/dist/wcardinal-ui.min.js.map +1 -1
- package/package.json +1 -1
- package/dist/types/wcardinal/ui/d-view-stopper.d.ts +0 -4
- package/dist/wcardinal/ui/d-view-stopper.js.map +0 -1
|
@@ -12,6 +12,9 @@ var EShapeConnectorEdgeImpl = /** @class */ (function () {
|
|
|
12
12
|
this._parent = parent;
|
|
13
13
|
this._onChange = onChange;
|
|
14
14
|
this._acceptor = new EShapeConnectorEdgeAcceptorImpl(this);
|
|
15
|
+
this._acceptorTransformNew = new Matrix();
|
|
16
|
+
this._acceptorTransformOld = new Matrix();
|
|
17
|
+
this._hasAcceptorTransformOld = false;
|
|
15
18
|
this._local = new ObservablePoint(function () {
|
|
16
19
|
_this.onLocalChange();
|
|
17
20
|
}, undefined);
|
|
@@ -24,6 +27,7 @@ var EShapeConnectorEdgeImpl = /** @class */ (function () {
|
|
|
24
27
|
this._normalId = 0;
|
|
25
28
|
this._side = EShapeAcceptorEdgeSide.TOP;
|
|
26
29
|
this._margin = 0;
|
|
30
|
+
this._other = null;
|
|
27
31
|
this._lockCount = 0;
|
|
28
32
|
this._isAcceptorChanged = false;
|
|
29
33
|
this._isLocalChanged = false;
|
|
@@ -57,6 +61,7 @@ var EShapeConnectorEdgeImpl = /** @class */ (function () {
|
|
|
57
61
|
isChanged = true;
|
|
58
62
|
}
|
|
59
63
|
if (this._isAcceptorChanged) {
|
|
64
|
+
this._hasAcceptorTransformOld = false;
|
|
60
65
|
if (!this._isLocalChanged) {
|
|
61
66
|
this._localIdRequired += 1;
|
|
62
67
|
}
|
|
@@ -140,6 +145,16 @@ var EShapeConnectorEdgeImpl = /** @class */ (function () {
|
|
|
140
145
|
enumerable: false,
|
|
141
146
|
configurable: true
|
|
142
147
|
});
|
|
148
|
+
Object.defineProperty(EShapeConnectorEdgeImpl.prototype, "other", {
|
|
149
|
+
get: function () {
|
|
150
|
+
return this._other;
|
|
151
|
+
},
|
|
152
|
+
set: function (other) {
|
|
153
|
+
this._other = other;
|
|
154
|
+
},
|
|
155
|
+
enumerable: false,
|
|
156
|
+
configurable: true
|
|
157
|
+
});
|
|
143
158
|
EShapeConnectorEdgeImpl.prototype.set = function (acceptorShape, acceptorEdge, acceptorX, acceptorY, margin, x, y, nx, ny, side) {
|
|
144
159
|
this.lock();
|
|
145
160
|
this._acceptor.set(acceptorShape, acceptorEdge, acceptorX, acceptorY);
|
|
@@ -241,7 +256,7 @@ var EShapeConnectorEdgeImpl = /** @class */ (function () {
|
|
|
241
256
|
return this;
|
|
242
257
|
};
|
|
243
258
|
EShapeConnectorEdgeImpl.prototype.doFit = function () {
|
|
244
|
-
var _a, _b;
|
|
259
|
+
var _a, _b, _c;
|
|
245
260
|
var localIdRequired = this._localIdRequired;
|
|
246
261
|
var isLocalDirty = this._localId !== localIdRequired;
|
|
247
262
|
var normalIdRequired = this._normalIdRequired;
|
|
@@ -255,35 +270,82 @@ var EShapeConnectorEdgeImpl = /** @class */ (function () {
|
|
|
255
270
|
if (acceptorShape != null && acceptorEdge != null) {
|
|
256
271
|
var edge = EShapeAcceptors.get(acceptorShape.type).get(acceptorShape, acceptorEdge);
|
|
257
272
|
if (edge) {
|
|
258
|
-
var
|
|
259
|
-
var
|
|
260
|
-
|
|
261
|
-
var
|
|
262
|
-
var
|
|
263
|
-
|
|
264
|
-
|
|
273
|
+
var oat = this._acceptorTransformOld;
|
|
274
|
+
var nat = this._acceptorTransformNew;
|
|
275
|
+
this.toAcceptorTransform(acceptorShape, nat);
|
|
276
|
+
var other = this._other;
|
|
277
|
+
var isOtherDangling = this._hasAcceptorTransformOld &&
|
|
278
|
+
other != null &&
|
|
279
|
+
other.acceptor.shape == null;
|
|
280
|
+
var work = ((_a = EShapeConnectorEdgeImpl.WORK_MATRIX) !== null && _a !== void 0 ? _a : (EShapeConnectorEdgeImpl.WORK_MATRIX = new Matrix()));
|
|
281
|
+
if (isOtherDangling) {
|
|
282
|
+
oat.copyTo(work).invert().prepend(nat);
|
|
283
|
+
}
|
|
284
|
+
this._acceptorTransformNew = oat;
|
|
285
|
+
this._acceptorTransformOld = nat;
|
|
286
|
+
this._hasAcceptorTransformOld = true;
|
|
265
287
|
this.lock();
|
|
266
288
|
if (isLocalDirty) {
|
|
289
|
+
var l = this._local;
|
|
290
|
+
var olx = l.x;
|
|
291
|
+
var oly = l.y;
|
|
267
292
|
var size = acceptorShape.size;
|
|
268
293
|
var pivot = acceptorShape.transform.pivot;
|
|
269
|
-
var
|
|
270
|
-
var
|
|
271
|
-
|
|
294
|
+
var x = pivot.x + size.x * ((_b = acceptor.x) !== null && _b !== void 0 ? _b : edge.x);
|
|
295
|
+
var y = pivot.y + size.y * ((_c = acceptor.y) !== null && _c !== void 0 ? _c : edge.y);
|
|
296
|
+
var nlx = nat.a * x + nat.c * y + nat.tx;
|
|
297
|
+
var nly = nat.b * x + nat.d * y + nat.ty;
|
|
298
|
+
l.set(nlx, nly);
|
|
299
|
+
if (isOtherDangling) {
|
|
300
|
+
var ol = other.local;
|
|
301
|
+
var oolx = ol.x;
|
|
302
|
+
var ooly = ol.y;
|
|
303
|
+
var nolx = work.a * oolx + work.c * ooly + work.tx;
|
|
304
|
+
var noly = work.b * oolx + work.d * ooly + work.ty;
|
|
305
|
+
var odx = oolx - olx;
|
|
306
|
+
var ody = ooly - oly;
|
|
307
|
+
var ndx = nolx - nlx;
|
|
308
|
+
var ndy = noly - nly;
|
|
309
|
+
var od = odx * odx + ody * ody;
|
|
310
|
+
var nd = ndx * ndx + ndy * ndy;
|
|
311
|
+
if (0.000001 < nd) {
|
|
312
|
+
var f = Math.sqrt(od / nd);
|
|
313
|
+
ol.set(nlx + ndx * f, nly + ndy * f);
|
|
314
|
+
}
|
|
315
|
+
else {
|
|
316
|
+
ol.set(nolx, noly);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
272
319
|
}
|
|
273
320
|
if (isNormalDirty) {
|
|
274
|
-
var
|
|
275
|
-
var
|
|
276
|
-
var
|
|
277
|
-
var
|
|
278
|
-
var
|
|
279
|
-
var
|
|
280
|
-
var
|
|
281
|
-
if (0.000001 <
|
|
282
|
-
var f = 1 / Math.sqrt(
|
|
283
|
-
|
|
321
|
+
var en = edge.normal;
|
|
322
|
+
var enx = en.x;
|
|
323
|
+
var eny = en.y;
|
|
324
|
+
var nx = nat.a * enx + nat.c * eny;
|
|
325
|
+
var ny = nat.b * enx + nat.d * eny;
|
|
326
|
+
var sd = nx * nx + ny * ny;
|
|
327
|
+
var n = this._normal;
|
|
328
|
+
if (0.000001 < sd) {
|
|
329
|
+
var f = 1 / Math.sqrt(sd);
|
|
330
|
+
n.set(nx * f, ny * f);
|
|
284
331
|
}
|
|
285
332
|
else {
|
|
286
|
-
|
|
333
|
+
n.set(enx, eny);
|
|
334
|
+
}
|
|
335
|
+
if (isOtherDangling) {
|
|
336
|
+
var on = other.normal;
|
|
337
|
+
var oonx = on.x;
|
|
338
|
+
var oony = on.y;
|
|
339
|
+
var nonx = work.a * oonx + work.c * oony;
|
|
340
|
+
var nony = work.b * oonx + work.d * oony;
|
|
341
|
+
var osd = nonx * nonx + nony * nony;
|
|
342
|
+
if (0.000001 < osd) {
|
|
343
|
+
var f = 1 / Math.sqrt(osd);
|
|
344
|
+
on.set(nonx * f, nony * f);
|
|
345
|
+
}
|
|
346
|
+
else {
|
|
347
|
+
on.set(oonx, oony);
|
|
348
|
+
}
|
|
287
349
|
}
|
|
288
350
|
}
|
|
289
351
|
var result = this._isLocalChanged || this._isNormalChanged;
|
|
@@ -294,20 +356,19 @@ var EShapeConnectorEdgeImpl = /** @class */ (function () {
|
|
|
294
356
|
}
|
|
295
357
|
return false;
|
|
296
358
|
};
|
|
297
|
-
EShapeConnectorEdgeImpl.prototype.toAcceptorTransform = function (shape) {
|
|
298
|
-
var _a;
|
|
359
|
+
EShapeConnectorEdgeImpl.prototype.toAcceptorTransform = function (shape, result) {
|
|
299
360
|
shape.updateTransform();
|
|
300
361
|
var parent = this._parent;
|
|
301
362
|
var parentParent = parent.parent;
|
|
302
363
|
if (parentParent) {
|
|
303
364
|
parent.updateTransform();
|
|
304
|
-
return
|
|
365
|
+
return result
|
|
305
366
|
.copyFrom(parentParent.transform.worldTransform)
|
|
306
367
|
.invert()
|
|
307
368
|
.append(shape.transform.worldTransform);
|
|
308
369
|
}
|
|
309
370
|
else {
|
|
310
|
-
return shape.transform.worldTransform;
|
|
371
|
+
return result.copyFrom(shape.transform.worldTransform);
|
|
311
372
|
}
|
|
312
373
|
};
|
|
313
374
|
EShapeConnectorEdgeImpl.prototype.onAcceptorChange = function () {
|
|
@@ -317,6 +378,7 @@ var EShapeConnectorEdgeImpl = /** @class */ (function () {
|
|
|
317
378
|
this._isAcceptorChanged = true;
|
|
318
379
|
return;
|
|
319
380
|
}
|
|
381
|
+
this._hasAcceptorTransformOld = false;
|
|
320
382
|
this.fit(true);
|
|
321
383
|
};
|
|
322
384
|
EShapeConnectorEdgeImpl.prototype.onLocalChange = function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"e-shape-connector-edge-impl.js","sourceRoot":"","sources":["../../../../src/main/typescript/wcardinal/ui/shape/e-shape-connector-edge-impl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAU,MAAM,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAItD,OAAO,EAAE,+BAA+B,EAAE,MAAM,wCAAwC,CAAC;AAIzF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8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IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;QACnC,IAAI,KAAK,EAAE;YACV,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;SAC7B;QACD,OAAO,IAAI,CAAC;IACb,CAAC;IACF,8BAAC;AAAD,CAAC,AAtYD,IAsYC","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { IPoint, Matrix, ObservablePoint } from \"pixi.js\";\nimport { EShape } from \"./e-shape\";\nimport { EShapeAcceptors } from \"./e-shape-acceptors\";\nimport { EShapeConnector } from \"./e-shape-connector\";\nimport { EShapeConnectorEdge, EShapeConnectorEdgeSerialized } from \"./e-shape-connector-edge\";\nimport { EShapeConnectorEdgeAcceptor } from \"./e-shape-connector-edge-acceptor\";\nimport { EShapeConnectorEdgeAcceptorImpl } from \"./e-shape-connector-edge-acceptor-impl\";\nimport { EShapeResourceManagerDeserialization } from \"./e-shape-resource-manager-deserialization\";\nimport { EShapeResourceManagerSerialization } from \"./e-shape-resource-manager-serialization\";\nimport { EShapeUuidMapping } from \"./e-shape-uuid-mapping\";\nimport { EShapeAcceptorEdgeSide } from \"./e-shape-acceptor-edge-side\";\n\nexport class EShapeConnectorEdgeImpl implements EShapeConnectorEdge {\n\tprotected static WORK_MATRIX?: Matrix;\n\n\tprotected _parent: EShapeConnector;\n\tprotected _onChange: () => void;\n\tprotected _acceptor: EShapeConnectorEdgeAcceptor;\n\tprotected _localIdRequired: number;\n\tprotected _localId: number;\n\tprotected _local: IPoint;\n\tprotected _normalIdRequired: number;\n\tprotected _normalId: number;\n\tprotected _normal: IPoint;\n\tprotected _side: EShapeAcceptorEdgeSide;\n\tprotected _margin: number;\n\tprotected _lockCount: number;\n\tprotected _isAcceptorChanged: boolean;\n\tprotected _isLocalChanged: boolean;\n\tprotected _isNormalChanged: boolean;\n\tprotected _isOtherChanged: boolean;\n\n\tconstructor(parent: EShapeConnector, onChange: () => void) {\n\t\tthis._parent = parent;\n\t\tthis._onChange = onChange;\n\t\tthis._acceptor = new EShapeConnectorEdgeAcceptorImpl(this);\n\n\t\tthis._local = new ObservablePoint((): void => {\n\t\t\tthis.onLocalChange();\n\t\t}, undefined);\n\t\tthis._localIdRequired = 0;\n\t\tthis._localId = 0;\n\n\t\tthis._normal = new ObservablePoint((): void => {\n\t\t\tthis.onNormalChange();\n\t\t}, undefined);\n\t\tthis._normalIdRequired = 0;\n\t\tthis._normalId = 0;\n\n\t\tthis._side = EShapeAcceptorEdgeSide.TOP;\n\n\t\tthis._margin = 0;\n\n\t\tthis._lockCount = 0;\n\t\tthis._isAcceptorChanged = false;\n\t\tthis._isLocalChanged = false;\n\t\tthis._isNormalChanged = false;\n\t\tthis._isOtherChanged = false;\n\t}\n\n\tlock(): void {\n\t\tthis._lockCount += 1;\n\t\tif (this._lockCount === 1) {\n\t\t\tthis._isAcceptorChanged = false;\n\t\t\tthis._isLocalChanged = false;\n\t\t\tthis._isNormalChanged = false;\n\t\t\tthis._isOtherChanged = false;\n\t\t}\n\t}\n\n\tunlock(): void {\n\t\tthis._lockCount -= 1;\n\t\tif (this._lockCount === 0) {\n\t\t\tlet isChanged = false;\n\n\t\t\tif (this._isLocalChanged) {\n\t\t\t\tthis._localIdRequired += 1;\n\t\t\t\tthis._localId = this._localIdRequired;\n\t\t\t\tisChanged = true;\n\t\t\t}\n\n\t\t\tif (this._isNormalChanged) {\n\t\t\t\tthis._normalIdRequired += 1;\n\t\t\t\tthis._normalId = this._normalIdRequired;\n\t\t\t\tisChanged = true;\n\t\t\t}\n\n\t\t\tif (this._isOtherChanged) {\n\t\t\t\tisChanged = true;\n\t\t\t}\n\n\t\t\tif (this._isAcceptorChanged) {\n\t\t\t\tif (!this._isLocalChanged) {\n\t\t\t\t\tthis._localIdRequired += 1;\n\t\t\t\t}\n\t\t\t\tif (!this._isNormalChanged) {\n\t\t\t\t\tthis._normalIdRequired += 1;\n\t\t\t\t}\n\t\t\t\tif (this.doFit()) {\n\t\t\t\t\tisChanged = false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (isChanged) {\n\t\t\t\tthis._onChange();\n\t\t\t}\n\t\t}\n\t}\n\n\tget parent(): EShapeConnector {\n\t\treturn this._parent;\n\t}\n\n\tget acceptor(): EShapeConnectorEdgeAcceptor {\n\t\treturn this._acceptor;\n\t}\n\n\tget local(): IPoint {\n\t\treturn this._local;\n\t}\n\n\tget localId(): number {\n\t\treturn this._localId;\n\t}\n\n\tget normal(): IPoint {\n\t\treturn this._normal;\n\t}\n\n\tget normalId(): number {\n\t\treturn this._normalId;\n\t}\n\n\tget side(): EShapeAcceptorEdgeSide {\n\t\treturn this._side;\n\t}\n\n\tset side(side: EShapeAcceptorEdgeSide) {\n\t\tif (this._side !== side) {\n\t\t\tthis._side = side;\n\t\t\tthis.onOtherChange();\n\t\t}\n\t}\n\n\tget margin(): number {\n\t\treturn this._margin;\n\t}\n\n\tset margin(margin: number) {\n\t\tif (this._margin !== margin) {\n\t\t\tthis._margin = margin;\n\t\t\tthis.onOtherChange();\n\t\t}\n\t}\n\n\tset(\n\t\tacceptorShape?: EShape | null,\n\t\tacceptorEdge?: string | null,\n\t\tacceptorX?: number | null,\n\t\tacceptorY?: number | null,\n\t\tmargin?: number,\n\t\tx?: number,\n\t\ty?: number,\n\t\tnx?: number,\n\t\tny?: number,\n\t\tside?: EShapeAcceptorEdgeSide\n\t): this {\n\t\tthis.lock();\n\t\tthis._acceptor.set(acceptorShape, acceptorEdge, acceptorX, acceptorY);\n\n\t\tconst local = this._local;\n\t\tif (x != null && y != null) {\n\t\t\tlocal.set(x, y);\n\t\t} else if (x != null) {\n\t\t\tlocal.x = x;\n\t\t} else if (y != null) {\n\t\t\tlocal.y = y;\n\t\t}\n\n\t\tconst normal = this._normal;\n\t\tif (nx != null && ny != null) {\n\t\t\tnormal.set(nx, ny);\n\t\t} else if (nx != null) {\n\t\t\tnormal.x = nx;\n\t\t} else if (ny != null) {\n\t\t\tnormal.y = ny;\n\t\t}\n\n\t\tif (side != null) {\n\t\t\tthis.side = side;\n\t\t}\n\n\t\tif (margin != null) {\n\t\t\tthis.margin = margin;\n\t\t}\n\n\t\tthis.unlock();\n\t\treturn this;\n\t}\n\n\tcopy(source: EShapeConnectorEdge): this {\n\t\tthis.lock();\n\t\tthis._acceptor.copy(source.acceptor);\n\t\tthis._local.copyFrom(source.local);\n\t\tthis._normal.copyFrom(source.normal);\n\t\tthis.side = source.side;\n\t\tthis.margin = source.margin;\n\t\tthis.unlock();\n\t\treturn this;\n\t}\n\n\tserialize(manager: EShapeResourceManagerSerialization): number {\n\t\tconst acceptor = this._acceptor;\n\t\tconst shape = acceptor.shape;\n\t\tconst shapeUuid = shape ? shape.uuid : null;\n\t\tconst edge = acceptor.edge;\n\t\tconst edgeId = edge != null ? manager.addResource(edge) : -1;\n\t\tconst local = this._local;\n\t\tconst normal = this._normal;\n\t\tconst side = this._side;\n\t\treturn manager.addResource(\n\t\t\t`[${shapeUuid},${edgeId},${local.x},${local.y},${this._margin},${normal.x},${normal.y},${acceptor.x},${acceptor.y},${side}]`\n\t\t);\n\t}\n\n\tdeserialize(\n\t\tresourceId: number,\n\t\tmapping: EShapeUuidMapping,\n\t\tmanager: EShapeResourceManagerDeserialization\n\t): void {\n\t\tconst resources = manager.resources;\n\t\tif (0 <= resourceId && resourceId < resources.length) {\n\t\t\tlet parsed = manager.getExtension<EShapeConnectorEdgeSerialized>(resourceId);\n\t\t\tif (parsed == null) {\n\t\t\t\tparsed = JSON.parse(resources[resourceId]) as EShapeConnectorEdgeSerialized;\n\t\t\t\tmanager.setExtension(resourceId, parsed);\n\t\t\t}\n\t\t\tlet shape: EShape | null = null;\n\t\t\tconst shapeUuid = parsed[0];\n\t\t\tif (shapeUuid != null) {\n\t\t\t\tshape = mapping.find(shapeUuid) || null;\n\t\t\t}\n\t\t\tthis.lock();\n\t\t\tconst acceptor = this._acceptor;\n\t\t\tacceptor.shape = shape;\n\t\t\tconst edgeId = parsed[1];\n\t\t\tacceptor.edge = 0 <= edgeId && edgeId < resources.length ? resources[edgeId] : null;\n\t\t\tacceptor.x = parsed[7] ?? null;\n\t\t\tacceptor.y = parsed[8] ?? null;\n\t\t\tthis._local.set(parsed[2], parsed[3]);\n\t\t\tconst normalX = parsed[5];\n\t\t\tconst normalY = parsed[6];\n\t\t\tconst normal = this._normal;\n\t\t\tif (normalX != null && normalY != null) {\n\t\t\t\tnormal.set(normalX, normalY);\n\t\t\t} else {\n\t\t\t\tnormal.set(1, 0);\n\t\t\t}\n\t\t\tthis.side = parsed[9] ?? EShapeAcceptorEdgeSide.TOP;\n\t\t\tthis.margin = parsed[4] || 0;\n\t\t\tthis.unlock();\n\t\t\tif (shape) {\n\t\t\t\tshape.connector.add(this);\n\t\t\t}\n\t\t}\n\t}\n\n\tfit(forcibly?: boolean): this {\n\t\tif (forcibly) {\n\t\t\tthis._localIdRequired += 1;\n\t\t\tthis._normalIdRequired += 1;\n\t\t}\n\t\tthis.doFit();\n\t\treturn this;\n\t}\n\n\tprotected doFit(): boolean {\n\t\tconst localIdRequired = this._localIdRequired;\n\t\tconst isLocalDirty = this._localId !== localIdRequired;\n\t\tconst normalIdRequired = this._normalIdRequired;\n\t\tconst isNormalDirty = this._normalId !== normalIdRequired;\n\t\tif (isLocalDirty || isNormalDirty) {\n\t\t\tthis._localId = localIdRequired;\n\t\t\tthis._normalId = normalIdRequired;\n\n\t\t\tconst acceptor = this._acceptor;\n\t\t\tconst acceptorShape = acceptor.shape;\n\t\t\tconst acceptorEdge = acceptor.edge;\n\t\t\tif (acceptorShape != null && acceptorEdge != null) {\n\t\t\t\tconst edge = EShapeAcceptors.get(acceptorShape.type).get(\n\t\t\t\t\tacceptorShape,\n\t\t\t\t\tacceptorEdge\n\t\t\t\t);\n\t\t\t\tif (edge) {\n\t\t\t\t\tconst transform = this.toAcceptorTransform(acceptorShape);\n\t\t\t\t\tconst a = transform.a;\n\t\t\t\t\tconst b = transform.b;\n\t\t\t\t\tconst c = transform.c;\n\t\t\t\t\tconst d = transform.d;\n\t\t\t\t\tconst tx = transform.tx;\n\t\t\t\t\tconst ty = transform.ty;\n\n\t\t\t\t\tthis.lock();\n\t\t\t\t\tif (isLocalDirty) {\n\t\t\t\t\t\tconst size = acceptorShape.size;\n\t\t\t\t\t\tconst pivot = acceptorShape.transform.pivot;\n\t\t\t\t\t\tconst lx = pivot.x + size.x * (acceptor.x ?? edge.x);\n\t\t\t\t\t\tconst ly = pivot.y + size.y * (acceptor.y ?? edge.y);\n\t\t\t\t\t\tthis._local.set(a * lx + c * ly + tx, b * lx + d * ly + ty);\n\t\t\t\t\t}\n\t\t\t\t\tif (isNormalDirty) {\n\t\t\t\t\t\tconst edgeNormal = edge.normal;\n\t\t\t\t\t\tconst nx = edgeNormal.x;\n\t\t\t\t\t\tconst ny = edgeNormal.y;\n\t\t\t\t\t\tconst x = a * nx + c * ny;\n\t\t\t\t\t\tconst y = b * nx + d * ny;\n\t\t\t\t\t\tconst l = x * x + y * y;\n\t\t\t\t\t\tconst normal = this._normal;\n\t\t\t\t\t\tif (0.000001 < l) {\n\t\t\t\t\t\t\tconst f = 1 / Math.sqrt(l);\n\t\t\t\t\t\t\tnormal.set(x * f, y * f);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tnormal.set(nx, ny);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tconst result = this._isLocalChanged || this._isNormalChanged;\n\t\t\t\t\tthis.unlock();\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tprotected toAcceptorTransform(shape: EShape): Matrix {\n\t\tshape.updateTransform();\n\t\tconst parent = this._parent;\n\t\tconst parentParent = parent.parent;\n\t\tif (parentParent) {\n\t\t\tparent.updateTransform();\n\t\t\treturn (EShapeConnectorEdgeImpl.WORK_MATRIX ??= new Matrix())\n\t\t\t\t.copyFrom(parentParent.transform.worldTransform)\n\t\t\t\t.invert()\n\t\t\t\t.append(shape.transform.worldTransform);\n\t\t} else {\n\t\t\treturn shape.transform.worldTransform;\n\t\t}\n\t}\n\n\tonAcceptorChange(): void {\n\t\tif (0 < this._lockCount) {\n\t\t\tthis._isLocalChanged = false;\n\t\t\tthis._isNormalChanged = false;\n\t\t\tthis._isAcceptorChanged = true;\n\t\t\treturn;\n\t\t}\n\t\tthis.fit(true);\n\t}\n\n\tprotected onLocalChange(): void {\n\t\tif (0 < this._lockCount) {\n\t\t\tthis._isLocalChanged = true;\n\t\t\treturn;\n\t\t}\n\t\tthis._localIdRequired += 1;\n\t\tthis._localId = this._localIdRequired;\n\t\tthis._onChange();\n\t}\n\n\tprotected onNormalChange(): void {\n\t\tif (0 < this._lockCount) {\n\t\t\tthis._isNormalChanged = true;\n\t\t\treturn;\n\t\t}\n\t\tthis._normalIdRequired += 1;\n\t\tthis._normalId = this._normalIdRequired;\n\t\tthis._onChange();\n\t}\n\n\tprotected onOtherChange(): void {\n\t\tif (0 < this._lockCount) {\n\t\t\tthis._isOtherChanged = true;\n\t\t\treturn;\n\t\t}\n\t\tthis._onChange();\n\t}\n\n\tattach(): this {\n\t\tconst shape = this._acceptor.shape;\n\t\tif (shape) {\n\t\t\tshape.connector.add(this);\n\t\t}\n\t\treturn this;\n\t}\n\n\tdetach(): this {\n\t\tconst shape = this._acceptor.shape;\n\t\tif (shape) {\n\t\t\tshape.connector.remove(this);\n\t\t}\n\t\treturn this;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"e-shape-connector-edge-impl.js","sourceRoot":"","sources":["../../../../src/main/typescript/wcardinal/ui/shape/e-shape-connector-edge-impl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAU,MAAM,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAItD,OAAO,EAAE,+BAA+B,EAAE,MAAM,wCAAwC,CAAC;AAIzF,OAAO,EAAE,sBAAsB,EAA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xC,IAAI,CAAC,SAAS,EAAE,CAAC;IAClB,CAAC;IAES,+CAAa,GAAvB;QACC,IAAI,CAAC,GAAG,IAAI,CAAC,UAAU,EAAE;YACxB,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;YAC5B,OAAO;SACP;QACD,IAAI,CAAC,SAAS,EAAE,CAAC;IAClB,CAAC;IAED,wCAAM,GAAN;QACC,IAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;QACnC,IAAI,KAAK,EAAE;YACV,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;SAC1B;QACD,OAAO,IAAI,CAAC;IACb,CAAC;IAED,wCAAM,GAAN;QACC,IAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;QACnC,IAAI,KAAK,EAAE;YACV,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;SAC7B;QACD,OAAO,IAAI,CAAC;IACb,CAAC;IACF,8BAAC;AAAD,CAAC,AA1cD,IA0cC","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { IPoint, Matrix, ObservablePoint } from \"pixi.js\";\nimport { EShape } from \"./e-shape\";\nimport { EShapeAcceptors } from \"./e-shape-acceptors\";\nimport { EShapeConnector } from \"./e-shape-connector\";\nimport { EShapeConnectorEdge, EShapeConnectorEdgeSerialized } from \"./e-shape-connector-edge\";\nimport { EShapeConnectorEdgeAcceptor } from \"./e-shape-connector-edge-acceptor\";\nimport { EShapeConnectorEdgeAcceptorImpl } from \"./e-shape-connector-edge-acceptor-impl\";\nimport { EShapeResourceManagerDeserialization } from \"./e-shape-resource-manager-deserialization\";\nimport { EShapeResourceManagerSerialization } from \"./e-shape-resource-manager-serialization\";\nimport { EShapeUuidMapping } from \"./e-shape-uuid-mapping\";\nimport { EShapeAcceptorEdgeSide } from \"./e-shape-acceptor-edge-side\";\n\nexport class EShapeConnectorEdgeImpl implements EShapeConnectorEdge {\n\tprotected static WORK_MATRIX?: Matrix;\n\n\tprotected _parent: EShapeConnector;\n\tprotected _onChange: () => void;\n\tprotected _acceptor: EShapeConnectorEdgeAcceptor;\n\tprotected _acceptorTransformNew: Matrix;\n\tprotected _acceptorTransformOld: Matrix;\n\tprotected _hasAcceptorTransformOld: boolean;\n\tprotected _localIdRequired: number;\n\tprotected _localId: number;\n\tprotected _local: IPoint;\n\tprotected _normalIdRequired: number;\n\tprotected _normalId: number;\n\tprotected _normal: IPoint;\n\tprotected _side: EShapeAcceptorEdgeSide;\n\tprotected _margin: number;\n\tprotected _other: EShapeConnectorEdge | null;\n\tprotected _lockCount: number;\n\tprotected _isAcceptorChanged: boolean;\n\tprotected _isLocalChanged: boolean;\n\tprotected _isNormalChanged: boolean;\n\tprotected _isOtherChanged: boolean;\n\n\tconstructor(parent: EShapeConnector, onChange: () => void) {\n\t\tthis._parent = parent;\n\t\tthis._onChange = onChange;\n\t\tthis._acceptor = new EShapeConnectorEdgeAcceptorImpl(this);\n\t\tthis._acceptorTransformNew = new Matrix();\n\t\tthis._acceptorTransformOld = new Matrix();\n\t\tthis._hasAcceptorTransformOld = false;\n\n\t\tthis._local = new ObservablePoint((): void => {\n\t\t\tthis.onLocalChange();\n\t\t}, undefined);\n\t\tthis._localIdRequired = 0;\n\t\tthis._localId = 0;\n\n\t\tthis._normal = new ObservablePoint((): void => {\n\t\t\tthis.onNormalChange();\n\t\t}, undefined);\n\t\tthis._normalIdRequired = 0;\n\t\tthis._normalId = 0;\n\n\t\tthis._side = EShapeAcceptorEdgeSide.TOP;\n\n\t\tthis._margin = 0;\n\n\t\tthis._other = null;\n\n\t\tthis._lockCount = 0;\n\t\tthis._isAcceptorChanged = false;\n\t\tthis._isLocalChanged = false;\n\t\tthis._isNormalChanged = false;\n\t\tthis._isOtherChanged = false;\n\t}\n\n\tlock(): void {\n\t\tthis._lockCount += 1;\n\t\tif (this._lockCount === 1) {\n\t\t\tthis._isAcceptorChanged = false;\n\t\t\tthis._isLocalChanged = false;\n\t\t\tthis._isNormalChanged = false;\n\t\t\tthis._isOtherChanged = false;\n\t\t}\n\t}\n\n\tunlock(): void {\n\t\tthis._lockCount -= 1;\n\t\tif (this._lockCount === 0) {\n\t\t\tlet isChanged = false;\n\n\t\t\tif (this._isLocalChanged) {\n\t\t\t\tthis._localIdRequired += 1;\n\t\t\t\tthis._localId = this._localIdRequired;\n\t\t\t\tisChanged = true;\n\t\t\t}\n\n\t\t\tif (this._isNormalChanged) {\n\t\t\t\tthis._normalIdRequired += 1;\n\t\t\t\tthis._normalId = this._normalIdRequired;\n\t\t\t\tisChanged = true;\n\t\t\t}\n\n\t\t\tif (this._isOtherChanged) {\n\t\t\t\tisChanged = true;\n\t\t\t}\n\n\t\t\tif (this._isAcceptorChanged) {\n\t\t\t\tthis._hasAcceptorTransformOld = false;\n\t\t\t\tif (!this._isLocalChanged) {\n\t\t\t\t\tthis._localIdRequired += 1;\n\t\t\t\t}\n\t\t\t\tif (!this._isNormalChanged) {\n\t\t\t\t\tthis._normalIdRequired += 1;\n\t\t\t\t}\n\t\t\t\tif (this.doFit()) {\n\t\t\t\t\tisChanged = false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (isChanged) {\n\t\t\t\tthis._onChange();\n\t\t\t}\n\t\t}\n\t}\n\n\tget parent(): EShapeConnector {\n\t\treturn this._parent;\n\t}\n\n\tget acceptor(): EShapeConnectorEdgeAcceptor {\n\t\treturn this._acceptor;\n\t}\n\n\tget local(): IPoint {\n\t\treturn this._local;\n\t}\n\n\tget localId(): number {\n\t\treturn this._localId;\n\t}\n\n\tget normal(): IPoint {\n\t\treturn this._normal;\n\t}\n\n\tget normalId(): number {\n\t\treturn this._normalId;\n\t}\n\n\tget side(): EShapeAcceptorEdgeSide {\n\t\treturn this._side;\n\t}\n\n\tset side(side: EShapeAcceptorEdgeSide) {\n\t\tif (this._side !== side) {\n\t\t\tthis._side = side;\n\t\t\tthis.onOtherChange();\n\t\t}\n\t}\n\n\tget margin(): number {\n\t\treturn this._margin;\n\t}\n\n\tset margin(margin: number) {\n\t\tif (this._margin !== margin) {\n\t\t\tthis._margin = margin;\n\t\t\tthis.onOtherChange();\n\t\t}\n\t}\n\n\tget other(): EShapeConnectorEdge | null {\n\t\treturn this._other;\n\t}\n\n\tset other(other: EShapeConnectorEdge | null) {\n\t\tthis._other = other;\n\t}\n\n\tset(\n\t\tacceptorShape?: EShape | null,\n\t\tacceptorEdge?: string | null,\n\t\tacceptorX?: number | null,\n\t\tacceptorY?: number | null,\n\t\tmargin?: number,\n\t\tx?: number,\n\t\ty?: number,\n\t\tnx?: number,\n\t\tny?: number,\n\t\tside?: EShapeAcceptorEdgeSide\n\t): this {\n\t\tthis.lock();\n\t\tthis._acceptor.set(acceptorShape, acceptorEdge, acceptorX, acceptorY);\n\n\t\tconst local = this._local;\n\t\tif (x != null && y != null) {\n\t\t\tlocal.set(x, y);\n\t\t} else if (x != null) {\n\t\t\tlocal.x = x;\n\t\t} else if (y != null) {\n\t\t\tlocal.y = y;\n\t\t}\n\n\t\tconst normal = this._normal;\n\t\tif (nx != null && ny != null) {\n\t\t\tnormal.set(nx, ny);\n\t\t} else if (nx != null) {\n\t\t\tnormal.x = nx;\n\t\t} else if (ny != null) {\n\t\t\tnormal.y = ny;\n\t\t}\n\n\t\tif (side != null) {\n\t\t\tthis.side = side;\n\t\t}\n\n\t\tif (margin != null) {\n\t\t\tthis.margin = margin;\n\t\t}\n\n\t\tthis.unlock();\n\t\treturn this;\n\t}\n\n\tcopy(source: EShapeConnectorEdge): this {\n\t\tthis.lock();\n\t\tthis._acceptor.copy(source.acceptor);\n\t\tthis._local.copyFrom(source.local);\n\t\tthis._normal.copyFrom(source.normal);\n\t\tthis.side = source.side;\n\t\tthis.margin = source.margin;\n\t\tthis.unlock();\n\t\treturn this;\n\t}\n\n\tserialize(manager: EShapeResourceManagerSerialization): number {\n\t\tconst acceptor = this._acceptor;\n\t\tconst shape = acceptor.shape;\n\t\tconst shapeUuid = shape ? shape.uuid : null;\n\t\tconst edge = acceptor.edge;\n\t\tconst edgeId = edge != null ? manager.addResource(edge) : -1;\n\t\tconst local = this._local;\n\t\tconst normal = this._normal;\n\t\tconst side = this._side;\n\t\treturn manager.addResource(\n\t\t\t`[${shapeUuid},${edgeId},${local.x},${local.y},${this._margin},${normal.x},${normal.y},${acceptor.x},${acceptor.y},${side}]`\n\t\t);\n\t}\n\n\tdeserialize(\n\t\tresourceId: number,\n\t\tmapping: EShapeUuidMapping,\n\t\tmanager: EShapeResourceManagerDeserialization\n\t): void {\n\t\tconst resources = manager.resources;\n\t\tif (0 <= resourceId && resourceId < resources.length) {\n\t\t\tlet parsed = manager.getExtension<EShapeConnectorEdgeSerialized>(resourceId);\n\t\t\tif (parsed == null) {\n\t\t\t\tparsed = JSON.parse(resources[resourceId]) as EShapeConnectorEdgeSerialized;\n\t\t\t\tmanager.setExtension(resourceId, parsed);\n\t\t\t}\n\t\t\tlet shape: EShape | null = null;\n\t\t\tconst shapeUuid = parsed[0];\n\t\t\tif (shapeUuid != null) {\n\t\t\t\tshape = mapping.find(shapeUuid) || null;\n\t\t\t}\n\t\t\tthis.lock();\n\t\t\tconst acceptor = this._acceptor;\n\t\t\tacceptor.shape = shape;\n\t\t\tconst edgeId = parsed[1];\n\t\t\tacceptor.edge = 0 <= edgeId && edgeId < resources.length ? resources[edgeId] : null;\n\t\t\tacceptor.x = parsed[7] ?? null;\n\t\t\tacceptor.y = parsed[8] ?? null;\n\t\t\tthis._local.set(parsed[2], parsed[3]);\n\t\t\tconst normalX = parsed[5];\n\t\t\tconst normalY = parsed[6];\n\t\t\tconst normal = this._normal;\n\t\t\tif (normalX != null && normalY != null) {\n\t\t\t\tnormal.set(normalX, normalY);\n\t\t\t} else {\n\t\t\t\tnormal.set(1, 0);\n\t\t\t}\n\t\t\tthis.side = parsed[9] ?? EShapeAcceptorEdgeSide.TOP;\n\t\t\tthis.margin = parsed[4] || 0;\n\t\t\tthis.unlock();\n\t\t\tif (shape) {\n\t\t\t\tshape.connector.add(this);\n\t\t\t}\n\t\t}\n\t}\n\n\tfit(forcibly?: boolean): this {\n\t\tif (forcibly) {\n\t\t\tthis._localIdRequired += 1;\n\t\t\tthis._normalIdRequired += 1;\n\t\t}\n\t\tthis.doFit();\n\t\treturn this;\n\t}\n\n\tprotected doFit(): boolean {\n\t\tconst localIdRequired = this._localIdRequired;\n\t\tconst isLocalDirty = this._localId !== localIdRequired;\n\t\tconst normalIdRequired = this._normalIdRequired;\n\t\tconst isNormalDirty = this._normalId !== normalIdRequired;\n\t\tif (isLocalDirty || isNormalDirty) {\n\t\t\tthis._localId = localIdRequired;\n\t\t\tthis._normalId = normalIdRequired;\n\n\t\t\tconst acceptor = this._acceptor;\n\t\t\tconst acceptorShape = acceptor.shape;\n\t\t\tconst acceptorEdge = acceptor.edge;\n\t\t\tif (acceptorShape != null && acceptorEdge != null) {\n\t\t\t\tconst edge = EShapeAcceptors.get(acceptorShape.type).get(\n\t\t\t\t\tacceptorShape,\n\t\t\t\t\tacceptorEdge\n\t\t\t\t);\n\t\t\t\tif (edge) {\n\t\t\t\t\tconst oat = this._acceptorTransformOld;\n\t\t\t\t\tconst nat = this._acceptorTransformNew;\n\t\t\t\t\tthis.toAcceptorTransform(acceptorShape, nat);\n\n\t\t\t\t\tconst other = this._other;\n\t\t\t\t\tconst isOtherDangling =\n\t\t\t\t\t\tthis._hasAcceptorTransformOld &&\n\t\t\t\t\t\tother != null &&\n\t\t\t\t\t\tother.acceptor.shape == null;\n\t\t\t\t\tconst work = (EShapeConnectorEdgeImpl.WORK_MATRIX ??= new Matrix());\n\t\t\t\t\tif (isOtherDangling) {\n\t\t\t\t\t\toat.copyTo(work).invert().prepend(nat);\n\t\t\t\t\t}\n\t\t\t\t\tthis._acceptorTransformNew = oat;\n\t\t\t\t\tthis._acceptorTransformOld = nat;\n\t\t\t\t\tthis._hasAcceptorTransformOld = true;\n\n\t\t\t\t\tthis.lock();\n\t\t\t\t\tif (isLocalDirty) {\n\t\t\t\t\t\tconst l = this._local;\n\t\t\t\t\t\tconst olx = l.x;\n\t\t\t\t\t\tconst oly = l.y;\n\t\t\t\t\t\tconst size = acceptorShape.size;\n\t\t\t\t\t\tconst pivot = acceptorShape.transform.pivot;\n\t\t\t\t\t\tconst x = pivot.x + size.x * (acceptor.x ?? edge.x);\n\t\t\t\t\t\tconst y = pivot.y + size.y * (acceptor.y ?? edge.y);\n\t\t\t\t\t\tconst nlx = nat.a * x + nat.c * y + nat.tx;\n\t\t\t\t\t\tconst nly = nat.b * x + nat.d * y + nat.ty;\n\t\t\t\t\t\tl.set(nlx, nly);\n\n\t\t\t\t\t\tif (isOtherDangling) {\n\t\t\t\t\t\t\tconst ol = other.local;\n\t\t\t\t\t\t\tconst oolx = ol.x;\n\t\t\t\t\t\t\tconst ooly = ol.y;\n\t\t\t\t\t\t\tconst nolx = work.a * oolx + work.c * ooly + work.tx;\n\t\t\t\t\t\t\tconst noly = work.b * oolx + work.d * ooly + work.ty;\n\t\t\t\t\t\t\tconst odx = oolx - olx;\n\t\t\t\t\t\t\tconst ody = ooly - oly;\n\t\t\t\t\t\t\tconst ndx = nolx - nlx;\n\t\t\t\t\t\t\tconst ndy = noly - nly;\n\t\t\t\t\t\t\tconst od = odx * odx + ody * ody;\n\t\t\t\t\t\t\tconst nd = ndx * ndx + ndy * ndy;\n\t\t\t\t\t\t\tif (0.000001 < nd) {\n\t\t\t\t\t\t\t\tconst f = Math.sqrt(od / nd);\n\t\t\t\t\t\t\t\tol.set(nlx + ndx * f, nly + ndy * f);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tol.set(nolx, noly);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (isNormalDirty) {\n\t\t\t\t\t\tconst en = edge.normal;\n\t\t\t\t\t\tconst enx = en.x;\n\t\t\t\t\t\tconst eny = en.y;\n\t\t\t\t\t\tconst nx = nat.a * enx + nat.c * eny;\n\t\t\t\t\t\tconst ny = nat.b * enx + nat.d * eny;\n\t\t\t\t\t\tconst sd = nx * nx + ny * ny;\n\t\t\t\t\t\tconst n = this._normal;\n\t\t\t\t\t\tif (0.000001 < sd) {\n\t\t\t\t\t\t\tconst f = 1 / Math.sqrt(sd);\n\t\t\t\t\t\t\tn.set(nx * f, ny * f);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tn.set(enx, eny);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (isOtherDangling) {\n\t\t\t\t\t\t\tconst on = other.normal;\n\t\t\t\t\t\t\tconst oonx = on.x;\n\t\t\t\t\t\t\tconst oony = on.y;\n\t\t\t\t\t\t\tconst nonx = work.a * oonx + work.c * oony;\n\t\t\t\t\t\t\tconst nony = work.b * oonx + work.d * oony;\n\t\t\t\t\t\t\tconst osd = nonx * nonx + nony * nony;\n\t\t\t\t\t\t\tif (0.000001 < osd) {\n\t\t\t\t\t\t\t\tconst f = 1 / Math.sqrt(osd);\n\t\t\t\t\t\t\t\ton.set(nonx * f, nony * f);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ton.set(oonx, oony);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tconst result = this._isLocalChanged || this._isNormalChanged;\n\t\t\t\t\tthis.unlock();\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tprotected toAcceptorTransform(shape: EShape, result: Matrix): Matrix {\n\t\tshape.updateTransform();\n\t\tconst parent = this._parent;\n\t\tconst parentParent = parent.parent;\n\t\tif (parentParent) {\n\t\t\tparent.updateTransform();\n\t\t\treturn result\n\t\t\t\t.copyFrom(parentParent.transform.worldTransform)\n\t\t\t\t.invert()\n\t\t\t\t.append(shape.transform.worldTransform);\n\t\t} else {\n\t\t\treturn result.copyFrom(shape.transform.worldTransform);\n\t\t}\n\t}\n\n\tonAcceptorChange(): void {\n\t\tif (0 < this._lockCount) {\n\t\t\tthis._isLocalChanged = false;\n\t\t\tthis._isNormalChanged = false;\n\t\t\tthis._isAcceptorChanged = true;\n\t\t\treturn;\n\t\t}\n\t\tthis._hasAcceptorTransformOld = false;\n\t\tthis.fit(true);\n\t}\n\n\tprotected onLocalChange(): void {\n\t\tif (0 < this._lockCount) {\n\t\t\tthis._isLocalChanged = true;\n\t\t\treturn;\n\t\t}\n\t\tthis._localIdRequired += 1;\n\t\tthis._localId = this._localIdRequired;\n\t\tthis._onChange();\n\t}\n\n\tprotected onNormalChange(): void {\n\t\tif (0 < this._lockCount) {\n\t\t\tthis._isNormalChanged = true;\n\t\t\treturn;\n\t\t}\n\t\tthis._normalIdRequired += 1;\n\t\tthis._normalId = this._normalIdRequired;\n\t\tthis._onChange();\n\t}\n\n\tprotected onOtherChange(): void {\n\t\tif (0 < this._lockCount) {\n\t\t\tthis._isOtherChanged = true;\n\t\t\treturn;\n\t\t}\n\t\tthis._onChange();\n\t}\n\n\tattach(): this {\n\t\tconst shape = this._acceptor.shape;\n\t\tif (shape) {\n\t\t\tshape.connector.add(this);\n\t\t}\n\t\treturn this;\n\t}\n\n\tdetach(): this {\n\t\tconst shape = this._acceptor.shape;\n\t\tif (shape) {\n\t\t\tshape.connector.remove(this);\n\t\t}\n\t\treturn this;\n\t}\n}\n"]}
|
|
@@ -16,6 +16,12 @@ var UtilGesture = /** @class */ (function () {
|
|
|
16
16
|
this._onStart = on.start;
|
|
17
17
|
this._onMove = on.move;
|
|
18
18
|
this._onEnd = on.end;
|
|
19
|
+
this._onStop = on.stop;
|
|
20
|
+
var easing = on.easing;
|
|
21
|
+
if (easing != null) {
|
|
22
|
+
this._onEasingStart = easing.start;
|
|
23
|
+
this._onEasingEnd = easing.end;
|
|
24
|
+
}
|
|
19
25
|
}
|
|
20
26
|
this._modifier = (_a = options === null || options === void 0 ? void 0 : options.modifier) !== null && _a !== void 0 ? _a : UtilGestureModifier.NONE;
|
|
21
27
|
var checker = options.checker;
|
|
@@ -214,12 +220,20 @@ var UtilGesture = /** @class */ (function () {
|
|
|
214
220
|
onEnd(target);
|
|
215
221
|
}
|
|
216
222
|
// Start the Easing
|
|
223
|
+
var onEasingStart = this._onEasingStart;
|
|
224
|
+
if (onEasingStart) {
|
|
225
|
+
onEasingStart(data.target);
|
|
226
|
+
}
|
|
217
227
|
var easing = data.easing;
|
|
218
228
|
if (easing) {
|
|
219
229
|
easing.onEnd(e.data.originalEvent.timeStamp - data.time);
|
|
220
230
|
}
|
|
221
231
|
else {
|
|
222
232
|
this.deleteData(data);
|
|
233
|
+
var onEasingEnd = this._onEasingEnd;
|
|
234
|
+
if (onEasingEnd) {
|
|
235
|
+
onEasingEnd(data.target);
|
|
236
|
+
}
|
|
223
237
|
}
|
|
224
238
|
};
|
|
225
239
|
UtilGesture.prototype.onEasingMove = function (dx, dy, ds, time, data) {
|
|
@@ -242,6 +256,10 @@ var UtilGesture = /** @class */ (function () {
|
|
|
242
256
|
};
|
|
243
257
|
UtilGesture.prototype.onEasingEnd = function (data) {
|
|
244
258
|
this.deleteData(data);
|
|
259
|
+
var onEasingEnd = this._onEasingEnd;
|
|
260
|
+
if (onEasingEnd) {
|
|
261
|
+
onEasingEnd(data.target);
|
|
262
|
+
}
|
|
245
263
|
};
|
|
246
264
|
UtilGesture.prototype.stop = function (target) {
|
|
247
265
|
var _a;
|
|
@@ -251,6 +269,10 @@ var UtilGesture = /** @class */ (function () {
|
|
|
251
269
|
}
|
|
252
270
|
(_a = data.easing) === null || _a === void 0 ? void 0 : _a.stop();
|
|
253
271
|
this.deleteData(data);
|
|
272
|
+
var onStop = this._onStop;
|
|
273
|
+
if (onStop) {
|
|
274
|
+
onStop(target);
|
|
275
|
+
}
|
|
254
276
|
};
|
|
255
277
|
return UtilGesture;
|
|
256
278
|
}());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util-gesture.js","sourceRoot":"","sources":["../../../../src/main/typescript/w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AI,EAAE;YACnB,OAAO;SACP;QACD,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE;YACrC,OAAO;SACP;QACD,IAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,IAAM,CAAC,GAAG,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC;QACxB,IAAM,CAAC,GAAG,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC;QACxB,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACjB,MAAM,CAAC,IAAI,CAAC,MAAO,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IACxC,CAAC;IAES,iCAAW,GAArB,UAAsB,IAA6B;QAClD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAED,0BAAI,GAAJ,UAAK,MAAc;;QAClB,IAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACpC,IAAI,IAAI,IAAI,IAAI,EAAE;YACjB,OAAO;SACP;QACD,MAAA,IAAI,CAAC,MAAM,0CAAE,IAAI,EAAE,CAAC;QACpB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IACF,kBAAC;AAAD,CAAC,AA/RD,IA+RC","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { interaction, utils } from \"pixi.js\";\nimport { DApplicationTarget } from \"../d-application-like\";\nimport { DApplications } from \"../d-applications\";\nimport { DBaseStateSet } from \"../d-base-state-set\";\nimport { UtilGestureModifier } from \"./util-gesture-modifier\";\nimport { UtilGestureModifiers } from \"./util-gesture-modifiers\";\nimport { UtilGestureData } from \"./util-gesture-data\";\nimport { UtilGestureEasing, UtilGestureEasingOptions } from \"./util-gesture-easing\";\nimport { UtilPointerEvent } from \"./util-pointer-event\";\nimport InteractionEvent = interaction.InteractionEvent;\n\nexport interface UtilGestureTarget extends DApplicationTarget {\n\tstate: DBaseStateSet;\n}\nexport type UtilGestureOnMove<TARGET> = (\n\ttarget: TARGET,\n\tdx: number,\n\tdy: number,\n\tx: number,\n\ty: number,\n\tds: number\n) => void;\nexport type UtilGestureOnStart<TARGET> = (target: TARGET) => void;\nexport type UtilGestureOnEnd<TARGET> = (target: TARGET) => void;\nexport type UtilGestureChecker<TARGET> = (\n\te: InteractionEvent,\n\tmodifier: UtilGestureModifier,\n\ttarget: TARGET\n) => boolean;\n\nexport interface UtilGestureCheckerOptions<TARGET> {\n\tstart?: UtilGestureChecker<TARGET>;\n\tmove?: UtilGestureChecker<TARGET>;\n}\n\nexport interface UtilGestureOnOptions<TARGET> {\n\tstart?: UtilGestureOnStart<TARGET>;\n\tmove?: UtilGestureOnMove<TARGET>;\n\tend?: UtilGestureOnEnd<TARGET>;\n}\n\nexport interface UtilGestureOptions<TARGET> {\n\t/**\n\t * True to restrict to touch gestures only.\n\t */\n\ttouch?: boolean;\n\n\t/**\n\t * Expected mouse modifiers\n\t */\n\tmodifier?: UtilGestureModifier;\n\n\t/**\n\t * Checker options\n\t */\n\tchecker?: UtilGestureCheckerOptions<TARGET>;\n\n\t/**\n\t * Easing options\n\t */\n\teasing?: boolean | UtilGestureEasingOptions;\n\n\t/** Binds the pointerdown event of the given target. */\n\tbind?: TARGET & utils.EventEmitter;\n\n\t/** Event options */\n\ton?: UtilGestureOnOptions<TARGET>;\n}\n\nexport class UtilGesture<TARGET extends UtilGestureTarget> {\n\tprotected _onStart?: UtilGestureOnStart<TARGET>;\n\tprotected _onMove?: UtilGestureOnMove<TARGET>;\n\tprotected _onEnd?: UtilGestureOnEnd<TARGET>;\n\tprotected _modifier: UtilGestureModifier;\n\tprotected _checkerStart: UtilGestureChecker<TARGET>;\n\tprotected _checkerMove: UtilGestureChecker<TARGET>;\n\tprotected _easing?: boolean | UtilGestureEasingOptions;\n\tprotected _touch: boolean;\n\n\tprotected _unused: Array<UtilGestureData<TARGET>>;\n\tprotected _used: Map<TARGET, UtilGestureData<TARGET>>;\n\n\tconstructor(options: UtilGestureOptions<TARGET>) {\n\t\tconst on = options.on;\n\t\tif (on) {\n\t\t\tthis._onStart = on.start;\n\t\t\tthis._onMove = on.move;\n\t\t\tthis._onEnd = on.end;\n\t\t}\n\t\tthis._modifier = options?.modifier ?? UtilGestureModifier.NONE;\n\t\tconst checker = options.checker;\n\t\tconst defaultChecker = UtilGestureModifiers.match;\n\t\tthis._checkerStart = checker?.start ?? defaultChecker;\n\t\tthis._checkerMove = checker?.move ?? defaultChecker;\n\t\tthis._easing = options.easing;\n\t\tthis._touch = !!options.touch;\n\n\t\tthis._unused = [];\n\t\tthis._used = new Map<TARGET, UtilGestureData<TARGET>>();\n\n\t\tconst bind = options.bind;\n\t\tif (bind != null) {\n\t\t\tthis.bind(bind);\n\t\t}\n\t}\n\n\tprotected newData(target: TARGET): UtilGestureData<TARGET> {\n\t\tconst used = this._used;\n\t\tconst result = used.get(target);\n\t\tif (result != null) {\n\t\t\treturn result;\n\t\t}\n\t\tconst poped = this._unused.pop();\n\t\tif (poped != null) {\n\t\t\tused.set(target, poped);\n\t\t\treturn poped;\n\t\t}\n\t\tconst created = new UtilGestureData<TARGET>();\n\t\tcreated.easing = this.newEasing(created);\n\t\tcreated.onMove = this.newOnMove(created);\n\t\tcreated.onEnd = this.newOnEnd(created);\n\t\tused.set(target, created);\n\t\treturn created;\n\t}\n\n\tprotected newEasing(data: UtilGestureData<TARGET>): UtilGestureEasing | undefined {\n\t\tconst easing = this._easing;\n\t\tif (easing == null || easing !== false) {\n\t\t\tconst onEasingMoveBound = (dx: number, dy: number, ds: number, time: number): void => {\n\t\t\t\tthis.onEasingMove(dx, dy, ds, time, data);\n\t\t\t};\n\t\t\tconst onEasingEndBound = (): void => {\n\t\t\t\tthis.onEasingEnd(data);\n\t\t\t};\n\t\t\treturn new UtilGestureEasing(\n\t\t\t\tonEasingMoveBound,\n\t\t\t\tonEasingEndBound,\n\t\t\t\tthis.toEasingOptions(easing)\n\t\t\t);\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprotected toEasingOptions(\n\t\toptions?: true | UtilGestureEasingOptions\n\t): UtilGestureEasingOptions | undefined {\n\t\treturn options == null || options === true ? undefined : options;\n\t}\n\n\tprotected deleteData(data: UtilGestureData<TARGET>): void {\n\t\tconst target = data.target;\n\t\tif (target) {\n\t\t\tif (this._used.delete(target)) {\n\t\t\t\tdata.target = undefined;\n\t\t\t\tdata.pointers.clear();\n\t\t\t\tthis._unused.push(data);\n\t\t\t}\n\t\t}\n\t}\n\n\tbind(target: TARGET & utils.EventEmitter): this {\n\t\ttarget.on(UtilPointerEvent.down, (e: InteractionEvent): void => {\n\t\t\tthis.onDown(target, e);\n\t\t});\n\t\treturn this;\n\t}\n\n\tprotected isTouch(e: InteractionEvent): boolean {\n\t\tconst oe = e.data.originalEvent;\n\t\tif (\"touches\" in oe) {\n\t\t\treturn true;\n\t\t} else if (\"pointerId\" in oe) {\n\t\t\treturn oe.pointerType !== \"mouse\";\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tonDown(target: TARGET, e: InteractionEvent): void {\n\t\tif (this._touch && !this.isTouch(e)) {\n\t\t\treturn;\n\t\t}\n\t\tif (!this._checkerStart(e, this._modifier, target)) {\n\t\t\treturn;\n\t\t}\n\t\tconst layer = DApplications.getLayer(target);\n\t\tif (layer == null) {\n\t\t\treturn;\n\t\t}\n\n\t\te.stopPropagation();\n\t\tif (target.state.isGesturing) {\n\t\t\tthis._used.get(target)?.start(e);\n\t\t} else {\n\t\t\t// User-defined handler\n\t\t\tconst onStart = this._onStart;\n\t\t\tif (onStart != null) {\n\t\t\t\tonStart(target);\n\t\t\t}\n\n\t\t\tconst data = this.newData(target);\n\t\t\tdata.target = target;\n\t\t\ttarget.state.isGesturing = true;\n\n\t\t\t// Interaction manager\n\t\t\tconst interactionManager = layer.renderer.plugins.interaction;\n\t\t\tdata.interactionManager = interactionManager;\n\n\t\t\t// Update the center\n\t\t\tdata.start(e);\n\n\t\t\t// Easing util\n\t\t\tconst easing = data.easing;\n\t\t\tif (easing) {\n\t\t\t\teasing.onStart();\n\t\t\t}\n\n\t\t\t// Event handler\n\t\t\tdata.bind(e);\n\t\t}\n\t}\n\n\tprotected newOnMove(data: UtilGestureData<TARGET>): (e: InteractionEvent) => void {\n\t\treturn (e: InteractionEvent): void => {\n\t\t\tthis.onMove(e, data);\n\t\t};\n\t}\n\n\tprotected newOnEnd(data: UtilGestureData<TARGET>): (e: InteractionEvent) => void {\n\t\treturn (e: InteractionEvent): void => {\n\t\t\tthis.onEnd(e, data);\n\t\t};\n\t}\n\n\tprotected onMove(e: InteractionEvent, data: UtilGestureData<TARGET>): void {\n\t\tconst target = data.target;\n\t\tif (target == null || !target.state.isGesturing) {\n\t\t\treturn;\n\t\t}\n\t\tif (!data.isUpdatable(e) || !this._checkerMove(e, this._modifier, target)) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Update the center\n\t\tconst center = data.center;\n\t\tconst oldCenterX = center.x;\n\t\tconst oldCenterY = center.y;\n\t\tconst oldScale = data.scale;\n\t\tconst oldTime = data.time;\n\t\tdata.update(e);\n\t\tconst newCenterX = center.x;\n\t\tconst newCenterY = center.y;\n\t\tconst newScale = data.scale;\n\t\tconst newTime = data.time;\n\n\t\t// Calculate the position\n\t\tconst dx = newCenterX - oldCenterX;\n\t\tconst dy = newCenterY - oldCenterY;\n\t\tconst dt = newTime - oldTime;\n\t\tconst epsilon = 0.00001;\n\t\tconst ds = epsilon < oldScale && epsilon < newScale ? newScale / oldScale : 1;\n\n\t\t// Easing\n\t\tconst easing = data.easing;\n\t\tif (easing) {\n\t\t\teasing.onMove(dx, dy, ds, dt);\n\t\t}\n\n\t\t// Call the user-defined handler\n\t\tconst onMove = this._onMove;\n\t\tif (onMove != null) {\n\t\t\tif (dx !== 0 || dy !== 0 || ds !== 1) {\n\t\t\t\tonMove(target, dx, dy, newCenterX, newCenterY, ds);\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected onEnd(e: InteractionEvent, data: UtilGestureData<TARGET>): void {\n\t\tconst target = data.target;\n\t\tif (target == null || !target.state.isGesturing) {\n\t\t\treturn;\n\t\t}\n\t\tif (!data.end(e)) {\n\t\t\treturn;\n\t\t}\n\n\t\t// State\n\t\ttarget.state.isGesturing = false;\n\n\t\t// Remove event handlers\n\t\tconst interactionManager = data.interactionManager;\n\t\tdata.interactionManager = undefined;\n\t\tif (interactionManager) {\n\t\t\tconst onMoveBound = data.onMove;\n\t\t\tif (onMoveBound) {\n\t\t\t\tinteractionManager.off(UtilPointerEvent.move, onMoveBound);\n\t\t\t}\n\t\t\tconst onEndBound = data.onEnd;\n\t\t\tif (onEndBound) {\n\t\t\t\tinteractionManager.off(UtilPointerEvent.up, onEndBound);\n\t\t\t\tinteractionManager.off(UtilPointerEvent.cancel, onEndBound);\n\t\t\t}\n\t\t}\n\n\t\t// Call the user-defined handler\n\t\tconst onEnd = this._onEnd;\n\t\tif (onEnd != null) {\n\t\t\tonEnd(target);\n\t\t}\n\n\t\t// Start the Easing\n\t\tconst easing = data.easing;\n\t\tif (easing) {\n\t\t\teasing.onEnd(e.data.originalEvent.timeStamp - data.time);\n\t\t} else {\n\t\t\tthis.deleteData(data);\n\t\t}\n\t}\n\n\tprotected onEasingMove(\n\t\tdx: number,\n\t\tdy: number,\n\t\tds: number,\n\t\ttime: number,\n\t\tdata: UtilGestureData<TARGET>\n\t): void {\n\t\tconst target = data.target;\n\t\tif (target == null) {\n\t\t\treturn;\n\t\t}\n\t\tconst onMove = this._onMove;\n\t\tif (onMove == null) {\n\t\t\treturn;\n\t\t}\n\t\tif (dx === 0 && dy === 0 && ds === 1) {\n\t\t\treturn;\n\t\t}\n\t\tconst center = data.center;\n\t\tconst x = center.x + dx;\n\t\tconst y = center.y + dy;\n\t\tcenter.set(x, y);\n\t\tonMove(data.target!, dx, dy, x, y, ds);\n\t}\n\n\tprotected onEasingEnd(data: UtilGestureData<TARGET>): void {\n\t\tthis.deleteData(data);\n\t}\n\n\tstop(target: TARGET): void {\n\t\tconst data = this._used.get(target);\n\t\tif (data == null) {\n\t\t\treturn;\n\t\t}\n\t\tdata.easing?.stop();\n\t\tthis.deleteData(data);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"util-gesture.js","sourceRoot":"","sources":["../../../../src/main/typescript/wcardinal/ui/util/util-gesture.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAA4B,MAAM,uBAAuB,CAAC;AACpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAuExD;IAgBC,qBAAY,OAAmC;;QAC9C,IAAM,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC;QACtB,IAAI,EAAE,EAAE;YACP,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC,KAAK,CAAC;YACzB,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC;YACvB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,GAAG,CAAC;YACrB,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC;YACvB,IAAM,MAAM,GAAG,EAAE,CAAC,MAAM,CAAC;YACzB,IAAI,MAAM,IAAI,IAAI,EAAE;gBACnB,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,KAAK,CAAC;gBACnC,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC;aAC/B;SACD;QACD,IAAI,CAAC,SAAS,GAAG,MAAA,OAAO,aAAP,OA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CAAC,EAAE,EAAE,CAAC,CAAC;IACxC,CAAC;IAES,iCAAW,GAArB,UAAsB,IAA6B;QAClD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACtB,IAAM,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC;QACtC,IAAI,WAAW,EAAE;YAChB,WAAW,CAAC,IAAI,CAAC,MAAO,CAAC,CAAC;SAC1B;IACF,CAAC;IAED,0BAAI,GAAJ,UAAK,MAAc;;QAClB,IAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACpC,IAAI,IAAI,IAAI,IAAI,EAAE;YACjB,OAAO;SACP;QACD,MAAA,IAAI,CAAC,MAAM,0CAAE,IAAI,EAAE,CAAC;QACpB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACtB,IAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAI,MAAM,EAAE;YACX,MAAM,CAAC,MAAM,CAAC,CAAC;SACf;IACF,CAAC;IACF,kBAAC;AAAD,CAAC,AAxTD,IAwTC","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { interaction, utils } from \"pixi.js\";\nimport { DApplicationTarget } from \"../d-application-like\";\nimport { DApplications } from \"../d-applications\";\nimport { DBaseStateSet } from \"../d-base-state-set\";\nimport { UtilGestureModifier } from \"./util-gesture-modifier\";\nimport { UtilGestureModifiers } from \"./util-gesture-modifiers\";\nimport { UtilGestureData } from \"./util-gesture-data\";\nimport { UtilGestureEasing, UtilGestureEasingOptions } from \"./util-gesture-easing\";\nimport { UtilPointerEvent } from \"./util-pointer-event\";\nimport InteractionEvent = interaction.InteractionEvent;\n\nexport interface UtilGestureTarget extends DApplicationTarget {\n\tstate: DBaseStateSet;\n}\nexport type UtilGestureOnMove<TARGET> = (\n\ttarget: TARGET,\n\tdx: number,\n\tdy: number,\n\tx: number,\n\ty: number,\n\tds: number\n) => void;\nexport type UtilGestureOnStart<TARGET> = (target: TARGET) => void;\nexport type UtilGestureOnEnd<TARGET> = (target: TARGET) => void;\nexport type UtilGestureOnStop<TARGET> = (target: TARGET) => void;\nexport type UtilGestureOnEasingStart<TARGET> = (target: TARGET) => void;\nexport type UtilGestureOnEasingEnd<TARGET> = (target: TARGET) => void;\nexport type UtilGestureChecker<TARGET> = (\n\te: InteractionEvent,\n\tmodifier: UtilGestureModifier,\n\ttarget: TARGET\n) => boolean;\n\nexport interface UtilGestureCheckerOptions<TARGET> {\n\tstart?: UtilGestureChecker<TARGET>;\n\tmove?: UtilGestureChecker<TARGET>;\n}\n\nexport interface UtilGestureOnEasingOptions<TARGET> {\n\tstart?: UtilGestureOnEasingStart<TARGET>;\n\tend?: UtilGestureOnEasingEnd<TARGET>;\n}\n\nexport interface UtilGestureOnOptions<TARGET> {\n\tstart?: UtilGestureOnStart<TARGET>;\n\tmove?: UtilGestureOnMove<TARGET>;\n\tend?: UtilGestureOnEnd<TARGET>;\n\tstop?: UtilGestureOnStop<TARGET>;\n\teasing?: UtilGestureOnEasingOptions<TARGET>;\n}\n\nexport interface UtilGestureOptions<TARGET> {\n\t/**\n\t * True to restrict to touch gestures only.\n\t */\n\ttouch?: boolean;\n\n\t/**\n\t * Expected mouse modifiers\n\t */\n\tmodifier?: UtilGestureModifier;\n\n\t/**\n\t * Checker options\n\t */\n\tchecker?: UtilGestureCheckerOptions<TARGET>;\n\n\t/**\n\t * Easing options\n\t */\n\teasing?: boolean | UtilGestureEasingOptions;\n\n\t/** Binds the pointerdown event of the given target. */\n\tbind?: TARGET & utils.EventEmitter;\n\n\t/** Event options */\n\ton?: UtilGestureOnOptions<TARGET>;\n}\n\nexport class UtilGesture<TARGET extends UtilGestureTarget> {\n\tprotected _onStart?: UtilGestureOnStart<TARGET>;\n\tprotected _onMove?: UtilGestureOnMove<TARGET>;\n\tprotected _onEnd?: UtilGestureOnEnd<TARGET>;\n\tprotected _onStop?: UtilGestureOnStop<TARGET>;\n\tprotected _onEasingStart?: UtilGestureOnEasingStart<TARGET>;\n\tprotected _onEasingEnd?: UtilGestureOnEasingEnd<TARGET>;\n\tprotected _modifier: UtilGestureModifier;\n\tprotected _checkerStart: UtilGestureChecker<TARGET>;\n\tprotected _checkerMove: UtilGestureChecker<TARGET>;\n\tprotected _easing?: boolean | UtilGestureEasingOptions;\n\tprotected _touch: boolean;\n\n\tprotected _unused: Array<UtilGestureData<TARGET>>;\n\tprotected _used: Map<TARGET, UtilGestureData<TARGET>>;\n\n\tconstructor(options: UtilGestureOptions<TARGET>) {\n\t\tconst on = options.on;\n\t\tif (on) {\n\t\t\tthis._onStart = on.start;\n\t\t\tthis._onMove = on.move;\n\t\t\tthis._onEnd = on.end;\n\t\t\tthis._onStop = on.stop;\n\t\t\tconst easing = on.easing;\n\t\t\tif (easing != null) {\n\t\t\t\tthis._onEasingStart = easing.start;\n\t\t\t\tthis._onEasingEnd = easing.end;\n\t\t\t}\n\t\t}\n\t\tthis._modifier = options?.modifier ?? UtilGestureModifier.NONE;\n\t\tconst checker = options.checker;\n\t\tconst defaultChecker = UtilGestureModifiers.match;\n\t\tthis._checkerStart = checker?.start ?? defaultChecker;\n\t\tthis._checkerMove = checker?.move ?? defaultChecker;\n\t\tthis._easing = options.easing;\n\t\tthis._touch = !!options.touch;\n\n\t\tthis._unused = [];\n\t\tthis._used = new Map<TARGET, UtilGestureData<TARGET>>();\n\n\t\tconst bind = options.bind;\n\t\tif (bind != null) {\n\t\t\tthis.bind(bind);\n\t\t}\n\t}\n\n\tprotected newData(target: TARGET): UtilGestureData<TARGET> {\n\t\tconst used = this._used;\n\t\tconst result = used.get(target);\n\t\tif (result != null) {\n\t\t\treturn result;\n\t\t}\n\t\tconst poped = this._unused.pop();\n\t\tif (poped != null) {\n\t\t\tused.set(target, poped);\n\t\t\treturn poped;\n\t\t}\n\t\tconst created = new UtilGestureData<TARGET>();\n\t\tcreated.easing = this.newEasing(created);\n\t\tcreated.onMove = this.newOnMove(created);\n\t\tcreated.onEnd = this.newOnEnd(created);\n\t\tused.set(target, created);\n\t\treturn created;\n\t}\n\n\tprotected newEasing(data: UtilGestureData<TARGET>): UtilGestureEasing | undefined {\n\t\tconst easing = this._easing;\n\t\tif (easing == null || easing !== false) {\n\t\t\tconst onEasingMoveBound = (dx: number, dy: number, ds: number, time: number): void => {\n\t\t\t\tthis.onEasingMove(dx, dy, ds, time, data);\n\t\t\t};\n\t\t\tconst onEasingEndBound = (): void => {\n\t\t\t\tthis.onEasingEnd(data);\n\t\t\t};\n\t\t\treturn new UtilGestureEasing(\n\t\t\t\tonEasingMoveBound,\n\t\t\t\tonEasingEndBound,\n\t\t\t\tthis.toEasingOptions(easing)\n\t\t\t);\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprotected toEasingOptions(\n\t\toptions?: true | UtilGestureEasingOptions\n\t): UtilGestureEasingOptions | undefined {\n\t\treturn options == null || options === true ? undefined : options;\n\t}\n\n\tprotected deleteData(data: UtilGestureData<TARGET>): void {\n\t\tconst target = data.target;\n\t\tif (target) {\n\t\t\tif (this._used.delete(target)) {\n\t\t\t\tdata.target = undefined;\n\t\t\t\tdata.pointers.clear();\n\t\t\t\tthis._unused.push(data);\n\t\t\t}\n\t\t}\n\t}\n\n\tbind(target: TARGET & utils.EventEmitter): this {\n\t\ttarget.on(UtilPointerEvent.down, (e: InteractionEvent): void => {\n\t\t\tthis.onDown(target, e);\n\t\t});\n\t\treturn this;\n\t}\n\n\tprotected isTouch(e: InteractionEvent): boolean {\n\t\tconst oe = e.data.originalEvent;\n\t\tif (\"touches\" in oe) {\n\t\t\treturn true;\n\t\t} else if (\"pointerId\" in oe) {\n\t\t\treturn oe.pointerType !== \"mouse\";\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tonDown(target: TARGET, e: InteractionEvent): void {\n\t\tif (this._touch && !this.isTouch(e)) {\n\t\t\treturn;\n\t\t}\n\t\tif (!this._checkerStart(e, this._modifier, target)) {\n\t\t\treturn;\n\t\t}\n\t\tconst layer = DApplications.getLayer(target);\n\t\tif (layer == null) {\n\t\t\treturn;\n\t\t}\n\n\t\te.stopPropagation();\n\t\tif (target.state.isGesturing) {\n\t\t\tthis._used.get(target)?.start(e);\n\t\t} else {\n\t\t\t// User-defined handler\n\t\t\tconst onStart = this._onStart;\n\t\t\tif (onStart != null) {\n\t\t\t\tonStart(target);\n\t\t\t}\n\n\t\t\tconst data = this.newData(target);\n\t\t\tdata.target = target;\n\t\t\ttarget.state.isGesturing = true;\n\n\t\t\t// Interaction manager\n\t\t\tconst interactionManager = layer.renderer.plugins.interaction;\n\t\t\tdata.interactionManager = interactionManager;\n\n\t\t\t// Update the center\n\t\t\tdata.start(e);\n\n\t\t\t// Easing util\n\t\t\tconst easing = data.easing;\n\t\t\tif (easing) {\n\t\t\t\teasing.onStart();\n\t\t\t}\n\n\t\t\t// Event handler\n\t\t\tdata.bind(e);\n\t\t}\n\t}\n\n\tprotected newOnMove(data: UtilGestureData<TARGET>): (e: InteractionEvent) => void {\n\t\treturn (e: InteractionEvent): void => {\n\t\t\tthis.onMove(e, data);\n\t\t};\n\t}\n\n\tprotected newOnEnd(data: UtilGestureData<TARGET>): (e: InteractionEvent) => void {\n\t\treturn (e: InteractionEvent): void => {\n\t\t\tthis.onEnd(e, data);\n\t\t};\n\t}\n\n\tprotected onMove(e: InteractionEvent, data: UtilGestureData<TARGET>): void {\n\t\tconst target = data.target;\n\t\tif (target == null || !target.state.isGesturing) {\n\t\t\treturn;\n\t\t}\n\t\tif (!data.isUpdatable(e) || !this._checkerMove(e, this._modifier, target)) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Update the center\n\t\tconst center = data.center;\n\t\tconst oldCenterX = center.x;\n\t\tconst oldCenterY = center.y;\n\t\tconst oldScale = data.scale;\n\t\tconst oldTime = data.time;\n\t\tdata.update(e);\n\t\tconst newCenterX = center.x;\n\t\tconst newCenterY = center.y;\n\t\tconst newScale = data.scale;\n\t\tconst newTime = data.time;\n\n\t\t// Calculate the position\n\t\tconst dx = newCenterX - oldCenterX;\n\t\tconst dy = newCenterY - oldCenterY;\n\t\tconst dt = newTime - oldTime;\n\t\tconst epsilon = 0.00001;\n\t\tconst ds = epsilon < oldScale && epsilon < newScale ? newScale / oldScale : 1;\n\n\t\t// Easing\n\t\tconst easing = data.easing;\n\t\tif (easing) {\n\t\t\teasing.onMove(dx, dy, ds, dt);\n\t\t}\n\n\t\t// Call the user-defined handler\n\t\tconst onMove = this._onMove;\n\t\tif (onMove != null) {\n\t\t\tif (dx !== 0 || dy !== 0 || ds !== 1) {\n\t\t\t\tonMove(target, dx, dy, newCenterX, newCenterY, ds);\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected onEnd(e: InteractionEvent, data: UtilGestureData<TARGET>): void {\n\t\tconst target = data.target;\n\t\tif (target == null || !target.state.isGesturing) {\n\t\t\treturn;\n\t\t}\n\t\tif (!data.end(e)) {\n\t\t\treturn;\n\t\t}\n\n\t\t// State\n\t\ttarget.state.isGesturing = false;\n\n\t\t// Remove event handlers\n\t\tconst interactionManager = data.interactionManager;\n\t\tdata.interactionManager = undefined;\n\t\tif (interactionManager) {\n\t\t\tconst onMoveBound = data.onMove;\n\t\t\tif (onMoveBound) {\n\t\t\t\tinteractionManager.off(UtilPointerEvent.move, onMoveBound);\n\t\t\t}\n\t\t\tconst onEndBound = data.onEnd;\n\t\t\tif (onEndBound) {\n\t\t\t\tinteractionManager.off(UtilPointerEvent.up, onEndBound);\n\t\t\t\tinteractionManager.off(UtilPointerEvent.cancel, onEndBound);\n\t\t\t}\n\t\t}\n\n\t\t// Call the user-defined handler\n\t\tconst onEnd = this._onEnd;\n\t\tif (onEnd != null) {\n\t\t\tonEnd(target);\n\t\t}\n\n\t\t// Start the Easing\n\t\tconst onEasingStart = this._onEasingStart;\n\t\tif (onEasingStart) {\n\t\t\tonEasingStart(data.target!);\n\t\t}\n\t\tconst easing = data.easing;\n\t\tif (easing) {\n\t\t\teasing.onEnd(e.data.originalEvent.timeStamp - data.time);\n\t\t} else {\n\t\t\tthis.deleteData(data);\n\t\t\tconst onEasingEnd = this._onEasingEnd;\n\t\t\tif (onEasingEnd) {\n\t\t\t\tonEasingEnd(data.target!);\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected onEasingMove(\n\t\tdx: number,\n\t\tdy: number,\n\t\tds: number,\n\t\ttime: number,\n\t\tdata: UtilGestureData<TARGET>\n\t): void {\n\t\tconst target = data.target;\n\t\tif (target == null) {\n\t\t\treturn;\n\t\t}\n\t\tconst onMove = this._onMove;\n\t\tif (onMove == null) {\n\t\t\treturn;\n\t\t}\n\t\tif (dx === 0 && dy === 0 && ds === 1) {\n\t\t\treturn;\n\t\t}\n\t\tconst center = data.center;\n\t\tconst x = center.x + dx;\n\t\tconst y = center.y + dy;\n\t\tcenter.set(x, y);\n\t\tonMove(data.target!, dx, dy, x, y, ds);\n\t}\n\n\tprotected onEasingEnd(data: UtilGestureData<TARGET>): void {\n\t\tthis.deleteData(data);\n\t\tconst onEasingEnd = this._onEasingEnd;\n\t\tif (onEasingEnd) {\n\t\t\tonEasingEnd(data.target!);\n\t\t}\n\t}\n\n\tstop(target: TARGET): void {\n\t\tconst data = this._used.get(target);\n\t\tif (data == null) {\n\t\t\treturn;\n\t\t}\n\t\tdata.easing?.stop();\n\t\tthis.deleteData(data);\n\t\tconst onStop = this._onStop;\n\t\tif (onStop) {\n\t\t\tonStop(target);\n\t\t}\n\t}\n}\n"]}
|