@wcardinal/wcardinal-ui 0.331.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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.331.0
2
+ Winter Cardinal UI v0.332.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -17960,6 +17960,9 @@
17960
17960
  this._parent = parent;
17961
17961
  this._onChange = onChange;
17962
17962
  this._acceptor = new EShapeConnectorEdgeAcceptorImpl(this);
17963
+ this._acceptorTransformNew = new pixi_js.Matrix();
17964
+ this._acceptorTransformOld = new pixi_js.Matrix();
17965
+ this._hasAcceptorTransformOld = false;
17963
17966
  this._local = new pixi_js.ObservablePoint(function () {
17964
17967
  _this.onLocalChange();
17965
17968
  }, undefined);
@@ -17972,6 +17975,7 @@
17972
17975
  this._normalId = 0;
17973
17976
  this._side = EShapeAcceptorEdgeSide.TOP;
17974
17977
  this._margin = 0;
17978
+ this._other = null;
17975
17979
  this._lockCount = 0;
17976
17980
  this._isAcceptorChanged = false;
17977
17981
  this._isLocalChanged = false;
@@ -18005,6 +18009,7 @@
18005
18009
  isChanged = true;
18006
18010
  }
18007
18011
  if (this._isAcceptorChanged) {
18012
+ this._hasAcceptorTransformOld = false;
18008
18013
  if (!this._isLocalChanged) {
18009
18014
  this._localIdRequired += 1;
18010
18015
  }
@@ -18088,6 +18093,16 @@
18088
18093
  enumerable: false,
18089
18094
  configurable: true
18090
18095
  });
18096
+ Object.defineProperty(EShapeConnectorEdgeImpl.prototype, "other", {
18097
+ get: function () {
18098
+ return this._other;
18099
+ },
18100
+ set: function (other) {
18101
+ this._other = other;
18102
+ },
18103
+ enumerable: false,
18104
+ configurable: true
18105
+ });
18091
18106
  EShapeConnectorEdgeImpl.prototype.set = function (acceptorShape, acceptorEdge, acceptorX, acceptorY, margin, x, y, nx, ny, side) {
18092
18107
  this.lock();
18093
18108
  this._acceptor.set(acceptorShape, acceptorEdge, acceptorX, acceptorY);
@@ -18189,7 +18204,7 @@
18189
18204
  return this;
18190
18205
  };
