@wcardinal/wcardinal-ui 0.376.3 → 0.378.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.376.3
2
+ Winter Cardinal UI v0.378.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -16204,10 +16204,23 @@
16204
16204
  var parent = this._parent;
16205
16205
  var target = this._toTarget(parent);
16206
16206
  if (target) {
16207
- var targetRect = target.getLocalBounds(this._workRect);
16208
- var newTargetX = (parent.width - targetRect.width) * 0.5 - targetRect.x;
16209
- var newTargetY = (parent.height - targetRect.height) * 0.5 - targetRect.y;
16210
- this._transform.start(target, newTargetX, newTargetY, 1, 1, duration, stop);
16207
+ var padding = parent.padding;
16208
+ var pl = padding.getLeft();
16209
+ var pt = padding.getTop();
16210
+ var pr = padding.getRight();
16211
+ var pb = padding.getBottom();
16212
+ var w = parent.width;
16213
+ var h = parent.height;
16214
+ var sw = w - pl - pr;
16215
+ var sh = h - pt - pb;
16216
+ var trect = target.getLocalBounds(this._workRect);
16217
+ var tx = trect.x;
16218
+ var ty = trect.y;
16219
+ var tw = trect.width;
16220
+ var th = trect.height;
16221
+ var ntx = pl + (sw - tw) * 0.5 - tx;
16222
+ var nty = pt + (sh - th) * 0.5 - ty;
16223
+ this._transform.start(target, ntx, nty, 1, 1, duration, stop);
16211
16224
  }
16212
16225
  };
16213
16226
  DViewImpl.prototype.fit = function (duration, stop) {
@@ -16215,29 +16228,33 @@
16215
16228
  var target = this._toTarget(parent);
16216
16229
  if (target) {
16217
16230
  var padding = parent.padding;
16218
- var width = parent.width;
16219
- var height = parent.height;
16220
- var targetRect = target.getLocalBounds(this._workRect);
16221
- var targetX = targetRect.x;
16222
- var targetY = targetRect.y;
16223
- var targetWidth = targetRect.width;
16224
- var targetHeight = targetRect.height;
16225
- var newTargetScaleX = (width - padding.getLeft() - padding.getRight()) / targetWidth;
16226
- var newTargetScaleY = (height - padding.getTop() - padding.getBottom()) / targetHeight;
16231
+ var pl = padding.getLeft();
16232
+ var pt = padding.getTop();
16233
+ var pr = padding.getRight();
16234
+ var pb = padding.getBottom();
16235
+ var w = parent.width;
16236
+ var h = parent.height;
16237
+ var sw = w - pl - pr;
16238
+ var sh = h - pt - pb;
16239
+ var trect = target.getLocalBounds(this._workRect);
16240
+ var tx = trect.x;
16241
+ var ty = trect.y;
16242
+ var tw = trect.width;
16243
+ var th = trect.height;
16244
+ var ntsx = sw / tw;
16245
+ var ntsy = sh / th;
16227
16246
  if (this._zoomKeepRatio) {
16228
- var newTargetScale = this.toNormalizedScale(Math.min(newTargetScaleX, newTargetScaleY));
16229
- newTargetScaleX = newTargetScale;
16230
- newTargetScaleY = newTargetScale;
16247
+ var nts = this.toNormalizedScale(Math.min(ntsx, ntsy));
16248
+ ntsx = nts;
16249
+ ntsy = nts;
16231
16250
  }
16232
16251
  else {
16233
- newTargetScaleX = this.toNormalizedScale(newTargetScaleX);
16234
- newTargetScaleY = this.toNormalizedScale(newTargetScaleY);
16252
+ ntsx = this.toNormalizedScale(ntsx);
16253
+ ntsy = this.toNormalizedScale(ntsy);
16235
16254
  }
16236
- var newTargetWidth = targetWidth * newTargetScaleX;
16237
- var newTargetHeight = targetHeight * newTargetScaleY;
16238
- var newTargetX = (width - newTargetWidth) * 0.5 - targetX * newTargetScaleX;
16239
- var newTargetY = (height - newTargetHeight) * 0.5 - targetY * newTargetScaleY;
16240
- this._transform.start(target, newTargetX, newTargetY, newTargetScaleX, newTargetScaleY, duration, stop);
16255
+ var ntx = pl + (sw - tw * ntsx) * 0.5 - tx * ntsx;
16256
+ var nty = pt + (sh - th * ntsy) * 0.5 - ty * ntsy;
16257
+ this._transform.start(target, ntx, nty, ntsx, ntsy, duration, stop);
16241
16258
  }
16242
16259
  };
