|
7 | 7 | using System.Xml; |
8 | 8 | using UnityEngine; |
9 | 9 | using Trackman; |
| 10 | +using UnityEngine.UIElements; |
10 | 11 |
|
11 | 12 | // ReSharper disable UnusedMember.Local |
12 | 13 | // ReSharper disable UnusedParameter.Local |
@@ -131,13 +132,6 @@ enum FontStyle |
131 | 132 | BoldAndItalic |
132 | 133 | } |
133 | 134 |
|
134 | | - enum ScaleMode |
135 | | - { |
136 | | - StretchToFill, |
137 | | - ScaleAndCrop, |
138 | | - ScaleToFit |
139 | | - } |
140 | | - |
141 | 135 | enum TextAlign |
142 | 136 | { |
143 | 137 | UpperLeft, |
@@ -588,7 +582,10 @@ struct CursorProperty |
588 | 582 | // Background |
589 | 583 | ColorProperty backgroundColor { get => Get("background-color"); set => Set("background-color", value); } |
590 | 584 | AssetProperty backgroundImage { get => Get("background-image"); set => Set("background-image", value); } |
591 | | - EnumProperty<ScaleMode> unityBackgroundScaleMode { get => Get("-unity-background-scale-mode"); set => Set("-unity-background-scale-mode", value); } |
| 585 | + EnumProperty<BackgroundPositionKeyword> unityBackgroundPositionX { get => Get("background-position-x"); set => Set("background-position-x", value); } |
| 586 | + EnumProperty<BackgroundPositionKeyword> unityBackgroundPositionY { get => Get("background-position-y"); set => Set("background-position-y", value); } |
| 587 | + EnumProperty<Repeat> unityBackgroundRepeat { get => Get("background-repeat"); set => Set("background-repeat", value); } |
| 588 | + EnumProperty<BackgroundSizeType> unityBackgroundSize { get => Get("background-size"); set => Set("background-size", value); } |
592 | 589 | ColorProperty unityBackgroundImageTintColor { get => Get("-unity-background-image-tint-color"); set => Set("-unity-background-image-tint-color", value); } |
593 | 590 | // Slicing |
594 | 591 | IntegerProperty unitySliceLeft { get => Get("-unity-slice-left"); set => Set("-unity-slice-left", value); } |
@@ -642,6 +639,9 @@ public UssStyle(string name) |
642 | 639 | unityFontDefinition = Unit.Initial; |
643 | 640 | justifyContent = JustifyContent.Center; |
644 | 641 | alignItems = Align.Center; |
| 642 | + unityBackgroundPositionX = BackgroundPositionKeyword.Center; |
| 643 | + unityBackgroundPositionY = BackgroundPositionKeyword.Center; |
| 644 | + unityBackgroundRepeat = Repeat.NoRepeat; |
645 | 645 | break; |
646 | 646 |
|
647 | 647 | case viewportClass: |
@@ -1408,12 +1408,12 @@ void AddFillStyle(IEnumerable<Paint> fills) |
1408 | 1408 |
|
1409 | 1409 | switch (image.scaleMode) |
1410 | 1410 | { |
1411 | | - case global.ScaleMode.FILL: |
1412 | | - unityBackgroundScaleMode = ScaleMode.ScaleAndCrop; |
| 1411 | + case ScaleMode.FILL: |
| 1412 | + unityBackgroundSize = BackgroundSizeType.Cover; |
1413 | 1413 | break; |
1414 | 1414 |
|
1415 | | - case global.ScaleMode.FIT: |
1416 | | - unityBackgroundScaleMode = ScaleMode.ScaleToFit; |
| 1415 | + case ScaleMode.FIT: |
| 1416 | + unityBackgroundSize = BackgroundSizeType.Contain; |
1417 | 1417 | break; |
1418 | 1418 | } |
1419 | 1419 | } |
|
0 commit comments