@galacean/engine-ui 1.5.13 → 1.6.0-alpha.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.
- package/dist/browser.js +343 -9
- package/dist/browser.js.map +1 -1
- package/dist/browser.min.js +1 -1
- package/dist/browser.min.js.map +1 -1
- package/dist/main.js +343 -9
- package/dist/main.js.map +1 -1
- package/dist/module.js +343 -11
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/component/UITransform.d.ts +92 -2
- package/types/enums/HorizontalAlignmentMode.d.ts +13 -0
- package/types/enums/VerticalAlignmentMode.d.ts +13 -0
- package/types/index.d.ts +2 -0
package/dist/module.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EntityModifyFlags, ignoreClone, assignmentClone, DisorderedArray, Component, Transform, deepClone, Vector2, Vector3, Matrix, Plane, ShaderProperty, dependentComponents, DependentMode, BatchUtils, ShaderMacroCollection, Renderer, Vector4, Color, RendererUpdateFlags, Entity, Script, Camera,
|
|
1
|
+
import { EntityModifyFlags, ignoreClone, assignmentClone, DisorderedArray, Component, TransformModifyFlags, Transform, deepClone, Vector2, Rect, MathUtil, Vector3, Matrix, Plane, ShaderProperty, dependentComponents, DependentMode, BatchUtils, ShaderMacroCollection, Renderer, Vector4, Color, RendererUpdateFlags, Entity, Script, Camera, CameraModifyFlags, Logger, SafeLoopArray, SpriteDrawMode, RenderQueueFlags, SpriteModifyFlags, SpriteTileMode, TiledSpriteAssembler, SlicedSpriteAssembler, SimpleSpriteAssembler, BoundingBox, ShaderData, ShaderDataGroup, TextUtils, Engine, TextVerticalAlignment, TextHorizontalAlignment, OverflowMode, CharRenderInfo, FontStyle, ReferResource, registerPointerEventEmitter, PointerEventEmitter, CameraClearFlags, ReflectionParser, Shader, ShaderPass, PipelineStage, Material, BlendFactor, BlendOperation, CullMode, RenderQueueType, Loader, Font } from '@galacean/engine';
|
|
2
2
|
|
|
3
3
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
4
4
|
try {
|
|
@@ -512,20 +512,46 @@ var Utils = /*#__PURE__*/ function() {
|
|
|
512
512
|
return ResolutionAdaptationMode;
|
|
513
513
|
}({});
|
|
514
514
|
|
|
515
|
+
/** Horizontal alignment mode. */ var HorizontalAlignmentMode = /*#__PURE__*/ function(HorizontalAlignmentMode) {
|
|
516
|
+
/** No horizontal alignment. */ HorizontalAlignmentMode[HorizontalAlignmentMode["None"] = 0] = "None";
|
|
517
|
+
/** Left-aligned, `alignLeft` drives `position.x`. */ HorizontalAlignmentMode[HorizontalAlignmentMode["Left"] = 1] = "Left";
|
|
518
|
+
/** Right-aligned, `alignRight` drives `position.x`. */ HorizontalAlignmentMode[HorizontalAlignmentMode["Right"] = 2] = "Right";
|
|
519
|
+
/** Horizontal stretch, `alignLeft` and `alignRight` drive `position.x` and `size.x`. */ HorizontalAlignmentMode[HorizontalAlignmentMode["LeftAndRight"] = 3] = "LeftAndRight";
|
|
520
|
+
/** Center-aligned, `alignCenter` drives `position.x`. */ HorizontalAlignmentMode[HorizontalAlignmentMode["Center"] = 4] = "Center";
|
|
521
|
+
return HorizontalAlignmentMode;
|
|
522
|
+
}({});
|
|
523
|
+
|
|
524
|
+
/** Vertical alignment mode. */ var VerticalAlignmentMode = /*#__PURE__*/ function(VerticalAlignmentMode) {
|
|
525
|
+
/** No vertical alignment. */ VerticalAlignmentMode[VerticalAlignmentMode["None"] = 0] = "None";
|
|
526
|
+
/** Top-aligned, `alignTop` drives `position.y`. */ VerticalAlignmentMode[VerticalAlignmentMode["Top"] = 1] = "Top";
|
|
527
|
+
/** Bottom-aligned, `alignBottom` drives `position.y`. */ VerticalAlignmentMode[VerticalAlignmentMode["Bottom"] = 2] = "Bottom";
|
|
528
|
+
/** Vertical stretch, `alignTop` and `alignBottom` drive `position.y` and `size.y`. */ VerticalAlignmentMode[VerticalAlignmentMode["TopAndBottom"] = 3] = "TopAndBottom";
|
|
529
|
+
/** Middle-aligned, `alignMiddle` drives `position.y`. */ VerticalAlignmentMode[VerticalAlignmentMode["Middle"] = 4] = "Middle";
|
|
530
|
+
return VerticalAlignmentMode;
|
|
531
|
+
}({});
|
|
532
|
+
|
|
515
533
|
/**
|
|
516
534
|
* The Transform component exclusive to the UI element.
|
|
517
535
|
*/ var UITransform = /*#__PURE__*/ function(Transform) {
|
|
518
536
|
_inherits(UITransform, Transform);
|
|
519
537
|
function UITransform(entity) {
|
|
520
538
|
var _this;
|
|
521
|
-
_this = Transform.call(this, entity) || this, _this._size = new Vector2(100, 100), _this._pivot = new Vector2(0.5, 0.5);
|
|
539
|
+
_this = Transform.call(this, entity) || this, _this._size = new Vector2(100, 100), _this._pivot = new Vector2(0.5, 0.5), _this._rect = new Rect(-50, -50, 100, 100), _this._alignLeft = 0, _this._alignRight = 0, _this._alignCenter = 0, _this._alignTop = 0, _this._alignBottom = 0, _this._alignMiddle = 0, _this._horizontalAlignment = HorizontalAlignmentMode.None, _this._verticalAlignment = VerticalAlignmentMode.None;
|
|
540
|
+
_this._onSizeChanged = _this._onSizeChanged.bind(_this);
|
|
541
|
+
_this._onPivotChanged = _this._onPivotChanged.bind(_this);
|
|
522
542
|
// @ts-ignore
|
|
523
|
-
_this._size._onValueChanged = _this.
|
|
543
|
+
_this._size._onValueChanged = _this._onSizeChanged;
|
|
524
544
|
// @ts-ignore
|
|
525
|
-
_this._pivot._onValueChanged = _this.
|
|
545
|
+
_this._pivot._onValueChanged = _this._onPivotChanged;
|
|
526
546
|
return _this;
|
|
527
547
|
}
|
|
528
548
|
var _proto = UITransform.prototype;
|
|
549
|
+
/**
|
|
550
|
+
* @internal
|
|
551
|
+
*/ _proto._parentChange = function _parentChange() {
|
|
552
|
+
this._isParentDirty = true;
|
|
553
|
+
this._updateWorldFlagWithParentRectChange(TransformModifyFlags.WmWpWeWqWsWus);
|
|
554
|
+
};
|
|
529
555
|
// @ts-ignore
|
|
530
556
|
_proto._cloneTo = function _cloneTo(target, srcRoot, targetRoot) {
|
|
531
557
|
// @ts-ignore
|
|
@@ -533,14 +559,139 @@ var Utils = /*#__PURE__*/ function() {
|
|
|
533
559
|
target.size.copyFrom(this._size);
|
|
534
560
|
target.pivot.copyFrom(this._pivot);
|
|
535
561
|
};
|
|
536
|
-
_proto.
|
|
562
|
+
_proto._onLocalMatrixChanging = function _onLocalMatrixChanging() {
|
|
563
|
+
this._updatePositionByAlignment();
|
|
564
|
+
};
|
|
565
|
+
_proto._onWorldMatrixChange = function _onWorldMatrixChange() {
|
|
566
|
+
!this._horizontalAlignment && !this._verticalAlignment && Transform.prototype._onWorldMatrixChange.call(this);
|
|
567
|
+
};
|
|
568
|
+
_proto._onPositionChanged = function _onPositionChanged() {
|
|
569
|
+
(this._horizontalAlignment || this._verticalAlignment) && this._updatePositionByAlignment();
|
|
570
|
+
Transform.prototype._onPositionChanged.call(this);
|
|
571
|
+
};
|
|
572
|
+
_proto._onWorldPositionChanged = function _onWorldPositionChanged() {
|
|
573
|
+
Transform.prototype._onWorldPositionChanged.call(this);
|
|
574
|
+
if (this._horizontalAlignment || this._verticalAlignment) {
|
|
575
|
+
this._setDirtyFlagTrue(TransformModifyFlags.WorldPosition);
|
|
576
|
+
}
|
|
577
|
+
};
|
|
578
|
+
_proto._updatePositionByAlignment = function _updatePositionByAlignment() {
|
|
579
|
+
var _this__getParentTransform;
|
|
580
|
+
var parentRect = (_this__getParentTransform = this._getParentTransform()) == null ? void 0 : _this__getParentTransform._rect;
|
|
581
|
+
if (parentRect) {
|
|
582
|
+
var position = this.position;
|
|
583
|
+
// @ts-ignore
|
|
584
|
+
position._onValueChanged = null;
|
|
585
|
+
var rect = this._rect;
|
|
586
|
+
switch(this._horizontalAlignment){
|
|
587
|
+
case HorizontalAlignmentMode.Left:
|
|
588
|
+
case HorizontalAlignmentMode.LeftAndRight:
|
|
589
|
+
position.x = parentRect.x - rect.x + this._alignLeft;
|
|
590
|
+
break;
|
|
591
|
+
case HorizontalAlignmentMode.Center:
|
|
592
|
+
position.x = parentRect.x + parentRect.width * 0.5 - rect.x - rect.width * 0.5 + this._alignCenter;
|
|
593
|
+
break;
|
|
594
|
+
case HorizontalAlignmentMode.Right:
|
|
595
|
+
position.x = parentRect.x + parentRect.width - rect.x - rect.width - this._alignRight;
|
|
596
|
+
break;
|
|
597
|
+
}
|
|
598
|
+
switch(this._verticalAlignment){
|
|
599
|
+
case VerticalAlignmentMode.Top:
|
|
600
|
+
position.y = parentRect.y + parentRect.height - rect.y - rect.height - this._alignTop;
|
|
601
|
+
break;
|
|
602
|
+
case VerticalAlignmentMode.Middle:
|
|
603
|
+
position.y = parentRect.y + parentRect.height * 0.5 - rect.y - rect.height * 0.5 + this._alignMiddle;
|
|
604
|
+
break;
|
|
605
|
+
case VerticalAlignmentMode.Bottom:
|
|
606
|
+
case VerticalAlignmentMode.TopAndBottom:
|
|
607
|
+
position.y = parentRect.y - rect.y + this._alignBottom;
|
|
608
|
+
break;
|
|
609
|
+
}
|
|
610
|
+
// @ts-ignore
|
|
611
|
+
position._onValueChanged = this._onPositionChanged;
|
|
612
|
+
}
|
|
613
|
+
};
|
|
614
|
+
_proto._updateSizeByAlignment = function _updateSizeByAlignment() {
|
|
615
|
+
var _this__getParentTransform;
|
|
616
|
+
var parentRect = (_this__getParentTransform = this._getParentTransform()) == null ? void 0 : _this__getParentTransform._rect;
|
|
617
|
+
if (parentRect) {
|
|
618
|
+
var size = this._size;
|
|
619
|
+
// @ts-ignore
|
|
620
|
+
size._onValueChanged = null;
|
|
621
|
+
// The values of size must be greater than 0
|
|
622
|
+
if (this._horizontalAlignment === HorizontalAlignmentMode.LeftAndRight) {
|
|
623
|
+
size.x = Math.max(parentRect.width - this._alignLeft - this._alignRight, 0);
|
|
624
|
+
}
|
|
625
|
+
if (this._verticalAlignment === VerticalAlignmentMode.TopAndBottom) {
|
|
626
|
+
size.y = Math.max(parentRect.height - this._alignTop - this._alignBottom, 0);
|
|
627
|
+
}
|
|
628
|
+
// @ts-ignore
|
|
629
|
+
size._onValueChanged = this._onSizeChanged;
|
|
630
|
+
}
|
|
631
|
+
};
|
|
632
|
+
_proto._updateRectByPivot = function _updateRectByPivot() {
|
|
633
|
+
var _this = this, size = _this.size, pivot = _this._pivot;
|
|
634
|
+
var x = -pivot.x * size.x;
|
|
635
|
+
var y = -pivot.y * size.y;
|
|
636
|
+
this._rect.set(x, y, size.x, size.y);
|
|
637
|
+
};
|
|
638
|
+
_proto._onSizeChanged = function _onSizeChanged() {
|
|
639
|
+
if (this._horizontalAlignment === HorizontalAlignmentMode.LeftAndRight || this._verticalAlignment === VerticalAlignmentMode.TopAndBottom) {
|
|
640
|
+
this._updateSizeByAlignment();
|
|
641
|
+
}
|
|
642
|
+
this._updateRectByPivot();
|
|
643
|
+
this._updateWorldFlagWithSelfRectChange();
|
|
537
644
|
// @ts-ignore
|
|
538
645
|
this._entity._updateFlagManager.dispatch(512);
|
|
539
646
|
};
|
|
540
|
-
_proto.
|
|
647
|
+
_proto._onPivotChanged = function _onPivotChanged() {
|
|
648
|
+
this._updateRectByPivot();
|
|
649
|
+
this._updateWorldFlagWithSelfRectChange();
|
|
541
650
|
// @ts-ignore
|
|
542
651
|
this._entity._updateFlagManager.dispatch(1024);
|
|
543
652
|
};
|
|
653
|
+
_proto._updateWorldFlagWithSelfRectChange = function _updateWorldFlagWithSelfRectChange() {
|
|
654
|
+
var worldFlags = 0;
|
|
655
|
+
if (this._horizontalAlignment || this._verticalAlignment) {
|
|
656
|
+
this._updatePositionByAlignment();
|
|
657
|
+
this._setDirtyFlagTrue(TransformModifyFlags.LocalMatrix);
|
|
658
|
+
worldFlags = TransformModifyFlags.WmWp;
|
|
659
|
+
!this._isContainDirtyFlags(worldFlags) && this._worldAssociatedChange(worldFlags);
|
|
660
|
+
}
|
|
661
|
+
var children = this.entity.children;
|
|
662
|
+
for(var i = 0, n = children.length; i < n; i++){
|
|
663
|
+
var _children_i_transform__updateWorldFlagWithParentRectChange, _children_i_transform;
|
|
664
|
+
(_children_i_transform = children[i].transform) == null ? void 0 : (_children_i_transform__updateWorldFlagWithParentRectChange = _children_i_transform._updateWorldFlagWithParentRectChange) == null ? void 0 : _children_i_transform__updateWorldFlagWithParentRectChange.call(_children_i_transform, worldFlags);
|
|
665
|
+
}
|
|
666
|
+
};
|
|
667
|
+
_proto._updateWorldFlagWithParentRectChange = function _updateWorldFlagWithParentRectChange(flags, parentChange) {
|
|
668
|
+
if (parentChange === void 0) parentChange = true;
|
|
669
|
+
var selfChange = false;
|
|
670
|
+
if (parentChange) {
|
|
671
|
+
var _this = this, horizontalAlignment = _this._horizontalAlignment, verticalAlignment = _this._verticalAlignment;
|
|
672
|
+
if (horizontalAlignment || verticalAlignment) {
|
|
673
|
+
if (horizontalAlignment === HorizontalAlignmentMode.LeftAndRight || verticalAlignment === VerticalAlignmentMode.TopAndBottom) {
|
|
674
|
+
this._updateSizeByAlignment();
|
|
675
|
+
this._updateRectByPivot();
|
|
676
|
+
selfChange = true;
|
|
677
|
+
}
|
|
678
|
+
this._updatePositionByAlignment();
|
|
679
|
+
this._setDirtyFlagTrue(TransformModifyFlags.LocalMatrix);
|
|
680
|
+
flags |= TransformModifyFlags.WmWp;
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
var containDirtyFlags = this._isContainDirtyFlags(flags);
|
|
684
|
+
!containDirtyFlags && this._worldAssociatedChange(flags);
|
|
685
|
+
if (selfChange || !containDirtyFlags) {
|
|
686
|
+
var children = this.entity.children;
|
|
687
|
+
for(var i = 0, n = children.length; i < n; i++){
|
|
688
|
+
var _children_i_transform__updateWorldFlagWithParentRectChange, _children_i_transform;
|
|
689
|
+
(_children_i_transform = children[i].transform) == null ? void 0 : (_children_i_transform__updateWorldFlagWithParentRectChange = _children_i_transform._updateWorldFlagWithParentRectChange) == null ? void 0 : _children_i_transform__updateWorldFlagWithParentRectChange.call(_children_i_transform, flags, selfChange);
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
// @ts-ignore
|
|
693
|
+
selfChange && this._entity._updateFlagManager.dispatch(512);
|
|
694
|
+
};
|
|
544
695
|
_create_class(UITransform, [
|
|
545
696
|
{
|
|
546
697
|
key: "size",
|
|
@@ -567,6 +718,178 @@ var Utils = /*#__PURE__*/ function() {
|
|
|
567
718
|
if (pivot === value) return;
|
|
568
719
|
(pivot.x !== value.x || pivot.y !== value.y) && pivot.copyFrom(value);
|
|
569
720
|
}
|
|
721
|
+
},
|
|
722
|
+
{
|
|
723
|
+
key: "horizontalAlignment",
|
|
724
|
+
get: /**
|
|
725
|
+
* Horizontal alignment mode.
|
|
726
|
+
*
|
|
727
|
+
* @remarks
|
|
728
|
+
* Controls how the element aligns horizontally within its parent:
|
|
729
|
+
* - `Left` - Align to parent's left edge
|
|
730
|
+
* - `Center` - Align to parent's horizontal center
|
|
731
|
+
* - `Right` - Align to parent's right edge
|
|
732
|
+
* - `LeftAndRight` - Align to both left and right edges (stretch to fill width)
|
|
733
|
+
*/ function get() {
|
|
734
|
+
return this._horizontalAlignment;
|
|
735
|
+
},
|
|
736
|
+
set: function set(value) {
|
|
737
|
+
if (this._horizontalAlignment === value) return;
|
|
738
|
+
this._horizontalAlignment = value;
|
|
739
|
+
switch(value){
|
|
740
|
+
case HorizontalAlignmentMode.Left:
|
|
741
|
+
case HorizontalAlignmentMode.Right:
|
|
742
|
+
case HorizontalAlignmentMode.Center:
|
|
743
|
+
this._onPositionChanged();
|
|
744
|
+
break;
|
|
745
|
+
case HorizontalAlignmentMode.LeftAndRight:
|
|
746
|
+
this._onPositionChanged();
|
|
747
|
+
this._onSizeChanged();
|
|
748
|
+
break;
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
},
|
|
752
|
+
{
|
|
753
|
+
key: "alignLeft",
|
|
754
|
+
get: /**
|
|
755
|
+
* Left margin when horizontalAlignment is Left or LeftAndRight.
|
|
756
|
+
*
|
|
757
|
+
* @remarks
|
|
758
|
+
* Only effective when horizontalAlignment includes Left mode.
|
|
759
|
+
* Distance from the parent's left edge to the element's left edge.
|
|
760
|
+
*/ function get() {
|
|
761
|
+
return this._alignLeft;
|
|
762
|
+
},
|
|
763
|
+
set: function set(value) {
|
|
764
|
+
if (!Number.isFinite(value)) return;
|
|
765
|
+
if (MathUtil.equals(value, this._alignLeft)) return;
|
|
766
|
+
this._alignLeft = value;
|
|
767
|
+
if (this._horizontalAlignment & HorizontalAlignmentMode.Left) {
|
|
768
|
+
this._onPositionChanged();
|
|
769
|
+
this._horizontalAlignment & HorizontalAlignmentMode.Right && this._onSizeChanged();
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
},
|
|
773
|
+
{
|
|
774
|
+
key: "alignRight",
|
|
775
|
+
get: /**
|
|
776
|
+
* Right margin when horizontalAlignment is Right or LeftAndRight.
|
|
777
|
+
*
|
|
778
|
+
* @remarks
|
|
779
|
+
* Only effective when horizontalAlignment includes Right mode.
|
|
780
|
+
* Distance from the parent's right edge to the element's right edge.
|
|
781
|
+
*/ function get() {
|
|
782
|
+
return this._alignRight;
|
|
783
|
+
},
|
|
784
|
+
set: function set(value) {
|
|
785
|
+
if (!Number.isFinite(value)) return;
|
|
786
|
+
if (MathUtil.equals(value, this._alignRight)) return;
|
|
787
|
+
this._alignRight = value;
|
|
788
|
+
if (this._horizontalAlignment & HorizontalAlignmentMode.Right) {
|
|
789
|
+
this._onPositionChanged();
|
|
790
|
+
this._horizontalAlignment & HorizontalAlignmentMode.Left && this._onSizeChanged();
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
},
|
|
794
|
+
{
|
|
795
|
+
key: "alignCenter",
|
|
796
|
+
get: /**
|
|
797
|
+
* Horizontal center offset when horizontalAlignment is Center.
|
|
798
|
+
*
|
|
799
|
+
* @remarks
|
|
800
|
+
* Only effective when horizontalAlignment is Center mode.
|
|
801
|
+
* Positive values move the element to the right, negative values to the left.
|
|
802
|
+
*/ function get() {
|
|
803
|
+
return this._alignCenter;
|
|
804
|
+
},
|
|
805
|
+
set: function set(value) {
|
|
806
|
+
if (!Number.isFinite(value)) return;
|
|
807
|
+
if (MathUtil.equals(value, this._alignCenter)) return;
|
|
808
|
+
this._alignCenter = value;
|
|
809
|
+
this._horizontalAlignment & HorizontalAlignmentMode.Center && this._onPositionChanged();
|
|
810
|
+
}
|
|
811
|
+
},
|
|
812
|
+
{
|
|
813
|
+
key: "verticalAlignment",
|
|
814
|
+
get: /**
|
|
815
|
+
* Vertical alignment mode.
|
|
816
|
+
*
|
|
817
|
+
* @remarks
|
|
818
|
+
* Controls how the element aligns vertically within its parent:
|
|
819
|
+
* - `Top` - Align to parent's top edge
|
|
820
|
+
* - `Middle` - Align to parent's vertical center
|
|
821
|
+
* - `Bottom` - Align to parent's bottom edge
|
|
822
|
+
* - `TopAndBottom` - Align to both top and bottom edges (stretch to fill height)
|
|
823
|
+
*/ function get() {
|
|
824
|
+
return this._verticalAlignment;
|
|
825
|
+
},
|
|
826
|
+
set: function set(value) {
|
|
827
|
+
if (this._verticalAlignment === value) return;
|
|
828
|
+
this._verticalAlignment = value;
|
|
829
|
+
switch(value){
|
|
830
|
+
case VerticalAlignmentMode.Top:
|
|
831
|
+
case VerticalAlignmentMode.Bottom:
|
|
832
|
+
case VerticalAlignmentMode.Middle:
|
|
833
|
+
this._onPositionChanged();
|
|
834
|
+
break;
|
|
835
|
+
case VerticalAlignmentMode.TopAndBottom:
|
|
836
|
+
this._onPositionChanged();
|
|
837
|
+
this._onSizeChanged();
|
|
838
|
+
break;
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
},
|
|
842
|
+
{
|
|
843
|
+
key: "alignTop",
|
|
844
|
+
get: /**
|
|
845
|
+
* Top margin when verticalAlignment is Top or TopAndBottom.
|
|
846
|
+
*
|
|
847
|
+
* @remarks
|
|
848
|
+
* Only effective when verticalAlignment includes Top mode.
|
|
849
|
+
* Used to offset the element from the parent's top edge.
|
|
850
|
+
*/ function get() {
|
|
851
|
+
return this._alignTop;
|
|
852
|
+
},
|
|
853
|
+
set: function set(value) {
|
|
854
|
+
if (!Number.isFinite(value)) return;
|
|
855
|
+
if (MathUtil.equals(value, this._alignTop)) return;
|
|
856
|
+
this._alignTop = value;
|
|
857
|
+
if (this._verticalAlignment & VerticalAlignmentMode.Top) {
|
|
858
|
+
this._onPositionChanged();
|
|
859
|
+
this._verticalAlignment & VerticalAlignmentMode.Bottom && this._onSizeChanged();
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
},
|
|
863
|
+
{
|
|
864
|
+
key: "alignBottom",
|
|
865
|
+
get: /**
|
|
866
|
+
* Bottom inset used in vertical alignment formulas.
|
|
867
|
+
*/ function get() {
|
|
868
|
+
return this._alignBottom;
|
|
869
|
+
},
|
|
870
|
+
set: function set(value) {
|
|
871
|
+
if (!Number.isFinite(value)) return;
|
|
872
|
+
if (MathUtil.equals(value, this._alignBottom)) return;
|
|
873
|
+
this._alignBottom = value;
|
|
874
|
+
if (this._verticalAlignment & VerticalAlignmentMode.Bottom) {
|
|
875
|
+
this._onPositionChanged();
|
|
876
|
+
this._verticalAlignment & VerticalAlignmentMode.Top && this._onSizeChanged();
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
},
|
|
880
|
+
{
|
|
881
|
+
key: "alignMiddle",
|
|
882
|
+
get: /**
|
|
883
|
+
* Vertical middle offset relative to parent's middle.
|
|
884
|
+
*/ function get() {
|
|
885
|
+
return this._alignMiddle;
|
|
886
|
+
},
|
|
887
|
+
set: function set(value) {
|
|
888
|
+
if (!Number.isFinite(value)) return;
|
|
889
|
+
if (MathUtil.equals(value, this._alignMiddle)) return;
|
|
890
|
+
this._alignMiddle = value;
|
|
891
|
+
this._verticalAlignment & VerticalAlignmentMode.Middle && this._onPositionChanged();
|
|
892
|
+
}
|
|
570
893
|
}
|
|
571
894
|
]);
|
|
572
895
|
return UITransform;
|
|
@@ -579,16 +902,25 @@ __decorate([
|
|
|
579
902
|
], UITransform.prototype, "_pivot", void 0);
|
|
580
903
|
__decorate([
|
|
581
904
|
ignoreClone
|
|
582
|
-
], UITransform.prototype, "
|
|
905
|
+
], UITransform.prototype, "_rect", void 0);
|
|
906
|
+
__decorate([
|
|
907
|
+
ignoreClone
|
|
908
|
+
], UITransform.prototype, "_onPositionChanged", null);
|
|
909
|
+
__decorate([
|
|
910
|
+
ignoreClone
|
|
911
|
+
], UITransform.prototype, "_onWorldPositionChanged", null);
|
|
912
|
+
__decorate([
|
|
913
|
+
ignoreClone
|
|
914
|
+
], UITransform.prototype, "_onSizeChanged", null);
|
|
583
915
|
__decorate([
|
|
584
916
|
ignoreClone
|
|
585
|
-
], UITransform.prototype, "
|
|
917
|
+
], UITransform.prototype, "_onPivotChanged", null);
|
|
586
918
|
/**
|
|
587
919
|
* @internal
|
|
588
920
|
* extends TransformModifyFlags
|
|
589
921
|
*/ var UITransformModifyFlags = /*#__PURE__*/ function(UITransformModifyFlags) {
|
|
590
|
-
|
|
591
|
-
|
|
922
|
+
UITransformModifyFlags[UITransformModifyFlags["Size"] = 512] = "Size";
|
|
923
|
+
UITransformModifyFlags[UITransformModifyFlags["Pivot"] = 1024] = "Pivot";
|
|
592
924
|
return UITransformModifyFlags;
|
|
593
925
|
}({});
|
|
594
926
|
|
|
@@ -3279,5 +3611,5 @@ ReflectionParser.registerCustomParseComponent("Text", /*#__PURE__*/ _async_to_ge
|
|
|
3279
3611
|
}
|
|
3280
3612
|
}
|
|
3281
3613
|
|
|
3282
|
-
export { Button, CanvasRenderMode, ColorTransition, EngineExtension, EntityExtension, Image, ResolutionAdaptationMode, ScaleTransition, SpriteTransition, Text, Transition, UICanvas, UIGroup, UIPointerEventEmitter, UIRenderer, UITransform, registerGUI };
|
|
3614
|
+
export { Button, CanvasRenderMode, ColorTransition, EngineExtension, EntityExtension, HorizontalAlignmentMode, Image, ResolutionAdaptationMode, ScaleTransition, SpriteTransition, Text, Transition, UICanvas, UIGroup, UIPointerEventEmitter, UIRenderer, UITransform, VerticalAlignmentMode, registerGUI };
|
|
3283
3615
|
//# sourceMappingURL=module.js.map
|