@wcardinal/wcardinal-ui 0.157.0 → 0.158.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.
Files changed (70) hide show
  1. package/dist/types/wcardinal/ui/d-application-layer-like.d.ts +0 -1
  2. package/dist/types/wcardinal/ui/d-application-layer.d.ts +0 -2
  3. package/dist/types/wcardinal/ui/d-base.d.ts +11 -12
  4. package/dist/types/wcardinal/ui/d-diagram-snapshot.d.ts +0 -2
  5. package/dist/types/wcardinal/ui/d-image-base.d.ts +2 -0
  6. package/dist/types/wcardinal/ui/d-image-piece-layouter-part-bottom.d.ts +4 -0
  7. package/dist/types/wcardinal/ui/d-image-piece-layouter-part-center.d.ts +6 -0
  8. package/dist/types/wcardinal/ui/d-image-piece-layouter-part-container.d.ts +25 -0
  9. package/dist/types/wcardinal/ui/d-image-piece-layouter-part-left.d.ts +4 -0
  10. package/dist/types/wcardinal/ui/d-image-piece-layouter-part-middle.d.ts +6 -0
  11. package/dist/types/wcardinal/ui/d-image-piece-layouter-part-right.d.ts +4 -0
  12. package/dist/types/wcardinal/ui/d-image-piece-layouter-part-top.d.ts +4 -0
  13. package/dist/types/wcardinal/ui/d-image-piece-layouter-part.d.ts +8 -0
  14. package/dist/types/wcardinal/ui/d-image-piece-layouter.d.ts +17 -0
  15. package/dist/types/wcardinal/ui/d-menu-sided.d.ts +1 -1
  16. package/dist/types/wcardinal/ui/d-text-base.d.ts +5 -5
  17. package/dist/types/wcardinal/ui/theme/dark/d-theme-dark-input.d.ts +1 -1
  18. package/dist/types/wcardinal/ui/theme/white/d-theme-white-input.d.ts +1 -1
  19. package/dist/wcardinal/ui/d-application-layer-like.js.map +1 -1
  20. package/dist/wcardinal/ui/d-application-layer.js +3 -21
  21. package/dist/wcardinal/ui/d-application-layer.js.map +1 -1
  22. package/dist/wcardinal/ui/d-base.js +126 -100
  23. package/dist/wcardinal/ui/d-base.js.map +1 -1
  24. package/dist/wcardinal/ui/d-diagram-snapshot.js +2 -18
  25. package/dist/wcardinal/ui/d-diagram-snapshot.js.map +1 -1
  26. package/dist/wcardinal/ui/d-html-element.js +0 -3
  27. package/dist/wcardinal/ui/d-html-element.js.map +1 -1
  28. package/dist/wcardinal/ui/d-image-base.js +9 -264
  29. package/dist/wcardinal/ui/d-image-base.js.map +1 -1
  30. package/dist/wcardinal/ui/d-image-piece-layouter-part-bottom.js +31 -0
  31. package/dist/wcardinal/ui/d-image-piece-layouter-part-bottom.js.map +1 -0
  32. package/dist/wcardinal/ui/d-image-piece-layouter-part-center.js +24 -0
  33. package/dist/wcardinal/ui/d-image-piece-layouter-part-center.js.map +1 -0
  34. package/dist/wcardinal/ui/d-image-piece-layouter-part-container.js +158 -0
  35. package/dist/wcardinal/ui/d-image-piece-layouter-part-container.js.map +1 -0
  36. package/dist/wcardinal/ui/d-image-piece-layouter-part-left.js +30 -0
  37. package/dist/wcardinal/ui/d-image-piece-layouter-part-left.js.map +1 -0
  38. package/dist/wcardinal/ui/d-image-piece-layouter-part-middle.js +24 -0
  39. package/dist/wcardinal/ui/d-image-piece-layouter-part-middle.js.map +1 -0
  40. package/dist/wcardinal/ui/d-image-piece-layouter-part-right.js +31 -0
  41. package/dist/wcardinal/ui/d-image-piece-layouter-part-right.js.map +1 -0
  42. package/dist/wcardinal/ui/d-image-piece-layouter-part-top.js +32 -0
  43. package/dist/wcardinal/ui/d-image-piece-layouter-part-top.js.map +1 -0
  44. package/dist/wcardinal/ui/d-image-piece-layouter-part.js +18 -0
  45. package/dist/wcardinal/ui/d-image-piece-layouter-part.js.map +1 -0
  46. package/dist/wcardinal/ui/d-image-piece-layouter.js +65 -0
  47. package/dist/wcardinal/ui/d-image-piece-layouter.js.map +1 -0
  48. package/dist/wcardinal/ui/d-menu-item-text.js +18 -2
  49. package/dist/wcardinal/ui/d-menu-item-text.js.map +1 -1
  50. package/dist/wcardinal/ui/d-menu-sided.js +2 -2
  51. package/dist/wcardinal/ui/d-menu-sided.js.map +1 -1
  52. package/dist/wcardinal/ui/d-text-base.js +34 -24
  53. package/dist/wcardinal/ui/d-text-base.js.map +1 -1
  54. package/dist/wcardinal/ui/theme/dark/d-theme-dark-input.js +2 -2
  55. package/dist/wcardinal/ui/theme/dark/d-theme-dark-input.js.map +1 -1
  56. package/dist/wcardinal/ui/theme/white/d-theme-white-input.js +2 -2
  57. package/dist/wcardinal/ui/theme/white/d-theme-white-input.js.map +1 -1
  58. package/dist/wcardinal/ui/util/dynamic-font-atlas-font.js +3 -1
  59. package/dist/wcardinal/ui/util/dynamic-font-atlas-font.js.map +1 -1
  60. package/dist/wcardinal-ui-theme-dark.js +3 -3
  61. package/dist/wcardinal-ui-theme-dark.min.js +2 -2
  62. package/dist/wcardinal-ui-theme-dark.min.js.map +1 -1
  63. package/dist/wcardinal-ui-theme-white.js +3 -3
  64. package/dist/wcardinal-ui-theme-white.min.js +2 -2
  65. package/dist/wcardinal-ui-theme-white.min.js.map +1 -1
  66. package/dist/wcardinal-ui.cjs.js +613 -467
  67. package/dist/wcardinal-ui.js +609 -463
  68. package/dist/wcardinal-ui.min.js +2 -2
  69. package/dist/wcardinal-ui.min.js.map +1 -1
  70. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.157.0
