@galacean/engine-ui 1.6.0-alpha.1 → 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/browser.js CHANGED
@@ -560,14 +560,30 @@
560
560
  _proto._cloneTo = function _cloneTo(target, srcRoot, targetRoot) {
561
561
  // @ts-ignore
562
562
  Transform.prototype._cloneTo.call(this, target, srcRoot, targetRoot);
563
- target.size.copyFrom(this._size);
564
- target.pivot.copyFrom(this._pivot);
563
+ var size = target._size, pivot = target._pivot;
564
+ // @ts-ignore
565
+ size._onValueChanged = pivot._onValueChanged = null;
566
+ size.copyFrom(this._size);
567
+ pivot.copyFrom(this._pivot);
568
+ // @ts-ignore
569
+ size._onValueChanged = target._onSizeChanged;
570
+ // @ts-ignore
571
+ pivot._onValueChanged = target._onPivotChanged;
565
572
  };
566
573
  _proto._onLocalMatrixChanging = function _onLocalMatrixChanging() {
567
- this._updatePositionByAlignment();
574
+ // `super._onLocalMatrixChanging()` will set `LocalMatrix` dirty flag `false`
575
+ // If there is an alignment, `position` and `localMatrix` will be reset again
576
+ if (this._horizontalAlignment || this._verticalAlignment) {
577
+ this._updatePositionByAlignment();
578
+ this._setDirtyFlagTrue(engine.TransformModifyFlags.LocalMatrix);
579
+ } else {
580
+ Transform.prototype._onLocalMatrixChanging.call(this);
581
+ }
568
582
  };
569
- _proto._onWorldMatrixChange = function _onWorldMatrixChange() {
570
- !this._horizontalAlignment && !this._verticalAlignment && Transform.prototype._onWorldMatrixChange.call(this);
583
+ _proto._onWorldMatrixChanging = function _onWorldMatrixChanging() {
584
+ // `super._onWorldMatrixChanging()` will set `WorldMatrix` dirty flag `false`
585
+ // If there is an alignment, `position` and `worldMatrix` will be reset again(`worldMatrix` dirty flag is already `true`)
586
+ !this._horizontalAlignment && !this._verticalAlignment && Transform.prototype._onWorldMatrixChanging.call(this);
571
587
  };
572
588
  _proto._onPositionChanged = function _onPositionChanged() {
573
589
  (this._horizontalAlignment || this._verticalAlignment) && this._updatePositionByAlignment();
@@ -633,7 +649,7 @@
633
649
  size._onValueChanged = this._onSizeChanged;
634
650
  }
635
651
  };
636
- _proto._updateRectByPivot = function _updateRectByPivot() {
652
+ _proto._updateRectBySizeAndPivot = function _updateRectBySizeAndPivot() {
637
653
  var _this = this, size = _this.size, pivot = _this._pivot;
638
654
  var x = -pivot.x * size.x;
639
655
  var y = -pivot.y * size.y;
@@ -643,13 +659,13 @@
643
659
  if (this._horizontalAlignment === HorizontalAlignmentMode.LeftAndRight || this._verticalAlignment === VerticalAlignmentMode.TopAndBottom) {
644
660
  this._updateSizeByAlignment();
645
661
  }
646
- this._updateRectByPivot();
662
+ this._updateRectBySizeAndPivot();
647
663
  this._updateWorldFlagWithSelfRectChange();
648
664
  // @ts-ignore
649
665
  this._entity._updateFlagManager.dispatch(512);
650
666
  };
651
667
  _proto._onPivotChanged = function _onPivotChanged() {
652
- this._updateRectByPivot();
668
+ this._updateRectBySizeAndPivot();
653
669
  this._updateWorldFlagWithSelfRectChange();
654
670
  // @ts-ignore
655
671
  this._entity._updateFlagManager.dispatch(1024);
@@ -676,7 +692,7 @@
676
692
  if (horizontalAlignment || verticalAlignment) {
677
693
  if (horizontalAlignment === HorizontalAlignmentMode.LeftAndRight || verticalAlignment === VerticalAlignmentMode.TopAndBottom) {
678
694
  this._updateSizeByAlignment();
679
- this._updateRectByPivot();
695
+ this._updateRectBySizeAndPivot();
680
696
  selfChange = true;
681
697
  }
682
698
  this._updatePositionByAlignment();
@@ -899,13 +915,13 @@
899
915
  return UITransform;
900
916
  }(engine.Transform);
901
917
  __decorate([
902
- engine.deepClone
918
+ engine.ignoreClone
903
919
  ], UITransform.prototype, "_size", void 0);
904
920
  __decorate([
905
- engine.deepClone
921
+ engine.ignoreClone
906
922
  ], UITransform.prototype, "_pivot", void 0);
907
923
  __decorate([
908
- engine.ignoreClone
924
+ engine.deepClone
909
925
  ], UITransform.prototype, "_rect", void 0);
910
926
  __decorate([
911
927
  engine.ignoreClone
@@ -2701,6 +2717,7 @@
2701
2717
  };
2702
2718
  _proto._buildChunk = function _buildChunk(textChunk, count) {
2703
2719
  var _this_color = this.color, r = _this_color.r, g = _this_color.g, b = _this_color.b, a = _this_color.a;
2720
+ var finalAlpha = a * this._getGlobalAlpha();
2704
2721
  var tempIndices = engine.CharRenderInfo.triangles;
2705
2722
  var tempIndicesLength = tempIndices.length;
2706
2723
  var subChunk = textChunk.subChunk = this._getChunkManager().allocateSubChunk(count * 4);
@@ -2721,7 +2738,7 @@
2721
2738
  vertices[vo + 2] = r;
2722
2739
  vertices[vo + 3] = g;
2723
2740
  vertices[vo + 4] = b;
2724
- vertices[vo + 5] = a;
2741
+ vertices[vo + 5] = finalAlpha;
2725
2742
  }
2726
2743
  }
2727
2744
  return subChunk;