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