@galacean/engine-ui 1.6.0-alpha.0 → 1.6.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.js CHANGED
@@ -556,14 +556,30 @@ var Utils = /*#__PURE__*/ function() {
556
556
  _proto._cloneTo = function _cloneTo(target, srcRoot, targetRoot) {
557
557
  // @ts-ignore
558
558
  Transform.prototype._cloneTo.call(this, target, srcRoot, targetRoot);
559
- target.size.copyFrom(this._size);
560
- target.pivot.copyFrom(this._pivot);
559
+ var size = target._size, pivot = target._pivot;
560
+ // @ts-ignore
561
+ size._onValueChanged = pivot._onValueChanged = null;
562
+ size.copyFrom(this._size);
563
+ pivot.copyFrom(this._pivot);
564
+ // @ts-ignore
565
+ size._onValueChanged = target._onSizeChanged;
566
+ // @ts-ignore
567
+ pivot._onValueChanged = target._onPivotChanged;
561
568
  };
562
569
  _proto._onLocalMatrixChanging = function _onLocalMatrixChanging() {
563
- this._updatePositionByAlignment();
570
+ // `super._onLocalMatrixChanging()` will set `LocalMatrix` dirty flag `false`
571
+ // If there is an alignment, `position` and `localMatrix` will be reset again
572
+ if (this._horizontalAlignment || this._verticalAlignment) {
573
+ this._updatePositionByAlignment();
574
+ this._setDirtyFlagTrue(TransformModifyFlags.LocalMatrix);
575
+ } else {
576
+ Transform.prototype._onLocalMatrixChanging.call(this);
577
+ }
564
578
  };
565
- _proto._onWorldMatrixChange = function _onWorldMatrixChange() {
566
- !this._horizontalAlignment && !this._verticalAlignment && Transform.prototype._onWorldMatrixChange.call(this);
579
+ _proto._onWorldMatrixChanging = function _onWorldMatrixChanging() {
580
+ // `super._onWorldMatrixChanging()` will set `WorldMatrix` dirty flag `false`
581
+ // If there is an alignment, `position` and `worldMatrix` will be reset again(`worldMatrix` dirty flag is already `true`)
582
+ !this._horizontalAlignment && !this._verticalAlignment && Transform.prototype._onWorldMatrixChanging.call(this);
567
583
  };
568
584
  _proto._onPositionChanged = function _onPositionChanged() {
569
585
  (this._horizontalAlignment || this._verticalAlignment) && this._updatePositionByAlignment();
@@ -629,7 +645,7 @@ var Utils = /*#__PURE__*/ function() {
629
645
  size._onValueChanged = this._onSizeChanged;
630
646
  }
631
647
  };
632
- _proto._updateRectByPivot = function _updateRectByPivot() {
648
+ _proto._updateRectBySizeAndPivot = function _updateRectBySizeAndPivot() {
633
649
  var _this = this, size = _this.size, pivot = _this._pivot;
634
650
  var x = -pivot.x * size.x;
635
651
  var y = -pivot.y * size.y;
@@ -639,13 +655,13 @@ var Utils = /*#__PURE__*/ function() {
639
655
  if (this._horizontalAlignment === HorizontalAlignmentMode.LeftAndRight || this._verticalAlignment === VerticalAlignmentMode.TopAndBottom) {
640
656
  this._updateSizeByAlignment();
641
657
  }
642
- this._updateRectByPivot();
658
+ this._updateRectBySizeAndPivot();
643
659
  this._updateWorldFlagWithSelfRectChange();
644
660
  // @ts-ignore
645
661
  this._entity._updateFlagManager.dispatch(512);
646
662
  };
647
663
  _proto._onPivotChanged = function _onPivotChanged() {
648
- this._updateRectByPivot();
664
+ this._updateRectBySizeAndPivot();
649
665
  this._updateWorldFlagWithSelfRectChange();
650
666
  // @ts-ignore
651
667
  this._entity._updateFlagManager.dispatch(1024);
@@ -672,7 +688,7 @@ var Utils = /*#__PURE__*/ function() {
672
688
  if (horizontalAlignment || verticalAlignment) {
673
689
  if (horizontalAlignment === HorizontalAlignmentMode.LeftAndRight || verticalAlignment === VerticalAlignmentMode.TopAndBottom) {
674
690
  this._updateSizeByAlignment();
675
- this._updateRectByPivot();
691
+ this._updateRectBySizeAndPivot();
676
692
  selfChange = true;
677
693
  }
678
694
  this._updatePositionByAlignment();
@@ -895,13 +911,13 @@ var Utils = /*#__PURE__*/ function() {
895
911
  return UITransform;
896
912
  }(Transform);
897
913
  __decorate([
898
- deepClone
914
+ ignoreClone
899
915
  ], UITransform.prototype, "_size", void 0);
900
916
  __decorate([
901
- deepClone
917
+ ignoreClone
902
918
  ], UITransform.prototype, "_pivot", void 0);
903
919
  __decorate([
904
- ignoreClone
920
+ deepClone
905
921
  ], UITransform.prototype, "_rect", void 0);
906
922
  __decorate([
907
923
  ignoreClone
@@ -2697,6 +2713,7 @@ __decorate([
2697
2713
  };
2698
2714
  _proto._buildChunk = function _buildChunk(textChunk, count) {
2699
2715
  var _this_color = this.color, r = _this_color.r, g = _this_color.g, b = _this_color.b, a = _this_color.a;
2716
+ var finalAlpha = a * this._getGlobalAlpha();
2700
2717
  var tempIndices = CharRenderInfo.triangles;
2701
2718
  var tempIndicesLength = tempIndices.length;
2702
2719
  var subChunk = textChunk.subChunk = this._getChunkManager().allocateSubChunk(count * 4);
@@ -2717,7 +2734,7 @@ __decorate([
2717
2734
  vertices[vo + 2] = r;
2718
2735
  vertices[vo + 3] = g;
2719
2736
  vertices[vo + 4] = b;
2720
- vertices[vo + 5] = a;
2737
+ vertices[vo + 5] = finalAlpha;
2721
2738
  }
2722
2739
  }
2723
2740
  return subChunk;