16243
16260
  DViewImpl.prototype.zoomIn = function (duration, stop) {
@@ -45637,329 +45654,6 @@
45637
45654
  return EShapeDataValueExtensions;
45638
45655
  }());
45639
45656
 
45640
- /*
45641
- * Copyright (C) 2019 Toshiba Corporation
45642
- * SPDX-License-Identifier: Apache-2.0
45643
- */
45644
- /**
45645
- * {@link EShape} search utility.
45646
- */
45647
- var EShapeSearch = /** @class */ (function () {
45648
- function EShapeSearch() {
45649
- }
45650
- /**
45651
- * Returns indices of the given shapes.
45652
- *
45653
- * @param shapes shapes
45654
- * @return indices
45655
- */
45656
- EShapeSearch.toIndices = function (shapes) {
45657
- var result = [];
45658
- for (var i = 0, imax = shapes.length; i < imax; ++i) {
45659
- result.push(shapes[i].index);
45660
- }
45661
- return result;
45662
- };
45663
- /**
45664
- * Returns a depth of the given shape.
45665
- *
45666
- * @param shape a shape
45667
- * @return a depth
45668
- */
45669
- EShapeSearch.toDepth = function (shape) {
45670
- var result = 0;
45671
- var parent = shape.parent;
45672
- while (parent instanceof EShapeBase) {
45673
- result += 1;
45674
- parent = parent.parent;
45675
- }
45676
- return result;
45677
- };
45678
- /**
45679
- * Returns a deepest shape on the path to the given shapes.
45680
- *
45681
- * @param shapeA a shape
45682
- * @param shapeB a shape
45683
- * @return a found shape
45684
- */
45685
- EShapeSearch.toSharedParent = function (shapeA, shapeB) {
45686
- var depthA = this.toDepth(shapeA);
45687
- var depthB = this.toDepth(shapeB);
45688
- if (depthA < depthB) {
45689
- var parent_1 = shapeA.parent;
45690
- while (parent_1 instanceof EShapeBase) {
45691
- if (this.isParent(shapeB, parent_1)) {
45692
- return parent_1;
45693
- }
45694
- parent_1 = parent_1.parent;
45695
- }
45696
- return parent_1;
45697
- }
45698
- else {
45699
- var parent_2 = shapeB.parent;
45700
- while (parent_2 instanceof EShapeBase) {
45701
- if (this.isParent(shapeA, parent_2)) {
45702
- return parent_2;
45703
- }
45704
- parent_2 = parent_2.parent;
45705
- }
45706
- return parent_2;
45707
- }
45708
- };
45709
- /**
45710
- * Returns a shape on the path to the given shape whose parent is equals to the given parent.
45711
- * If there is no such shape, returns a root shape on the path.
45712
- *
45713
- * @param shape a shape
45714
- * @param parent a parent
45715
- * @returns a found shape
45716
- */
45717
- EShapeSearch.toOfParent = function (shape, parent) {
45718
- var shapeParent = shape.parent;
45719
- while (shapeParent !== parent && shapeParent instanceof EShapeBase) {
45720
- shape = shapeParent;
45721
- shapeParent = shapeParent.parent;
45722
- }
45723
- return shape;
45724
- };
45725
- /**
45726
- * Returns true if the given target is on the path to the given shape.
45727
- *
45728
- * @param shape a shape
45729
- * @param target a check target
45730
- * @return true if the given target is on the path to the given shape
45731
- */
45732
- EShapeSearch.isParent = function (shape, target) {
45733
- var parent = shape.parent;
45734
- while (parent instanceof EShapeBase) {
45735
- if (parent === target) {
45736
- return true;
45737
- }
45738
- parent = parent.parent;
45739
- }
45740
- return false;
45741
- };
45742
- /**
45743
- * Returns a selected shape on the path to the given shape.
45744
- * If there are more than one selected shapes, returns a deepest selected shape.
45745
- *
45746
- * @param shape a shape
45747
- * @return a found selected shape or null
45748
- */
45749
- EShapeSearch.toSelected = function (shape) {
45750
- var target = shape;
45751
- while (target instanceof EShapeBase) {
45752
- if (target.selected) {
45753
- return target;
45754
- }
45755
- target = target.parent;
45756
- }
45757
- return null;
45758
- };
45759
- EShapeSearch.findChildById = function (shape, id, recursively) {
45760
- var children = shape.children;
45761
- for (var i = 0, imax = children.length; i < imax; ++i) {
45762
- var child = children[i];
45763
- if (child.id === id) {
45764
- return child;
45765
- }
45766
- if (recursively === true) {
45767
- var result = EShapeSearch.findChildById(child, id, recursively);
45768
- if (result != null) {
45769
- return result;
45770
- }
45771
- }
45772
- }
45773
- return null;
45774
- };
45775
- EShapeSearch.findChildByType = function (shape, type, recursively) {
45776
- var children = shape.children;
45777
- for (var i = 0, imax = children.length; i < imax; ++i) {
45778
- var child = children[i];
45779
- if (child.type === type) {
45780
- return child;
45781
- }
45782
- if (recursively === true) {
45783
- var result = EShapeSearch.findChildByType(child, type, recursively);
45784
- if (result != null) {
45785
- return result;
45786
- }
45787
- }
45788
- }
45789
- return null;
45790
- };
45791
- EShapeSearch.findChild = function (shape, matcher, recursively) {
45792
- var children = shape.children;
45793
- for (var i = 0, imax = children.length; i < imax; ++i) {
45794
- var child = children[i];
45795
- if (matcher(child)) {
45796
- return child;
45797
- }
45798
- if (recursively === true) {
45799
- var result = EShapeSearch.findChild(child, matcher, recursively);
45800
- if (result != null) {
45801
- return result;
45802
- }
45803
- }
45804
- }
45805
- return null;
45806
- };
45807
- EShapeSearch.findChildrenByType = function (shape, type, recursively, result) {
45808
- result = result || [];
45809
- var children = shape.children;
45810
- for (var i = 0, imax = children.length; i < imax; ++i) {
45811
- var child = children[i];
45812
- if (child.type === type) {
45813
- result.push(child);
45814
- }
45815
- if (recursively === true) {
45816
- EShapeSearch.findChildrenByType(child, type, recursively, result);
45817
- }
45818
- }
45819
- return result;
45820
- };
45821
- EShapeSearch.findChildren = function (shape, matcher, recursively, result) {
45822
- result = result || [];
45823
- var children = shape.children;
45824
- for (var i = 0, imax = children.length; i < imax; ++i) {
45825
- var child = children[i];
45826
- if (matcher(child)) {
45827
- result.push(child);
45828
- }
45829
- if (recursively === true) {
45830
- EShapeSearch.findChildren(child, matcher, recursively, result);
45831
- }
45832
- }
45833
- return result;
45834
- };
45835
- EShapeSearch.COMPARATOR_INDEX = function (a, b) {
45836
- return a.index - b.index;
45837
- };
45838
- return EShapeSearch;
45839
- }());
45840
-
45841
- /*
45842
- * Copyright (C) 2019 Toshiba Corporation
45843
- * SPDX-License-Identifier: Apache-2.0
45844
- */
45845
- var EShapeDeleter = /** @class */ (function () {
45846
- function EShapeDeleter() {
45847
- }
45848
- EShapeDeleter.addAll = function (shapes, result) {
45849
- for (var i = 0, imax = shapes.length; i < imax; ++i) {
45850
- var shape = shapes[i];
45851
- result.add(shape);
45852
- this.addAll(shape.children, result);
45853
- }
45854
- return result;
45855
- };
45856
- EShapeDeleter.delete = function (parent, shapes, generateListOfDetachedShapes) {
45857
- var _a;
45858
- var children = parent.children;
45859
- var length = children.length;
45860
- // Update indices
45861
- var exceptions = ((_a = EShapeDeleter.EXCEPTIONS) !== null && _a !== void 0 ? _a : (EShapeDeleter.EXCEPTIONS = new Set()));
45862
- for (var i = 0; i < length; ++i) {
45863
- var child = children[i];
45864
- if (child.selected) {
45865
- child.index = length + i;
45866
- exceptions.add(child);
45867
- this.addAll(child.children, exceptions);
45868
- }
45869
- else {
45870
- child.index = i;
45871
- }
45872
- }
45873
- // Sort
45874
- children.sort(EShapeSearch.COMPARATOR_INDEX);
45875
- // Detach
45876
- if (generateListOfDetachedShapes === true) {
45877
- for (var i = length - 1; 0 <= i; --i) {
45878
- var child = children[i];
45879
- if (child.selected) {
45880
- child.index -= length;
45881
- child.parent = null;
45882
- child.selected = false;
45883
- child.uploaded = undefined;
45884
- child.onDetach(exceptions);
45885
- }
45886
- else {
45887
- exceptions.clear();
45888
- var size = children.length - (i + 1);
45889
- if (0 < size) {
45890
- var result = children.splice(i + 1, size);
45891
- if (shapes != null) {
45892
- shapes.length = 0;
45893
- }
45894
- parent.onChildTransformChange();
45895
- parent.toDirty();
45896
- return result;
45897
- }
45898
- else {
45899
- if (shapes != null) {
45900
- shapes.length = 0;
45901
- }
45902
- return null;
45903
- }
45904
- }
45905
- }
45906
- exceptions.clear();
45907
- if (0 < children.length) {
45908
- var result = children.splice(0, children.length);
45909
- if (shapes != null) {
45910
- shapes.length = 0;
45911
- }
45912
- parent.onChildTransformChange();
45913
- parent.toDirty();
45914
- return result;
45915
- }
45916
- else {
45917
- if (shapes != null) {
45918
- shapes.length = 0;
45919
- }
45920
- return null;
45921
- }
45922
- }
45923
- else {
45924
- for (var i = length - 1; 0 <= i; --i) {
45925
- var child = children[i];
45926
- if (child.selected) {
45927
- child.parent = null;
45928
- child.selected = false;
45929
- child.uploaded = undefined;
45930
- child.onDetach(exceptions);
45931
- }
45932
- else {
45933
- exceptions.clear();
45934
- children.length = i + 1;
45935
- if (shapes != null) {
45936
- shapes.length = 0;
45937
- }
45938
- parent.onChildTransformChange();
45939
- parent.toDirty();
45940
- return null;
45941
- }
45942
- }
45943
- exceptions.clear();
45944
- if (0 < children.length) {
45945
- children.length = 0;
45946
- if (shapes != null) {
45947
- shapes.length = 0;
45948
- }
45949
- parent.onChildTransformChange();
45950
- parent.toDirty();
45951
- }
45952
- else {
45953
- if (shapes != null) {
45954
- shapes.length = 0;
45955
- }
45956
- }
45957
- return null;
45958
- }
45959
- };
45960
- return EShapeDeleter;
45961
- }());
45962
-
45963
45657
  /*
45964
45658
  * Copyright (C) 2019 Toshiba Corporation
45965
45659
  * SPDX-License-Identifier: Apache-2.0
@@ -76418,7 +76112,6 @@
76418
76112
  EShapeDataValueState: EShapeDataValueState,
76419
76113
  EShapeDataValueType: EShapeDataValueType,
76420
76114
  EShapeDefaults: EShapeDefaults,
76421
- EShapeDeleter: EShapeDeleter,
76422
76115
  EShapeDeserializers: EShapeDeserializers,
76423
76116
  EShapeOnDeserializeds: EShapeOnDeserializeds,
76424
76117
  EShapeEditor: EShapeEditor,
@@ -76444,7 +76137,6 @@
76444
76137
  EShapeRuntimeImpl: EShapeRuntimeImpl,
76445
76138
  EShapeRuntimeReset: EShapeRuntimeReset,
76446
76139
  EShapeRuntimes: EShapeRuntimes,
76447
- EShapeSearch: EShapeSearch,
76448
76140
  EShapeStateSetImplObservable: EShapeStateSetImplObservable,
76449
76141
  EShapeState: EShapeState,
76450
76142
  EShapeStrokeSide: EShapeStrokeSide,