18191
18206
  EShapeConnectorEdgeImpl.prototype.doFit = function () {
18192
- var _a, _b;
18207
+ var _a, _b, _c;
18193
18208
  var localIdRequired = this._localIdRequired;
18194
18209
  var isLocalDirty = this._localId !== localIdRequired;
18195
18210
  var normalIdRequired = this._normalIdRequired;
@@ -18203,35 +18218,82 @@
18203
18218
  if (acceptorShape != null && acceptorEdge != null) {
18204
18219
  var edge = EShapeAcceptors.get(acceptorShape.type).get(acceptorShape, acceptorEdge);
18205
18220
  if (edge) {
18206
- var transform = this.toAcceptorTransform(acceptorShape);
18207
- var a = transform.a;
18208
- var b = transform.b;
18209
- var c = transform.c;
18210
- var d = transform.d;
18211
- var tx = transform.tx;
18212
- var ty = transform.ty;
18221
+ var oat = this._acceptorTransformOld;
18222
+ var nat = this._acceptorTransformNew;
18223
+ this.toAcceptorTransform(acceptorShape, nat);
18224
+ var other = this._other;
18225
+ var isOtherDangling = this._hasAcceptorTransformOld &&
18226
+ other != null &&
18227
+ other.acceptor.shape == null;
18228
+ var work = ((_a = EShapeConnectorEdgeImpl.WORK_MATRIX) !== null && _a !== void 0 ? _a : (EShapeConnectorEdgeImpl.WORK_MATRIX = new pixi_js.Matrix()));
18229
+ if (isOtherDangling) {
18230
+ oat.copyTo(work).invert().prepend(nat);
18231
+ }
18232
+ this._acceptorTransformNew = oat;
18233
+ this._acceptorTransformOld = nat;
18234
+ this._hasAcceptorTransformOld = true;
18213
18235
  this.lock();
18214
18236
  if (isLocalDirty) {
18237
+ var l = this._local;
18238
+ var olx = l.x;
18239
+ var oly = l.y;
18215
18240
  var size = acceptorShape.size;
18216
18241
  var pivot = acceptorShape.transform.pivot;
18217
- var lx = pivot.x + size.x * ((_a = acceptor.x) !== null && _a !== void 0 ? _a : edge.x);
18218
- var ly = pivot.y + size.y * ((_b = acceptor.y) !== null && _b !== void 0 ? _b : edge.y);
18219
- this._local.set(a * lx + c * ly + tx, b * lx + d * ly + ty);
18242
+ var x = pivot.x + size.x * ((_b = acceptor.x) !== null && _b !== void 0 ? _b : edge.x);
18243
+ var y = pivot.y + size.y * ((_c = acceptor.y) !== null && _c !== void 0 ? _c : edge.y);
18244
+ var nlx = nat.a * x + nat.c * y + nat.tx;
18245
+ var nly = nat.b * x + nat.d * y + nat.ty;
18246
+ l.set(nlx, nly);
18247
+ if (isOtherDangling) {
18248
+ var ol = other.local;
18249
+ var oolx = ol.x;
18250
+ var ooly = ol.y;
18251
+ var nolx = work.a * oolx + work.c * ooly + work.tx;
18252
+ var noly = work.b * oolx + work.d * ooly + work.ty;
18253
+ var odx = oolx - olx;
18254
+ var ody = ooly - oly;
18255
+ var ndx = nolx - nlx;
18256
+ var ndy = noly - nly;
18257
+ var od = odx * odx + ody * ody;
18258
+ var nd = ndx * ndx + ndy * ndy;
18259
+ if (0.000001 < nd) {
18260
+ var f = Math.sqrt(od / nd);
18261
+ ol.set(nlx + ndx * f, nly + ndy * f);
18262
+ }
18263
+ else {
18264
+ ol.set(nolx, noly);
18265
+ }
18266
+ }
18220
18267
  }
18221
18268
  if (isNormalDirty) {
18222
- var edgeNormal = edge.normal;
18223
- var nx = edgeNormal.x;
18224
- var ny = edgeNormal.y;
18225
- var x = a * nx + c * ny;
18226
- var y = b * nx + d * ny;
18227
- var l = x * x + y * y;
18228
- var normal = this._normal;
18229
- if (0.000001 < l) {
18230
- var f = 1 / Math.sqrt(l);
18231
- normal.set(x * f, y * f);
18269
+ var en = edge.normal;
18270
+ var enx = en.x;
18271
+ var eny = en.y;
18272
+ var nx = nat.a * enx + nat.c * eny;
18273
+ var ny = nat.b * enx + nat.d * eny;
18274
+ var sd = nx * nx + ny * ny;
18275
+ var n = this._normal;
18276
+ if (0.000001 < sd) {
18277
+ var f = 1 / Math.sqrt(sd);
18278
+ n.set(nx * f, ny * f);
18232
18279
  }
18233
18280
  else {
18234
- normal.set(nx, ny);
18281
+ n.set(enx, eny);
18282
+ }
18283
+ if (isOtherDangling) {
18284
+ var on = other.normal;
18285
+ var oonx = on.x;
18286
+ var oony = on.y;
18287
+ var nonx = work.a * oonx + work.c * oony;
18288
+ var nony = work.b * oonx + work.d * oony;
18289
+ var osd = nonx * nonx + nony * nony;
18290
+ if (0.000001 < osd) {
18291
+ var f = 1 / Math.sqrt(osd);
18292
+ on.set(nonx * f, nony * f);
18293
+ }
18294
+ else {
18295
+ on.set(oonx, oony);
18296
+ }
18235
18297
  }
18236
18298
  }
18237
18299
  var result = this._isLocalChanged || this._isNormalChanged;
@@ -18242,20 +18304,19 @@
18242
18304
  }
18243
18305
  return false;
18244
18306
  };
18245
- EShapeConnectorEdgeImpl.prototype.toAcceptorTransform = function (shape) {
18246
- var _a;
18307
+ EShapeConnectorEdgeImpl.prototype.toAcceptorTransform = function (shape, result) {
18247
18308
  shape.updateTransform();
18248
18309
  var parent = this._parent;
18249
18310
  var parentParent = parent.parent;
18250
18311
  if (parentParent) {
18251
18312
  parent.updateTransform();
18252
- return ((_a = EShapeConnectorEdgeImpl.WORK_MATRIX) !== null && _a !== void 0 ? _a : (EShapeConnectorEdgeImpl.WORK_MATRIX = new pixi_js.Matrix()))
18313
+ return result
18253
18314
  .copyFrom(parentParent.transform.worldTransform)
18254
18315
  .invert()
18255
18316
  .append(shape.transform.worldTransform);
18256
18317
  }
18257
18318
  else {
18258
- return shape.transform.worldTransform;
18319
+ return result.copyFrom(shape.transform.worldTransform);
18259
18320
  }
18260
18321
  };
18261
18322
  EShapeConnectorEdgeImpl.prototype.onAcceptorChange = function () {
@@ -18265,6 +18326,7 @@
18265
18326
  this._isAcceptorChanged = true;
18266
18327
  return;
18267
18328
  }
18329
+ this._hasAcceptorTransformOld = false;
18268
18330
  this.fit(true);
18269
18331
  };
18270
18332
  EShapeConnectorEdgeImpl.prototype.onLocalChange = function () {
@@ -18323,8 +18385,12 @@
18323
18385
  var onChangeBound = function () {
18324
18386
  _this.onChange();
18325
18387
  };
18326
- this._tail = new EShapeConnectorEdgeImpl(parent, onChangeBound);
18327
- this._head = new EShapeConnectorEdgeImpl(parent, onChangeBound);
18388
+ var tail = new EShapeConnectorEdgeImpl(parent, onChangeBound);
18389
+ var head = new EShapeConnectorEdgeImpl(parent, onChangeBound);
18390
+ tail.other = head;
18391
+ head.other = tail;
18392
+ this._tail = tail;
18393
+ this._head = head;
18328
18394
  }
18329
18395
  EShapeConnectorEdgeContainerImpl.prototype.lock = function () {
18330
18396
  this._lockCount += 1;