2
+ Winter Cardinal UI v0.158.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -12162,7 +12162,7 @@ var DBase = /** @class */ (function (_super) {
12162
12162
  _this._auto = new DBaseAutoSet();
12163
12163
  _this._isDirty = true;
12164
12164
  _this._hasDirty = false;
12165
- _this._isChildrenDirty = false;
12165
+ _this._isHierarchyDirty = false;
12166
12166
  _this._shadow = null;
12167
12167
  _this.name = (_a = options === null || options === void 0 ? void 0 : options.name) !== null && _a !== void 0 ? _a : "";
12168
12168
  var theme = toTheme(options) || _this.getThemeDefault();
@@ -12172,7 +12172,7 @@ var DBase = /** @class */ (function (_super) {
12172
12172
  _this._clearType = toEnum((_b = options === null || options === void 0 ? void 0 : options.clear) !== null && _b !== void 0 ? _b : theme.getClearType(), DLayoutClearType);
12173
12173
  _this._padding = new DBasePadding(theme, options, function () {
12174
12174
  _this.toParentResized();
12175
- _this.toChildrenDirty();
12175
+ _this.toHierarchyDirty();
12176
12176
  DApplications.update(_this);
12177
12177
  });
12178
12178
  var toDirtyAndUpdate = function () {
@@ -12301,8 +12301,8 @@ var DBase = /** @class */ (function (_super) {
12301
12301
  if (_this.isDirty() || _this.hasDirty()) {
12302
12302
  _this.toParentHasDirty();
12303
12303
  }
12304
- if (_this._isChildrenDirty) {
12305
- _this.toParentChildrenDirty();
12304
+ if (_this._isHierarchyDirty) {
12305
+ _this.toParentHierarchyDirty();
12306
12306
  }
12307
12307
  var newParent = _this.parent;
12308
12308
  if (newParent instanceof DBase) {
@@ -12394,7 +12394,7 @@ var DBase = /** @class */ (function (_super) {
12394
12394
  new DBaseReflowableImpl(this);
12395
12395
  };
12396
12396
  DBase.prototype.onChildrenChange = function () {
12397
- this.toChildrenDirty();
12397
+ this.toHierarchyDirty();
12398
12398
  _super.prototype.onChildrenChange.call(this);
12399
12399
  };
12400
12400
  DBase.prototype.onShortcut = function (e) {
@@ -12424,46 +12424,48 @@ var DBase = /** @class */ (function (_super) {
12424
12424
  DBase.prototype.resize = function (width, height) {
12425
12425
  var oldWidth = this._width;
12426
12426
  var oldHeight = this._height;
12427
- var widthResized = oldWidth !== width;
12428
- var heightResized = oldHeight !== height;
12429
- if (widthResized) {
12430
- this._width = width;
12427
+ var newWidth = width != null ? width : oldWidth;
12428
+ var newHeight = height != null ? height : oldHeight;
12429
+ var isWidthChanged = oldWidth !== newWidth;
12430
+ var isHeightChanged = oldHeight !== newHeight;
12431
+ if (isWidthChanged) {
12432
+ this._width = newWidth;
12431
12433
  }
12432
- if (heightResized) {
12433
- this._height = height;
12434
+ if (isHeightChanged) {
12435
+ this._height = newHeight;
12434
12436
  }
12435
- var resized = widthResized || heightResized;
12436
- if (resized) {
12437
- this.onResize(width, height, oldWidth, oldHeight);
12437
+ var isChanged = isWidthChanged || isHeightChanged;
12438
+ if (isChanged) {
12439
+ this.onResize(newWidth, newHeight, oldWidth, oldHeight);
12438
12440
  }
12439
- if (widthResized) {
12441
+ if (isWidthChanged) {
12440
12442
  var scalarSet = this._scalarSet;
12441
12443
  if (scalarSet.x != null) {
12442
- var position = this.transform.position;
12444
+ var position = this._position;
12443
12445
  var parent_1 = this.getParentOfSize();
12444
12446
  if (parent_1) {
12445
- this.x = scalarSet.x(parent_1.width, width, parent_1.padding.getLeft(), position.x);
12447
+ this._position.x = scalarSet.x(parent_1.width, newWidth, parent_1.padding.getLeft(), position.x);
12446
12448
  }
12447
12449
  }
12448
12450
  }
12449
- if (heightResized) {
12451
+ if (isHeightChanged) {
12450
12452
  var scalarSet = this._scalarSet;
12451
12453
  if (scalarSet.y != null) {
12452
- var position = this.transform.position;
12454
+ var position = this._position;
12453
12455
  var parent_2 = this.getParentOfSize();
12454
12456
  if (parent_2) {
12455
- this.y = scalarSet.y(parent_2.height, height, parent_2.padding.getTop(), position.y);
12457
+ this._position.y = scalarSet.y(parent_2.height, newHeight, parent_2.padding.getTop(), position.y);
12456
12458
  }
12457
12459
  }
12458
12460
  }
12459
- return resized;
12461
+ return isChanged;
12460
12462
  };
12461
12463
  DBase.prototype.getClearType = function () {
12462
12464
  return this._clearType;
12463
12465
  };
12464
12466
  DBase.prototype.onResize = function (newWidth, newHeight, oldWidth, oldHeight) {
12465
12467
  this.toDirty();
12466
- this.toChildrenDirty();
12468
+ this.toHierarchyDirty();
12467
12469
  var padding = this._padding;
12468
12470
  var children = this.children;
12469
12471
  for (var i = 0, imax = children.length; i < imax; ++i) {
@@ -12496,7 +12498,7 @@ var DBase = /** @class */ (function (_super) {
12496
12498
  return this._position.x;
12497
12499
  },
12498
12500
  set: function (x) {
12499
- this._position.x = x;
12501
+ this.setX(x);
12500
12502
  },
12501
12503
  enumerable: false,
12502
12504
  configurable: true
@@ -12507,15 +12509,25 @@ var DBase = /** @class */ (function (_super) {
12507
12509
  return scalarSet.x;
12508
12510
  }
12509
12511
  else {
12510
- return this.x;
12512
+ return this._position.x;
12511
12513
  }
12512
12514
  };
12513
12515
  DBase.prototype.setX = function (x) {
12516
+ var scalarSet = this._scalarSet;
12514
12517
  if (isNumber(x)) {
12515
- this.x = x;
12518
+ var position = this._position;
12519
+ if (position.x !== x) {
12520
+ scalarSet.x = undefined;
12521
+ position.x = x;
12522
+ }
12523
+ else {
12524
+ if (scalarSet.x !== undefined) {
12525
+ scalarSet.x = undefined;
12526
+ this.toParentResized();
12527
+ }
12528
+ }
12516
12529
  }
12517
12530
  else {
12518
- var scalarSet = this._scalarSet;
12519
12531
  var scalar = DScalarFunctions.position(x);
12520
12532
  if (scalarSet.x !== scalar) {
12521
12533
  scalarSet.x = scalar;
@@ -12529,7 +12541,7 @@ var DBase = /** @class */ (function (_super) {
12529
12541
  return this._position.y;
12530
12542
  },
12531
12543
  set: function (y) {
12532
- this._position.y = y;
12544
+ this.setY(y);
12533
12545
  },
12534
12546
  enumerable: false,
12535
12547
  configurable: true
@@ -12540,15 +12552,25 @@ var DBase = /** @class */ (function (_super) {
12540
12552
  return scalarSet.y;
12541
12553
  }
12542
12554
  else {
12543
- return this.y;
12555
+ return this._position.y;
12544
12556
  }
12545
12557
  };
12546
12558
  DBase.prototype.setY = function (y) {
12559
+ var scalarSet = this._scalarSet;
12547
12560
  if (isNumber(y)) {
12548
- this.y = y;
12561
+ var position = this._position;
12562
+ if (position.y !== y) {
12563
+ scalarSet.y = undefined;
12564
+ position.y = y;
12565
+ }
12566
+ else {
12567
+ if (scalarSet.y !== undefined) {
12568
+ scalarSet.y = undefined;
12569
+ this.toParentResized();
12570
+ }
12571
+ }
12549
12572
  }
12550
12573
  else {
12551
- var scalarSet = this._scalarSet;
12552
12574
  var scalar = DScalarFunctions.position(y);
12553
12575
  if (scalarSet.y !== scalar) {
12554
12576
  scalarSet.y = scalar;
@@ -12562,21 +12584,7 @@ var DBase = /** @class */ (function (_super) {
12562
12584
  return this._width;
12563
12585
  },
12564
12586
  set: function (width) {
12565
- var oldWidth = this._width;
12566
- if (oldWidth !== width) {
12567
- this._width = width;
12568
- var height = this._height;
12569
- this.onResize(width, height, oldWidth, height);
12570
- // Layout
12571
- var scalarSet = this._scalarSet;
12572
- if (scalarSet.x != null) {
12573
- var position = this.transform.position;
12574
- var parent_3 = this.getParentOfSize();
12575
- if (parent_3) {
12576
- this.x = scalarSet.x(parent_3.width, width, parent_3.padding.getLeft(), position.x);
12577
- }
12578
- }
12579
- }
12587
+ this.setWidth(width);
12580
12588
  },
12581
12589
  enumerable: false,
12582
12590
  configurable: true
@@ -12589,15 +12597,34 @@ var DBase = /** @class */ (function (_super) {
12589
12597
  var isOn = auto.isOn;
12590
12598
  var isAuto = auto.from(width);
12591
12599
  if (auto.isOn !== isOn) {
12592
- this.toChildrenDirty();
12600
+ this.toHierarchyDirty();
12593
12601
  DApplications.update(this);
12594
12602
  }
12595
12603
  if (!isAuto) {
12604
+ var scalarSet = this._scalarSet;
12596
12605
  if (isNumber(width)) {
12597
- this.width = width;
12606
+ var oldWidth = this._width;
12607
+ if (oldWidth !== width) {
12608
+ scalarSet.width = undefined;
12609
+ this._width = width;
12610
+ var height = this._height;
12611
+ this.onResize(width, height, oldWidth, height);
12612
+ if (scalarSet.x != null) {
12613
+ var position = this._position;
12614
+ var parent_3 = this.getParentOfSize();
12615
+ if (parent_3) {
12616
+ position.x = scalarSet.x(parent_3.width, width, parent_3.padding.getLeft(), position.x);
12617
+ }
12618
+ }
12619
+ }
12620
+ else {
12621
+ if (scalarSet.width !== undefined) {
12622
+ scalarSet.width = undefined;
12623
+ this.toParentResized();
12624
+ }
12625
+ }
12598
12626
  }
12599
12627
  else {
12600
- var scalarSet = this._scalarSet;
12601
12628
  var scalar = DScalarFunctions.size(width);
12602
12629
  if (scalarSet.width !== scalar) {
12603
12630
  scalarSet.width = scalar;
@@ -12612,21 +12639,7 @@ var DBase = /** @class */ (function (_super) {
12612
12639
  return this._height;
12613
12640
  },
12614
12641
  set: function (height) {
12615
- var oldHeight = this._height;
12616
- if (oldHeight !== height) {
12617
- this._height = height;
12618
- var width = this._width;
12619
- this.onResize(width, height, width, oldHeight);
12620
- // Layout
12621
- var scalarSet = this._scalarSet;
12622
- if (scalarSet.y != null) {
12623
- var position = this.transform.position;
12624
- var parent_4 = this.getParentOfSize();
12625
- if (parent_4) {
12626
- this.y = scalarSet.y(parent_4.height, height, parent_4.padding.getTop(), position.y);
12627
- }
12628
- }
12629
- }
12642
+ this.setHeight(height);
12630
12643
  },
12631
12644
  enumerable: false,
12632
12645
  configurable: true
@@ -12639,15 +12652,34 @@ var DBase = /** @class */ (function (_super) {
12639
12652
  var isOn = auto.isOn;
12640
12653
  var isAuto = auto.from(height);
12641
12654
  if (auto.isOn !== isOn) {
12642
- this.toChildrenDirty();
12655
+ this.toHierarchyDirty();
12643
12656
  DApplications.update(this);
12644
12657
  }
12645
12658
  if (!isAuto) {
12659
+ var scalarSet = this._scalarSet;
12646
12660
  if (isNumber(height)) {
12647
- this.height = height;
12661
+ var oldHeight = this._height;
12662
+ if (oldHeight !== height) {
12663
+ scalarSet.height = undefined;
12664
+ this._height = height;
12665
+ var width = this._width;
12666
+ this.onResize(width, height, width, oldHeight);
12667
+ if (scalarSet.y != null) {
12668
+ var position = this._position;
12669
+ var parent_4 = this.getParentOfSize();
12670
+ if (parent_4) {
12671
+ position.y = scalarSet.y(parent_4.height, height, parent_4.padding.getTop(), position.y);
12672
+ }
12673
+ }
12674
+ }
12675
+ else {
12676
+ if (scalarSet.height !== undefined) {
12677
+ scalarSet.height = undefined;
12678
+ this.toParentResized();
12679
+ }
12680
+ }
12648
12681
  }
12649
12682
  else {
12650
- var scalarSet = this._scalarSet;
12651
12683
  var scalar = DScalarFunctions.size(height);
12652
12684
  if (scalarSet.height !== scalar) {
12653
12685
  scalarSet.height = scalar;
@@ -12746,7 +12778,7 @@ var DBase = /** @class */ (function (_super) {
12746
12778
  DBase.prototype.show = function () {
12747
12779
  if (!this.visible) {
12748
12780
  this.visible = true;
12749
- this.toParentChildrenDirty();
12781
+ this.toParentHierarchyDirty();
12750
12782
  DApplications.update(this);
12751
12783
  }
12752
12784
  return this;
@@ -12757,7 +12789,7 @@ var DBase = /** @class */ (function (_super) {
12757
12789
  DBase.prototype.hide = function () {
12758
12790
  if (this.visible) {
12759
12791
  this.visible = false;
12760
- this.toParentChildrenDirty();
12792
+ this.toParentHierarchyDirty();
12761
12793
  this.blur(true);
12762
12794
  DApplications.update(this);
12763
12795
  }
@@ -12788,25 +12820,25 @@ var DBase = /** @class */ (function (_super) {
12788
12820
  parent.toHasDirty();
12789
12821
  }
12790
12822
  };
12791
- DBase.prototype.toChildrenDirty = function () {
12792
- if (!this._isChildrenDirty) {
12793
- this._isChildrenDirty = true;
12794
- this.onChildrenDirty();
12795
- this.toParentChildrenDirty();
12823
+ DBase.prototype.toHierarchyDirty = function () {
12824
+ if (!this._isHierarchyDirty) {
12825
+ this._isHierarchyDirty = true;
12826
+ this.onHierarchyDirty();
12827
+ this.toParentHierarchyDirty();
12796
12828
  return true;
12797
12829
  }
12798
12830
  return false;
12799
12831
  };
12800
- DBase.prototype.toParentChildrenDirty = function () {
12832
+ DBase.prototype.toParentHierarchyDirty = function () {
12801
12833
  var parent = this.parent;
12802
12834
  if (parent instanceof DBase) {
12803
- parent.toChildrenDirty();
12835
+ parent.toHierarchyDirty();
12804
12836
  }
12805
12837
  };
12806
- DBase.prototype.isChildrenDirty = function () {
12807
- return this._isChildrenDirty;
12838
+ DBase.prototype.isHierarchyDirty = function () {
12839
+ return this._isHierarchyDirty;
12808
12840
  };
12809
- DBase.prototype.onChildrenDirty = function () {
12841
+ DBase.prototype.onHierarchyDirty = function () {
12810
12842
  // DO NOTHING
12811
12843
  };
12812
12844
  DBase.prototype.isDirty = function () {
@@ -12922,16 +12954,26 @@ var DBase = /** @class */ (function (_super) {
12922
12954
  enumerable: false,
12923
12955
  configurable: true
12924
12956
  });
12925
- DBase.prototype.refit = function () {
12926
- if (this._isChildrenDirty) {
12927
- this._isChildrenDirty = false;
12957
+ DBase.prototype.reflow = function () {
12958
+ var isDirty = this._isDirty;
12959
+ if (isDirty) {
12960
+ this.onReflow();
12961
+ this._isDirty = false;
12962
+ }
12963
+ var hasDirty = this._hasDirty;
12964
+ var isHierarchyDirty = this._isHierarchyDirty;
12965
+ if (hasDirty || isHierarchyDirty) {
12966
+ this._hasDirty = false;
12967
+ this._isHierarchyDirty = false;
12928
12968
  var children = this.children;
12929
12969
  for (var i = 0, imax = children.length; i < imax; ++i) {
12930
12970
  var child = children[i];
12931
12971
  if (child instanceof DBase) {
12932
- child.refit();
12972
+ child.reflow();
12933
12973
  }
12934
12974
  }
12975
+ }
12976
+ if (isDirty || hasDirty || isHierarchyDirty) {
12935
12977
  this.onRefit();
12936
12978
  }
12937
12979
  };
@@ -12966,7 +13008,7 @@ var DBase = /** @class */ (function (_super) {
12966
13008
  width = Math.max(width, child.x + child.width);
12967
13009
  }
12968
13010
  }
12969
- this.width = width + this.padding.getRight();
13011
+ this.resize(width + this.padding.getRight(), undefined);
12970
13012
  }
12971
13013
  else if (isHeightAuto) {
12972
13014
  var height = 0;
@@ -12977,7 +13019,7 @@ var DBase = /** @class */ (function (_super) {
12977
13019
  height = Math.max(height, child.y + child.height);
12978
13020
  }
12979
13021
  }
12980
- this.height = height + this.padding.getBottom();
13022
+ this.resize(undefined, height + this.padding.getBottom());
12981
13023
  }
12982
13024
  };
12983
13025
  DBase.prototype.isRefitable = function (target) {
@@ -12989,22 +13031,6 @@ var DBase = /** @class */ (function (_super) {
12989
13031
  DBase.prototype.hasRefitableWidth = function (target) {
12990
13032
  return (this.isRefitable(target) && !(target instanceof DBase && isFunction(target.getWidth())));
12991
13033
  };
12992
- DBase.prototype.reflow = function () {
12993
- if (this._isDirty) {
12994
- this.onReflow();
12995
- this._isDirty = false;
12996
- }
12997
- if (this._hasDirty) {
12998
- var children = this.children;
12999
- for (var i = 0, imax = children.length; i < imax; ++i) {
13000
- var child = children[i];
13001
- if (child instanceof DBase) {
13002
- child.reflow();
13003
- }
13004
- }
13005
- this._hasDirty = false;
13006
- }
13007
- };
13008
13034
  DBase.prototype.onReflow = function () {
13009
13035
  this._reflowable.onReflow(this, this._width, this._height);
13010
13036
  };
@@ -18308,36 +18334,6 @@ var DButtonBaseWhen = {
18308
18334
  DOUBLE_CLICKED: 1
18309
18335
  };
18310
18336
 
18311
- /*
18312
- * Copyright (C) 2019 Toshiba Corporation
18313
- * SPDX-License-Identifier: Apache-2.0
18314
- */
18315
- var DAlignHorizontal = {
18316
- LEFT: 0,
18317
- CENTER: 1,
18318
- RIGHT: 2
18319
- };
18320
-
18321
- /*
18322
- * Copyright (C) 2019 Toshiba Corporation
18323
- * SPDX-License-Identifier: Apache-2.0
18324
- */
18325
- var DAlignVertical = {
18326
- TOP: 0,
18327
- MIDDLE: 1,
18328
- BOTTOM: 2
18329
- };
18330
-
18331
- /*
18332
- * Copyright (C) 2019 Toshiba Corporation
18333
- * SPDX-License-Identifier: Apache-2.0
18334
- */
18335
- var DAlignWith = {
18336
- TEXT: 0,
18337
- PADDING: 1,
18338
- BORDER: 2
18339
- };
18340
-
18341
18337
  var DImageBaseThemeWrapperSecondary = /** @class */ (function () {
18342
18338
  function DImageBaseThemeWrapperSecondary(theme) {
18343
18339
  this._theme = theme;
@@ -18400,6 +18396,36 @@ var DImageBaseThemeWrapperTertiary = /** @class */ (function () {
18400
18396
  return DImageBaseThemeWrapperTertiary;
18401
18397
  }());
18402
18398
 
18399
+ /*
18400
+ * Copyright (C) 2019 Toshiba Corporation
18401
+ * SPDX-License-Identifier: Apache-2.0
18402
+ */
18403
+ var DAlignHorizontal = {
18404
+ LEFT: 0,
18405
+ CENTER: 1,
18406
+ RIGHT: 2
18407
+ };
18408
+
18409
+ /*
18410
+ * Copyright (C) 2019 Toshiba Corporation
18411
+ * SPDX-License-Identifier: Apache-2.0
18412
+ */
18413
+ var DAlignVertical = {
18414
+ TOP: 0,
18415
+ MIDDLE: 1,
18416
+ BOTTOM: 2
18417
+ };
18418
+
18419
+ /*
18420
+ * Copyright (C) 2019 Toshiba Corporation
18421
+ * SPDX-License-Identifier: Apache-2.0
18422
+ */
18423
+ var DAlignWith = {
18424
+ TEXT: 0,
18425
+ PADDING: 1,
18426
+ BORDER: 2
18427
+ };
18428
+
18403
18429
  var toImageAlign = function (theme, options) {
18404
18430
  var _a, _b, _c;
18405
18431
  var align = options === null || options === void 0 ? void 0 : options.align;
@@ -18680,6 +18706,388 @@ var DImagePiece = /** @class */ (function () {
18680
18706
  return DImagePiece;
18681
18707
  }());
18682
18708
 
18709
+ var DImagePieceLayouterPart = /** @class */ (function () {
18710
+ function DImagePieceLayouterPart() {
18711
+ this.pieces = [];
18712
+ this.size = 0;
18713
+ }
18714
+ DImagePieceLayouterPart.prototype.clear = function () {
18715
+ this.pieces.length = 0;
18716
+ this.size = 0;
18717
+ };
18718
+ DImagePieceLayouterPart.prototype.add = function (image, size, margin) {
18719
+ var pieces = this.pieces;
18720
+ pieces.push(image);
18721
+ this.size += margin + size;
18722
+ };
18723
+ return DImagePieceLayouterPart;
18724
+ }());
18725
+
18726
+ var DImagePieceLayouterPartBottom = /** @class */ (function (_super) {
18727
+ __extends(DImagePieceLayouterPartBottom, _super);
18728
+ function DImagePieceLayouterPartBottom() {
18729
+ return _super !== null && _super.apply(this, arguments) || this;
18730
+ }
18731
+ DImagePieceLayouterPartBottom.prototype.execute = function (pbottom, height, marginAfter) {
18732
+ var pieces = this.pieces;
18733
+ var y = height - pbottom;
18734
+ if (marginAfter) {
18735
+ var margin = 0;
18736
+ for (var i = 0, imax = pieces.length; i < imax; ++i) {
18737
+ var piece = pieces[i];
18738
+ y -= margin + piece.bound.height;
18739
+ piece.image.y = y;
18740
+ margin = piece.margin.horizontal;
18741
+ }
18742
+ }
18743
+ else {
18744
+ for (var i = 0, imax = pieces.length; i < imax; ++i) {
18745
+ var piece = pieces[i];
18746
+ y -= piece.margin.horizontal + piece.bound.height;
18747
+ piece.image.y = y;
18748
+ }
18749
+ }
18750
+ };
18751
+ return DImagePieceLayouterPartBottom;
18752
+ }(DImagePieceLayouterPart));
18753
+
18754
+ var DImagePieceLayouterPartCenter = /** @class */ (function (_super) {
18755
+ __extends(DImagePieceLayouterPartCenter, _super);
18756
+ function DImagePieceLayouterPartCenter() {
18757
+ return _super !== null && _super.apply(this, arguments) || this;
18758
+ }
18759
+ DImagePieceLayouterPartCenter.prototype.add = function (image, size, margin) {
18760
+ var pieces = this.pieces;
18761
+ pieces.push(image);
18762
+ this.size = Math.max(this.size, size);
18763
+ };
18764
+ DImagePieceLayouterPartCenter.prototype.execute = function (pleft, pright, width) {
18765
+ var c = pleft + (width - pleft - pright) * 0.5;
18766
+ var pieces = this.pieces;
18767
+ for (var i = 0, imax = pieces.length; i < imax; ++i) {
18768
+ var piece = pieces[i];
18769
+ piece.image.x = c - piece.bound.width * 0.5;
18770
+ }
18771
+ };
18772
+ return DImagePieceLayouterPartCenter;
18773
+ }(DImagePieceLayouterPart));
18774
+
18775
+ var DImagePieceLayouterPartLeft = /** @class */ (function (_super) {
18776
+ __extends(DImagePieceLayouterPartLeft, _super);
18777
+ function DImagePieceLayouterPartLeft() {
18778
+ return _super !== null && _super.apply(this, arguments) || this;
18779
+ }
18780
+ DImagePieceLayouterPartLeft.prototype.execute = function (pleft, marginAfter) {
18781
+ var pieces = this.pieces;
18782
+ var x = pleft;
18783
+ if (marginAfter) {
18784
+ for (var i = 0, imax = pieces.length; i < imax; ++i) {
18785
+ var piece = pieces[i];
18786
+ piece.image.x = x;
18787
+ x += piece.bound.width + piece.margin.horizontal;
18788
+ }
18789
+ }
18790
+ else {
18791
+ for (var i = 0, imax = pieces.length; i < imax; ++i) {
18792
+ var piece = pieces[i];
18793
+ x += piece.margin.horizontal;
18794
+ piece.image.x = x;
18795
+ x += piece.bound.width;
18796
+ }
18797
+ }
18798
+ };
18799
+ return DImagePieceLayouterPartLeft;
18800
+ }(DImagePieceLayouterPart));
18801
+
18802
+ var DImagePieceLayouterPartMiddle = /** @class */ (function (_super) {
18803
+ __extends(DImagePieceLayouterPartMiddle, _super);
18804
+ function DImagePieceLayouterPartMiddle() {
18805
+ return _super !== null && _super.apply(this, arguments) || this;
18806
+ }
18807
+ DImagePieceLayouterPartMiddle.prototype.add = function (image, size, margin) {
18808
+ var pieces = this.pieces;
18809
+ pieces.push(image);
18810
+ this.size = Math.max(this.size, size);
18811
+ };
18812
+ DImagePieceLayouterPartMiddle.prototype.execute = function (ptop, pbottom, height) {
18813
+ var c = ptop + (height - ptop - pbottom) * 0.5;
18814
+ var pieces = this.pieces;
18815
+ for (var i = 0, imax = pieces.length; i < imax; ++i) {
18816
+ var piece = pieces[i];
18817
+ piece.image.y = c - piece.bound.height * 0.5;
18818
+ }
18819
+ };
18820
+ return DImagePieceLayouterPartMiddle;
18821
+ }(DImagePieceLayouterPart));
18822
+
18823
+ var DImagePieceLayouterPartRight = /** @class */ (function (_super) {
18824
+ __extends(DImagePieceLayouterPartRight, _super);
18825
+ function DImagePieceLayouterPartRight() {
18826
+ return _super !== null && _super.apply(this, arguments) || this;
18827
+ }
18828
+ DImagePieceLayouterPartRight.prototype.execute = function (pright, width, marginAfter) {
18829
+ var pieces = this.pieces;
18830
+ var x = width - pright;
18831
+ if (marginAfter) {
18832
+ var margin = 0;
18833
+ for (var i = 0, imax = pieces.length; i < imax; ++i) {
18834
+ var piece = pieces[i];
18835
+ x -= margin + piece.bound.width;
18836
+ piece.image.x = x;
18837
+ margin = piece.margin.horizontal;
18838
+ }
18839
+ }
18840
+ else {
18841
+ for (var i = 0, imax = pieces.length; i < imax; ++i) {
18842
+ var piece = pieces[i];
18843
+ x -= piece.margin.horizontal + piece.bound.width;
18844
+ piece.image.x = x;
18845
+ }
18846
+ }
18847
+ };
18848
+ return DImagePieceLayouterPartRight;
18849
+ }(DImagePieceLayouterPart));
18850
+
18851
+ var DImagePieceLayouterPartTop = /** @class */ (function (_super) {
18852
+ __extends(DImagePieceLayouterPartTop, _super);
18853
+ function DImagePieceLayouterPartTop() {
18854
+ return _super !== null && _super.apply(this, arguments) || this;
18855
+ }
18856
+ DImagePieceLayouterPartTop.prototype.execute = function (ptop, marginAfter) {
18857
+ var pieces = this.pieces;
18858
+ var y = ptop;
18859
+ if (marginAfter) {
18860
+ var margin = 0;
18861
+ for (var i = 0, imax = pieces.length; i < imax; ++i) {
18862
+ var piece = pieces[i];
18863
+ piece.image.y = margin + y;
18864
+ y += piece.bound.height;
18865
+ margin = piece.margin.vertical;
18866
+ }
18867
+ }
18868
+ else {
18869
+ for (var i = 0, imax = pieces.length; i < imax; ++i) {
18870
+ var piece = pieces[i];
18871
+ y += piece.margin.vertical;
18872
+ piece.image.y = y;
18873
+ y += piece.bound.height;
18874
+ }
18875
+ }
18876
+ };
18877
+ return DImagePieceLayouterPartTop;
18878
+ }(DImagePieceLayouterPart));
18879
+
18880
+ var DImagePieceLayouterPartContainer = /** @class */ (function () {
18881
+ function DImagePieceLayouterPartContainer() {
18882
+ this.left = new DImagePieceLayouterPartLeft();
18883
+ this.center = new DImagePieceLayouterPartCenter();
18884
+ this.right = new DImagePieceLayouterPartRight();
18885
+ this.top = new DImagePieceLayouterPartTop();
18886
+ this.middle = new DImagePieceLayouterPartMiddle();
18887
+ this.bottom = new DImagePieceLayouterPartBottom();
18888
+ }
18889
+ DImagePieceLayouterPartContainer.prototype.clear = function () {
18890
+ this.left.clear();
18891
+ this.center.clear();
18892
+ this.right.clear();
18893
+ this.top.clear();
18894
+ this.middle.clear();
18895
+ this.bottom.clear();
18896
+ this.text = undefined;
18897
+ };
18898
+ DImagePieceLayouterPartContainer.prototype.add = function (image) {
18899
+ var imageImage = image.image;
18900
+ if (imageImage != null) {
18901
+ var imageBound = image.bound;
18902
+ var imageBoundWidth = imageBound.width;
18903
+ var imageBoundHeight = imageBound.height;
18904
+ var imageMargin = image.margin;
18905
+ var imageMarginHorizontal = imageMargin.horizontal;
18906
+ var imageMarginVertical = imageMargin.vertical;
18907
+ var imageAlign = image.align;
18908
+ switch (imageAlign.horizontal) {
18909
+ case DAlignHorizontal.LEFT:
18910
+ this.left.add(image, imageBoundWidth, imageMarginHorizontal);
18911
+ break;
18912
+ case DAlignHorizontal.CENTER:
18913
+ this.center.add(image, imageBoundWidth, imageMarginHorizontal);
18914
+ break;
18915
+ case DAlignHorizontal.RIGHT:
18916
+ this.right.add(image, imageBoundWidth, imageMarginHorizontal);
18917
+ break;
18918
+ }
18919
+ switch (imageAlign.vertical) {
18920
+ case DAlignVertical.TOP:
18921
+ this.top.add(image, imageBoundHeight, imageMarginVertical);
18922
+ break;
18923
+ case DAlignVertical.MIDDLE:
18924
+ this.middle.add(image, imageBoundHeight, imageMarginVertical);
18925
+ break;
18926
+ case DAlignVertical.BOTTOM:
18927
+ this.bottom.add(image, imageBoundHeight, imageMarginVertical);
18928
+ break;
18929
+ }
18930
+ }
18931
+ };
18932
+ DImagePieceLayouterPartContainer.prototype.set = function (text) {
18933
+ this.text = text;
18934
+ };
18935
+ Object.defineProperty(DImagePieceLayouterPartContainer.prototype, "width", {
18936
+ get: function () {
18937
+ var text = this.text;
18938
+ var left = this.left;
18939
+ var center = this.center;
18940
+ var right = this.right;
18941
+ if (text) {
18942
+ return Math.max(left.size + text.width + right.size, center.size);
18943
+ }
18944
+ else {
18945
+ return Math.max(left.size, right.size, center.size);
18946
+ }
18947
+ },
18948
+ enumerable: false,
18949
+ configurable: true
18950
+ });
18951
+ Object.defineProperty(DImagePieceLayouterPartContainer.prototype, "height", {
18952
+ get: function () {
18953
+ var text = this.text;
18954
+ var top = this.top;
18955
+ var middle = this.middle;
18956
+ var bottom = this.bottom;
18957
+ if (text) {
18958
+ return Math.max(top.size + text.height + bottom.size, middle.size);
18959
+ }
18960
+ else {
18961
+ return Math.max(top.size, bottom.size, middle.size);
18962
+ }
18963
+ },
18964
+ enumerable: false,
18965
+ configurable: true
18966
+ });
18967
+ DImagePieceLayouterPartContainer.prototype.execute = function (pleft, ptop, pright, pbottom, textAlign, width, height) {
18968
+ var left = this.left;
18969
+ var center = this.center;
18970
+ var right = this.right;
18971
+ var top = this.top;
18972
+ var middle = this.middle;
18973
+ var bottom = this.bottom;
18974
+ var text = this.text;
18975
+ if (text) {
18976
+ var textX = 0;
18977
+ var textWidth = text.width;
18978
+ switch (textAlign.horizontal) {
18979
+ case DAlignHorizontal.LEFT:
18980
+ textX = pleft + left.size;
18981
+ break;
18982
+ case DAlignHorizontal.CENTER:
18983
+ textX =
18984
+ pleft +
18985
+ (width - pleft - pright - (left.size + textWidth + right.size)) * 0.5 +
18986
+ left.size;
18987
+ break;
18988
+ case DAlignHorizontal.RIGHT:
18989
+ textX = width - pright - right.size - textWidth;
18990
+ break;
18991
+ }
18992
+ var textY = 0;
18993
+ var textHeight = text.height;
18994
+ switch (textAlign.vertical) {
18995
+ case DAlignVertical.TOP:
18996
+ textY = ptop + top.size;
18997
+ break;
18998
+ case DAlignVertical.MIDDLE:
18999
+ textY =
19000
+ ptop +
19001
+ (height - ptop - pbottom - (top.size + textHeight + bottom.size)) * 0.5 +
19002
+ top.size;
19003
+ break;
19004
+ case DAlignVertical.BOTTOM:
19005
+ textY = height - pbottom - bottom.size - textHeight;
19006
+ break;
19007
+ }
19008
+ text.position.set(textX, textY);
19009
+ text.setClippingDelta(left.size + right.size, top.size + bottom.size);
19010
+ left.execute(textX - left.size, true);
19011
+ center.execute(0, 0, textX * 2 + textWidth);
19012
+ right.execute(0, textX + textWidth + right.size, true);
19013
+ top.execute(textY - top.size, true);
19014
+ middle.execute(0, 0, textY * 2 + textHeight);
19015
+ bottom.execute(0, textY + textHeight + bottom.size, true);
19016
+ }
19017
+ else {
19018
+ left.execute(pleft, false);
19019
+ center.execute(pleft, pright, width);
19020
+ right.execute(pright, width, false);
19021
+ top.execute(ptop, false);
19022
+ middle.execute(ptop, pbottom, height);
19023
+ bottom.execute(pbottom, height, false);
19024
+ }
19025
+ };
19026
+ return DImagePieceLayouterPartContainer;
19027
+ }());
19028
+
19029
+ var DImagePieceLayouter = /** @class */ (function () {
19030
+ function DImagePieceLayouter() {
19031
+ this.text = new DImagePieceLayouterPartContainer();
19032
+ this.padding = new DImagePieceLayouterPartContainer();
19033
+ this.border = new DImagePieceLayouterPartContainer();
19034
+ }
19035
+ DImagePieceLayouter.prototype.clear = function () {
19036
+ this.text.clear();
19037
+ this.padding.clear();
19038
+ this.border.clear();
19039
+ };
19040
+ DImagePieceLayouter.prototype.add = function (image) {
19041
+ var imageImage = image.image;
19042
+ if (imageImage) {
19043
+ switch (image.align.with) {
19044
+ case DAlignWith.TEXT:
19045
+ this.text.add(image);
19046
+ break;
19047
+ case DAlignWith.PADDING:
19048
+ this.padding.add(image);
19049
+ break;
19050
+ case DAlignWith.BORDER:
19051
+ this.border.add(image);
19052
+ break;
19053
+ }
19054
+ }
19055
+ };
19056
+ DImagePieceLayouter.prototype.set = function (text) {
19057
+ this.text.set(text);
19058
+ };
19059
+ DImagePieceLayouter.prototype.execute = function (padding, textAlign, width, height) {
19060
+ var pleft = padding.getLeft();
19061
+ var ptop = padding.getTop();
19062
+ var pright = padding.getRight();
19063
+ var pbottom = padding.getBottom();
19064
+ if (width == null) {
19065
+ width = pleft + this.width + pright;
19066
+ }
19067
+ if (height == null) {
19068
+ height = ptop + this.height + pbottom;
19069
+ }
19070
+ this.border.execute(0, 0, 0, 0, textAlign, width, height);
19071
+ this.padding.execute(pleft, ptop, pright, pbottom, textAlign, width, height);
19072
+ this.text.execute(pleft, ptop, pright, pbottom, textAlign, width, height);
19073
+ };
19074
+ Object.defineProperty(DImagePieceLayouter.prototype, "width", {
19075
+ get: function () {
19076
+ return Math.max(this.border.width, this.padding.width, this.text.width);
19077
+ },
19078
+ enumerable: false,
19079
+ configurable: true
19080
+ });
19081
+ Object.defineProperty(DImagePieceLayouter.prototype, "height", {
19082
+ get: function () {
19083
+ return Math.max(this.border.height, this.padding.height, this.text.height);
19084
+ },
19085
+ enumerable: false,
19086
+ configurable: true
19087
+ });
19088
+ return DImagePieceLayouter;
19089
+ }());
19090
+
18683
19091
  /*
18684
19092
  * Copyright (C) 2019 Toshiba Corporation
18685
19093
  * SPDX-License-Identifier: Apache-2.0
@@ -19905,32 +20313,42 @@ var DTextBase = /** @class */ (function (_super) {
19905
20313
  DTextBase.prototype.updateTextPosition = function (text) {
19906
20314
  var align = this._textAlign;
19907
20315
  var padding = this._padding;
19908
- var toRounded = this.toRounded;
19909
- switch (align.horizontal) {
19910
- case DAlignHorizontal.LEFT:
19911
- text.x = toRounded(padding.getLeft());
19912
- break;
19913
- case DAlignHorizontal.CENTER:
19914
- text.x = toRounded((this.width - text.width) * 0.5);
19915
- break;
19916
- case DAlignHorizontal.RIGHT:
19917
- text.x = toRounded(this.width - text.width - padding.getRight());
19918
- break;
20316
+ var auto = this._auto;
20317
+ var textX = 0;
20318
+ var pleft = padding.getLeft();
20319
+ var alignHorizontal = align.horizontal;
20320
+ if (auto.width.isOn || alignHorizontal === DAlignHorizontal.LEFT) {
20321
+ textX = pleft;
19919
20322
  }
19920
- switch (align.vertical) {
19921
- case DAlignVertical.TOP:
19922
- text.y = toRounded(padding.getTop());
19923
- break;
19924
- case DAlignVertical.MIDDLE:
19925
- text.y = toRounded((this.height - text.height) * 0.5);
19926
- break;
19927
- case DAlignVertical.BOTTOM:
19928
- text.y = toRounded(this.height - text.height - padding.getBottom());
19929
- break;
20323
+ else {
20324
+ var width = this.width;
20325
+ var textWidth = text.width;
20326
+ var pright = padding.getRight();
20327
+ if (alignHorizontal === DAlignHorizontal.CENTER) {
20328
+ textX = pleft + (width - pleft - pright - textWidth) * 0.5;
20329
+ }
20330
+ else {
20331
+ textX = width - textWidth - pright;
20332
+ }
19930
20333
  }
19931
- };
19932
- DTextBase.prototype.toRounded = function (value) {
19933
- return Math.round(value);
20334
+ var textY = 0;
20335
+ var ptop = padding.getTop();
20336
+ var alignVertical = align.vertical;
20337
+ if (auto.height.isOn || alignVertical === DAlignVertical.TOP) {
20338
+ textY = ptop;
20339
+ }
20340
+ else {
20341
+ var height = this.height;
20342
+ var textHeight = text.height;
20343
+ var pbottom = padding.getBottom();
20344
+ if (alignVertical === DAlignVertical.MIDDLE) {
20345
+ textY = ptop + (height - ptop - pbottom - textHeight) * 0.5;
20346
+ }
20347
+ else {
20348
+ textY = height - textHeight - pbottom;
20349
+ }
20350
+ }
20351
+ text.position.set(textX, textY);
19934
20352
  };
19935
20353
  DTextBase.prototype.getTextColor = function (theme, state) {
19936
20354
  var color = this._textColor;
@@ -20100,277 +20518,24 @@ var DImageBase = /** @class */ (function (_super) {
20100
20518
  this.updateTextAndImage();
20101
20519
  };
20102
20520
  DImageBase.prototype.updateTextAndImage = function () {
20103
- var text = this._text;
20521
+ var _a;
20104
20522
  var images = this._images;
20105
- var padding = this._padding;
20106
- var toRounded = this.toRounded;
20107
- var width = this.width;
20108
- var height = this.height;
20109
- var pl = padding.getLeft();
20110
- var pr = padding.getRight();
20111
- var pt = padding.getTop();
20112
- var pb = padding.getBottom();
20113
- var noText = text == null;
20114
- var textLeftFirst = noText;
20115
- var textTopFirst = noText;
20116
- var textRightLastMargin = 0;
20117
- var textBottomLastMargin = 0;
20118
- var textLeft = 0;
20119
- var textRight = 0;
20120
- var textTop = 0;
20121
- var textBottom = 0;
20122
- var paddingLeft = pl;
20123
- var paddingRight = width - pr;
20124
- var paddingTop = pt;
20125
- var paddingBottom = height - pb;
20126
- var borderLeft = 0;
20127
- var borderRight = width;
20128
- var borderTop = 0;
20129
- var borderBottom = height;
20523
+ var layouter = ((_a = DImageBase.LAYOUTER) !== null && _a !== void 0 ? _a : (DImageBase.LAYOUTER = new DImagePieceLayouter()));
20130
20524
  for (var i = 0, imax = images.length; i < imax; ++i) {
20131
20525
  var image = images[i];
20132
20526
  image.updateSource();
20133
20527
  image.updateTint();
20134
20528
  image.updateBound();
20135
- var imageImage = image.image;
20136
- if (imageImage) {
20137
- var imageBound = image.bound;
20138
- var imageBoundWidth = imageBound.width;
20139
- var imageBoundHeight = imageBound.height;
20140
- var imageMargin = image.margin;
20141
- var imageMarginHorizontal = imageMargin.horizontal;
20142
- var imageMarginVertical = imageMargin.vertical;
20143
- // Text
20144
- if (image.align.with === DAlignWith.TEXT) {
20145
- switch (image.align.horizontal) {
20146
- case DAlignHorizontal.LEFT:
20147
- imageImage.x = textLeft;
20148
- textLeft += imageBoundWidth;
20149
- if (textLeftFirst) {
20150
- textLeftFirst = false;
20151
- }
20152
- else {
20153
- textLeft += imageMarginHorizontal;
20154
- }
20155
- break;
20156
- case DAlignHorizontal.CENTER:
20157
- // DO NOTHING
20158
- break;
20159
- case DAlignHorizontal.RIGHT:
20160
- textRight -= imageBoundWidth;
20161
- imageImage.x = textRight;
20162
- textRight -= imageMarginHorizontal;
20163
- textRightLastMargin = imageMarginHorizontal;
20164
- break;
20165
- }
20166
- switch (image.align.vertical) {
20167
- case DAlignVertical.TOP:
20168
- imageImage.y = textTop;
20169
- textTop += imageBoundHeight;
20170
- if (textTopFirst) {
20171
- textTopFirst = false;
20172
- }
20173
- else {
20174
- textTop += imageMarginVertical;
20175
- }
20176
- break;
20177
- case DAlignVertical.MIDDLE:
20178
- // DO NOTHING
20179
- break;
20180
- case DAlignVertical.BOTTOM:
20181
- textBottom -= imageBoundHeight;
20182
- imageImage.y = textBottom;
20183
- textBottom -= imageMarginVertical;
20184
- textBottomLastMargin = imageMarginVertical;
20185
- break;
20186
- }
20187
- }
20188
- // Padding
20189
- if (image.align.with === DAlignWith.PADDING) {
20190
- switch (image.align.horizontal) {
20191
- case DAlignHorizontal.LEFT:
20192
- paddingLeft += imageMarginHorizontal;
20193
- imageImage.x = toRounded(paddingLeft);
20194
- paddingLeft += imageBoundWidth;
20195
- break;
20196
- case DAlignHorizontal.CENTER:
20197
- // DO NOTHING
20198
- break;
20199
- case DAlignHorizontal.RIGHT:
20200
- paddingRight -= imageBoundWidth + imageMarginHorizontal;
20201
- imageImage.x = toRounded(paddingRight);
20202
- break;
20203
- }
20204
- switch (image.align.vertical) {
20205
- case DAlignVertical.TOP:
20206
- paddingTop += imageMarginVertical;
20207
- imageImage.y = toRounded(paddingTop);
20208
- paddingTop += imageBoundHeight;
20209
- break;
20210
- case DAlignVertical.MIDDLE:
20211
- // DO NOTHING
20212
- break;
20213
- case DAlignVertical.BOTTOM:
20214
- paddingBottom -= imageBoundHeight + imageMarginVertical;
20215
- imageImage.y = toRounded(paddingBottom);
20216
- break;
20217
- }
20218
- }
20219
- // Border
20220
- if (image.align.with === DAlignWith.BORDER) {
20221
- switch (image.align.horizontal) {
20222
- case DAlignHorizontal.LEFT:
20223
- borderLeft += imageMarginHorizontal;
20224
- imageImage.x = toRounded(borderLeft);
20225
- borderLeft += imageBoundWidth;
20226
- break;
20227
- case DAlignHorizontal.CENTER:
20228
- // DO NOTHING
20229
- break;
20230
- case DAlignHorizontal.RIGHT:
20231
- borderRight -= imageBoundWidth + imageMarginHorizontal;
20232
- imageImage.x = toRounded(borderRight);
20233
- break;
20234
- }
20235
- switch (image.align.vertical) {
20236
- case DAlignVertical.TOP:
20237
- borderTop += imageMarginVertical;
20238
- imageImage.y = toRounded(borderTop);
20239
- borderTop += imageBoundHeight;
20240
- break;
20241
- case DAlignVertical.MIDDLE:
20242
- // DO NOTHING
20243
- break;
20244
- case DAlignVertical.BOTTOM:
20245
- borderBottom -= imageBoundHeight + imageMarginVertical;
20246
- imageImage.y = toRounded(borderBottom);
20247
- break;
20248
- }
20249
- }
20250
- }
20529
+ layouter.add(image);
20251
20530
  }
20252
- if (noText) {
20253
- textRight += textRightLastMargin;
20254
- textBottom += textBottomLastMargin;
20255
- }
20256
- // Text
20257
- var textLeftAdjust = 0;
20258
- var textCenterAdjust = 0;
20259
- var textRightAdjust = 0;
20260
- var textTopAdjust = 0;
20261
- var textMiddleAdjust = 0;
20262
- var textBottomAdjust = 0;
20531
+ var text = this._text;
20263
20532
  if (text != null) {
20264
20533
  this.updateTextColor(text);
20265
- text.setClippingDelta(textLeft - textRight, textTop - textBottom);
20266
- var textAlign = this._textAlign;
20267
- var textWidth = text.width;
20268
- var textHeight = text.height;
20269
- switch (textAlign.horizontal) {
20270
- case DAlignHorizontal.LEFT:
20271
- textLeftAdjust = pl;
20272
- textRightAdjust = textLeftAdjust + textLeft + textWidth - textRight;
20273
- break;
20274
- case DAlignHorizontal.CENTER:
20275
- textLeftAdjust = (width - textLeft + textRight - textWidth) * 0.5;
20276
- textRightAdjust = textLeftAdjust + textLeft + textWidth - textRight;
20277
- break;
20278
- case DAlignHorizontal.RIGHT:
20279
- textRightAdjust = width - pr;
20280
- textLeftAdjust = textRightAdjust + textRight - textWidth - textLeft;
20281
- break;
20282
- }
20283
- text.x = toRounded(textLeftAdjust + textLeft);
20284
- textCenterAdjust = textLeftAdjust + textLeft + textWidth * 0.5;
20285
- switch (textAlign.vertical) {
20286
- case DAlignVertical.TOP:
20287
- textTopAdjust = pt;
20288
- textBottomAdjust = textTopAdjust + textTop + textHeight - textBottom;
20289
- break;
20290
- case DAlignVertical.MIDDLE:
20291
- textTopAdjust = (height - textTop + textBottom - textHeight) * 0.5;
20292
- textBottomAdjust = textTopAdjust + textTop + textHeight - textBottom;
20293
- break;
20294
- case DAlignVertical.BOTTOM:
20295
- textBottomAdjust = height - pb;
20296
- textTopAdjust = textBottomAdjust + textBottom - textHeight - textTop;
20297
- break;
20298
- }
20299
- text.y = toRounded(textTopAdjust + textTop);
20300
- textMiddleAdjust = textTopAdjust + textTop + textHeight * 0.5;
20301
- }
20302
- else {
20303
- textLeftAdjust = (width - textLeft + textRight) * 0.5;
20304
- textRightAdjust = textLeftAdjust + textLeft - textRight;
20305
- textCenterAdjust = textLeftAdjust + textLeft;
20306
- textTopAdjust = (height - textTop + textBottom) * 0.5;
20307
- textBottomAdjust = textTopAdjust + textTop - textBottom;
20308
- textMiddleAdjust = textTopAdjust + textTop;
20309
- }
20310
- var paddingCenterAdjust = width * 0.5;
20311
- var paddingMiddleAdjust = height * 0.5;
20312
- var borderCenterAdjust = width * 0.5;
20313
- var borderMiddleAdjust = height * 0.5;
20314
- for (var i = 0, imax = images.length; i < imax; ++i) {
20315
- var image = images[i];
20316
- var imageImage = image.image;
20317
- if (imageImage) {
20318
- var imageBound = image.bound;
20319
- var imageBoundWidth = imageBound.width;
20320
- var imageBoundHeight = imageBound.height;
20321
- // Text
20322
- if (image.align.with === DAlignWith.TEXT) {
20323
- switch (image.align.horizontal) {
20324
- case DAlignHorizontal.LEFT:
20325
- imageImage.x = toRounded(imageImage.x + textLeftAdjust);
20326
- break;
20327
- case DAlignHorizontal.CENTER:
20328
- imageImage.x = toRounded(textCenterAdjust - imageBoundWidth * 0.5);
20329
- break;
20330
- case DAlignHorizontal.RIGHT:
20331
- imageImage.x = toRounded(imageImage.x + textRightAdjust);
20332
- break;
20333
- }
20334
- switch (image.align.vertical) {
20335
- case DAlignVertical.TOP:
20336
- imageImage.y = toRounded(imageImage.y + textTopAdjust);
20337
- break;
20338
- case DAlignVertical.MIDDLE:
20339
- imageImage.y = toRounded(textMiddleAdjust - imageBoundHeight * 0.5);
20340
- break;
20341
- case DAlignVertical.BOTTOM:
20342
- imageImage.y = toRounded(imageImage.y + textBottomAdjust);
20343
- break;
20344
- }
20345
- }
20346
- // Padding
20347
- if (image.align.with === DAlignWith.PADDING) {
20348
- switch (image.align.horizontal) {
20349
- case DAlignHorizontal.CENTER:
20350
- imageImage.x = toRounded(paddingCenterAdjust - imageBoundWidth * 0.5);
20351
- break;
20352
- }
20353
- switch (image.align.vertical) {
20354
- case DAlignVertical.MIDDLE:
20355
- imageImage.y = toRounded(paddingMiddleAdjust - imageBoundHeight * 0.5);
20356
- break;
20357
- }
20358
- }
20359
- // Border
20360
- if (image.align.with === DAlignWith.BORDER) {
20361
- switch (image.align.horizontal) {
20362
- case DAlignHorizontal.CENTER:
20363
- imageImage.x = toRounded(borderCenterAdjust - imageBoundWidth * 0.5);
20364
- break;
20365
- }
20366
- switch (image.align.vertical) {
20367
- case DAlignVertical.MIDDLE:
20368
- imageImage.y = toRounded(borderMiddleAdjust - imageBoundHeight * 0.5);
20369
- break;
20370
- }
20371
- }
20372
- }
20534
+ layouter.set(text);
20373
20535
  }
20536
+ var auto = this._auto;
20537
+ layouter.execute(this._padding, this._textAlign, auto.width.isOn ? null : this.width, auto.height.isOn ? null : this.height);
20538
+ layouter.clear();
20374
20539
  };
20375
20540
  DImageBase.prototype.isRefitable = function (target) {
20376
20541
  if (_super.prototype.isRefitable.call(this, target)) {
@@ -22676,9 +22841,6 @@ var DHtmlElement = /** @class */ (function (_super) {
22676
22841
  this.toGlobal(point, point, true);
22677
22842
  result.width = point.x - result.x;
22678
22843
  result.height = point.y - result.y;
22679
- // Rounds pixels as Pixi.js does
22680
- result.x = ((result.x * resolution) | 0) / resolution;
22681
- result.y = ((result.y * resolution) | 0) / resolution;
22682
22844
  return result;
22683
22845
  };
22684
22846
  DHtmlElement.prototype.getClipperRect = function (resolution, point, result) {
@@ -38887,8 +39049,24 @@ var DMenuItemText = /** @class */ (function (_super) {
38887
39049
  var text = this._shortcutText;
38888
39050
  var margin = this._shortcutMargin;
38889
39051
  if (text != null && margin != null) {
38890
- var toRounded = this.toRounded;
38891
- text.position.set(toRounded(this.width - margin - text.width), toRounded((this.height - text.height) * 0.5));
39052
+ var auto = this._auto;
39053
+ var textX = 0;
39054
+ if (auto.width.isOn) {
39055
+ textX = margin;
39056
+ }
39057
+ else {
39058
+ textX = this.width - text.width - margin;
39059
+ }
39060
+ var textY = 0;
39061
+ var padding = this._padding;
39062
+ var ptop = padding.getTop();
39063
+ if (auto.height.isOn) {
39064
+ textY = ptop;
39065
+ }
39066
+ else {
39067
+ textY = ptop + (this.height - ptop - padding.getBottom() - text.height) * 0.5;
39068
+ }
39069
+ text.position.set(textX, textY);
38892
39070
  }
38893
39071
  };
38894
39072
  DMenuItemText.prototype.updateTextColor = function (text) {
@@ -46729,8 +46907,8 @@ var DThemeWhiteInput = /** @class */ (function (_super) {
46729
46907
  DThemeWhiteInput.prototype.getSelect = function () {
46730
46908
  return true;
46731
46909
  };
46732
- DThemeWhiteInput.prototype.getElementStyleMargin = function (state) {
46733
- return "margin: 0.1em 0 0 0;";
46910
+ DThemeWhiteInput.prototype.getElementStyleBorder = function (state) {
46911
+ return "border: 1px solid transparent; box-sizing: border-box;";
46734
46912
  };
46735
46913
  return DThemeWhiteInput;
46736
46914
  }(DThemeWhiteHtmlElement));
@@ -55337,8 +55515,8 @@ var DThemeDarkInput = /** @class */ (function (_super) {
55337
55515
  DThemeDarkInput.prototype.getSelect = function () {
55338
55516
  return true;
55339
55517
  };
55340
- DThemeDarkInput.prototype.getElementStyleMargin = function (state) {
55341
- return "margin: 0.1em 0 0 0;";
55518
+ DThemeDarkInput.prototype.getElementStyleBorder = function (state) {
55519
+ return "border: 1px solid transparent; box-sizing: border-box;";
55342
55520
  };
55343
55521
  return DThemeDarkInput;
55344
55522
  }(DThemeDarkHtmlElement));
@@ -59380,7 +59558,9 @@ var DynamicFontAtlasFont = /** @class */ (function () {
59380
59558
  this.height = size + padding * 2;
59381
59559
  var metrics = pixi_js.TextMetrics.measureFont(fontId);
59382
59560
  this.ascent = metrics.ascent;
59383
- this.descent = metrics.descent;
59561
+ // Becase the descent returned by TextMatrics#measureFont is tend
59562
+ // to be the half of the actual descent browsers use internally.
59563
+ this.descent = metrics.descent * 2;
59384
59564
  }
59385
59565
  return DynamicFontAtlasFont;
59386
59566
  }());
@@ -61352,7 +61532,6 @@ var DApplicationLayer = /** @class */ (function (_super) {
61352
61532
  _this._isOverlay = options.isOverlay();
61353
61533
  _this._padding = options.getPadding();
61354
61534
  _this._rootElement = options.getRootElement();
61355
- _this._refitLimit = 5;
61356
61535
  _this._reflowLimit = 5;
61357
61536
  _this._elementContainer = _this.newElementContainer();
61358
61537
  _this.application = application;
@@ -61546,7 +61725,6 @@ var DApplicationLayer = /** @class */ (function (_super) {
61546
61725
  }
61547
61726
  };
61548
61727
  DApplicationLayer.prototype.render = function () {
61549
- this.refit();
61550
61728
  this.reflow();
61551
61729
  // Please note why the following line is here.
61552
61730
  //
@@ -61582,32 +61760,16 @@ var DApplicationLayer = /** @class */ (function (_super) {
61582
61760
  enumerable: false,
61583
61761
  configurable: true
61584
61762
  });
61585
- DApplicationLayer.prototype.refit = function () {
61586
- var children = this.stage.children;
61587
- for (var ilimit = 0, limit = this._refitLimit; ilimit < limit; ++ilimit) {
61588
- var isChildrenDirty = false;
61589
- for (var i = 0, imax = children.length; i < imax; ++i) {
61590
- var child = children[i];
61591
- if (child instanceof DBase) {
61592
- child.refit();
61593
- isChildrenDirty = isChildrenDirty || child.isChildrenDirty();
61594
- }
61595
- }
61596
- // If DBases are changed during the `refit` process, need to refit again.
61597
- if (!isChildrenDirty) {
61598
- break;
61599
- }
61600
- }
61601
- };
61602
61763
  DApplicationLayer.prototype.reflow = function () {
61603
61764
  var children = this.stage.children;
61604
- for (var ilimit = 0, limit = this._refitLimit; ilimit < limit; ++ilimit) {
61765
+ for (var ilimit = 0, limit = this._reflowLimit; ilimit < limit; ++ilimit) {
61605
61766
  var isDirty = false;
61606
61767
  for (var i = 0, imax = children.length; i < imax; ++i) {
61607
61768
  var child = children[i];
61608
61769
  if (child instanceof DBase) {
61609
61770
  child.reflow();
61610
- isDirty = isDirty || child.isDirty() || child.hasDirty();
61771
+ isDirty =
61772
+ isDirty || child.isDirty() || child.hasDirty() || child.isHierarchyDirty();
61611
61773
  }
61612
61774
  }
61613
61775
  // If DBases are changed during the `reflow` process, need to reflow again.
@@ -71986,16 +72148,6 @@ var DDiagramSnapshot = /** @class */ (function (_super) {
71986
72148
  }
71987
72149
  return cleanup === true || cleanup.background === true;
71988
72150
  };
71989
- DDiagramSnapshot.prototype.toCleanupRefit = function (options) {
71990
- if (options == null) {
71991
- return true;
71992
- }
71993
- var cleanup = options.cleanup;
71994
- if (cleanup == null || cleanup === true) {
71995
- return true;
71996
- }
71997
- return cleanup !== false && cleanup.refit !== false;
71998
- };
71999
72151
  DDiagramSnapshot.prototype.toCleanupReflow = function (options) {
72000
72152
  if (options == null) {
72001
72153
  return true;
@@ -72045,17 +72197,11 @@ var DDiagramSnapshot = /** @class */ (function (_super) {
72045
72197
  }
72046
72198
  }
72047
72199
  // Refit & reflow
72048
- var refit = this.toCleanupRefit(options);
72049
72200
  var reflow = this.toCleanupReflow(options);
72050
- if (refit || reflow) {
72201
+ if (reflow) {
72051
72202
  var layer = DApplications.getLayer(canvas);
72052
72203
  if (layer) {
72053
- if (refit) {
72054
- layer.refit();
72055
- }
72056
- if (reflow) {
72057
- layer.reflow();
72058
- }
72204
+ layer.reflow();
72059
72205
  }
72060
72206
  }
72061
72207
  // Extracts
@@ -76183,12 +76329,12 @@ var DMenuSided = /** @class */ (function (_super) {
76183
76329
  DMenuSided.prototype.newSelection = function (options) {
76184
76330
  return new DMenuSidedSelection(this.content, options);
76185
76331
  };
76186
- DMenuSided.prototype.onChildrenDirty = function () {
76332
+ DMenuSided.prototype.onHierarchyDirty = function () {
76187
76333
  var selection = this._selection;
76188
76334
  if (selection != null) {
76189
76335
  selection.toDirty();
76190
76336
  }
76191
- _super.prototype.onChildrenDirty.call(this);
76337
+ _super.prototype.onHierarchyDirty.call(this);
76192
76338
  };
76193
76339
  DMenuSided.prototype.newItems = function (items, sticky) {
76194
76340
  DMenuSideds.newItems(this.content, items, sticky);