25 [DisallowMultipleComponent]
43 [Tooltip(
"Specifies whether or not this panel has a specific resolution, or whether this " +
44 "panel automatically changes its resolution based on its size")]
60 protected Vector2
_size =
new Vector2(0.1f, 0.1f);
65 [Tooltip(
"Uses sprite data to generate a nine sliced panel.")]
90 RectTransform rectTransform = GetComponent<RectTransform>();
91 if (rectTransform !=
null) {
92 _size = rectTransform.rect.size;
93 return rectTransform.rect;
120 return spriteData !=
null && spriteData.
sprite !=
null;
131 return UVChannelFlags.UV0;
142 return UVChannelFlags.UV0;
193 if (_sourceDataIndex < 0 || _sourceDataIndex >=
featureData.Count) {
228 #region Leap Mesh Graphic
235 Vector4 borderSize = Vector4.zero;
236 Vector4 borderUvs = Vector4.zero;
239 RectTransform rectTransform = GetComponent<RectTransform>();
240 if (rectTransform !=
null) {
241 rect = rectTransform.rect;
250 if (spriteData.sprite ==
null) {
256 var sprite = spriteData.sprite;
258 Vector4 border = sprite.border;
259 borderSize = border / sprite.pixelsPerUnit;
262 borderUvs.x /= sprite.textureRect.width;
263 borderUvs.z /= sprite.textureRect.width;
264 borderUvs.y /= sprite.textureRect.height;
265 borderUvs.w /= sprite.textureRect.height;
303 #region Mesh Data Support
328 protected float calculateVertAxis(
int vertIdx,
int vertCount,
float size,
float border0,
float border1,
bool alwaysRespectBorder =
false) {
333 else if (vertIdx == (vertCount - 1)) {
336 else if (vertIdx == 1) {
339 else if (vertIdx == (vertCount - 2)) {
340 return size - border1;
343 return ((vertIdx - 1.0f) / (vertCount - 3.0f)) * (size - border0 - border1) + border0;
347 return (vertIdx / (vertCount - 1.0f)) * size;
353 #region Supporting Types
357 VerticesPerRectilinearMeter
LeapGraphicFeatureBase feature
IList< LeapFeatureData > featureData
Returns a list of feature data attached to this graphic. If this graphic is attached to a group,...
FeatureDataList _featureData
This class is a base class for all graphics that can be represented by a mesh object.
Mesh mesh
Returns the mesh that represents this graphic. It can have any topology, any number of uv channels,...
UVChannelFlags remappableChannels
Returns an enum mask that represents the union of all channels that are allowed to be remapped for th...
The base class for LeapPanelGraphic, LeapBoxGraphic, and similar generators.
bool canNineSlice
Returns whether or not the current source supports nine slicing.
ResolutionType _resolutionType
float calculateVertAxis(int vertIdx, int vertCount, float size, float border0, float border1, bool alwaysRespectBorder=false)
Given a vertex index from an edge, the total vertCount and size along the current dimension,...
override void RefreshMeshData()
When this method is called, the mesh property and the remappableChannels property must be assigned to...
override void OnValidate()
LeapFeatureData sourceData
Returns the current feature data object being used as source.
abstract void RefreshSlicedMeshData(Vector2i resolution, RectMargins meshMargins, RectMargins uvMargins)
Set the mesh property equal to the correct mesh given the Sliced Graphic's current settings.
Rect rect
Returns the current local-space rect of this panel. If there is a RectTransform attached to this pane...
static bool IsValidDataSource(LeapFeatureData dataSource)
Returns whether or not a feature data object is a valid object that can be used to drive texture data...
void setSourceFeatureDirty()
UVChannelFlags uvChannel
Returns which uv channel is being used for this panel. It will always match the uv channel being used...
ResolutionType resolutionType
Returns the current resolution type being used for this panel.
bool nineSliced
Gets or sets whether or not this panel is currently using nine slicing.
Vector2 _resolution_verts_per_meter
void assignDefaultSourceValue()
int IndexOf(BaseType item)
RectMargins(float left, float top, float right, float bottom)
float bottom
Margin width from the bottom edge.
float top
Margin width from the top edge.
float right
Margin width from the right edge.
float left
Margin width from the left edge.