Ejemplo n.º 1
0
        public override bool OnAttributeChange(string property)
        {
            // Note that base handles width, height, x, y etc.

            if (property == "viewbox")
            {
                // SVG viewbox
                Viewbox = ValueHelpers.GetViewbox(this["viewbox"]);
            }
            else if (property == "overflow")
            {
                // Overflow
                Overflow = ValueHelpers.GetOverflow(this["overflow"]);
            }
            else if (property == "preserveaspectratio")
            {
                // Aspect ratio
                AspectRatio = new AspectRatio(this["preserveaspectratio"]);
            }
            else if (!base.OnAttributeChange(property))
            {
                return(false);
            }


            return(true);
        }
Ejemplo n.º 2
0
        public void Read(AssetStream stream)
        {
            StyleName = stream.ReadStringAligned();
            Normal.Read(stream);
            Hover.Read(stream);
            Active.Read(stream);
            Focused.Read(stream);
            OnNormal.Read(stream);
            OnHover.Read(stream);
            OnActive.Read(stream);
            OnFocused.Read(stream);
            Border.Read(stream);
            Margin.Read(stream);
            Padding.Read(stream);
            Overflow.Read(stream);
            Font.Read(stream);
            FontSize  = stream.ReadInt32();
            FontStyle = stream.ReadInt32();
            Alignment = stream.ReadInt32();
            WordWrap  = stream.ReadBoolean();
            RichText  = stream.ReadBoolean();
            stream.AlignStream(AlignType.Align4);

            TextClipping  = stream.ReadInt32();
            ImagePosition = stream.ReadInt32();
            ContentOffset.Read(stream);
            FixedWidth    = stream.ReadSingle();
            FixedHeight   = stream.ReadSingle();
            StretchWidth  = stream.ReadBoolean();
            StretchHeight = stream.ReadBoolean();
            stream.AlignStream(AlignType.Align4);
        }
Ejemplo n.º 3
0
        public static void SetOverflow(this VisualElement self, Overflow v)
        {
            var c = self.style.overflow;

            c.value             = v;
            self.style.overflow = c;
        }
Ejemplo n.º 4
0
 public void EndBatch(IReadOnlyList <T> batch, Overflow overflow)
 {
     ThrowIfNotBatchable();
     _batch    = batch;
     _overflow = overflow;
     _hasMore  = true;
 }
Ejemplo n.º 5
0
 private void OnValueChanged(Vector2 vector)
 {
     if (scroll.horizontal)
     {
         if (vector.x > 1 && -content.anchoredPosition.x + viewport.rect.width - space > content.rect.width)
         {
             overflow = Overflow.Forward;
         }
         else if (vector.x < 0 && -content.anchoredPosition.x + space < 0)
         {
             overflow = Overflow.Back;
         }
         else
         {
             overflow = Overflow.None; timer = 0;
         }
     }
     else
     {
         if (vector.y < 0 && content.anchoredPosition.y + viewport.rect.height - space > content.rect.height)
         {
             overflow = Overflow.Forward;
         }
         else if (vector.y > 1 && content.anchoredPosition.y + space < 0)
         {
             overflow = Overflow.Back;
         }
         else
         {
             overflow = Overflow.None; timer = 0;
         }
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Gets all the remaining items that haven't been previously consumed.
        /// </summary>
        /// <returns>The remaining items.</returns>
        public IEnumerable <T> GetRemainingItems()
        {
            if (_overflow != null)
            {
                yield return(_overflow.Item);

                _overflow = null;
            }

            if (_enumerator != null)
            {
                while (_enumerator.MoveNext())
                {
                    yield return(_enumerator.Current);
                }
            }
            else
            {
                foreach (var item in _batch)
                {
                    yield return(item);
                }
                _batch = __emptyBatch;
            }

            _hasMore = false;
        }
Ejemplo n.º 7
0
        public YAMLNode ExportYAML(IExportContainer container)
        {
            YAMLMappingNode node = new YAMLMappingNode();

            node.Add("m_Name", Name);
            node.Add("m_Normal", Normal.ExportYAML(container));
            node.Add("m_Hover", Hover.ExportYAML(container));
            node.Add("m_Active", Active.ExportYAML(container));
            node.Add("m_Focused", Focused.ExportYAML(container));
            node.Add("m_OnNormal", OnNormal.ExportYAML(container));
            node.Add("m_OnHover", OnHover.ExportYAML(container));
            node.Add("m_OnActive", OnActive.ExportYAML(container));
            node.Add("m_OnFocused", OnFocused.ExportYAML(container));
            node.Add("m_Border", Border.ExportYAML(container));
            node.Add("m_Margin", Margin.ExportYAML(container));
            node.Add("m_Padding", Padding.ExportYAML(container));
            node.Add("m_Overflow", Overflow.ExportYAML(container));
            node.Add("m_Font", Font.ExportYAML(container));
            node.Add("m_FontSize", FontSize);
            node.Add("m_FontStyle", (int)FontStyle);
            node.Add("m_Alignment", (int)Alignment);
            node.Add("m_WordWrap", WordWrap);
            node.Add("m_RichText", RichText);
            node.Add("m_TextClipping", (int)TextClipping);
            node.Add("m_ImagePosition", (int)ImagePosition);
            node.Add("m_ContentOffset", ContentOffset.ExportYAML(container));
            node.Add("m_FixedWidth", FixedWidth);
            node.Add("m_FixedHeight", FixedHeight);
            node.Add("m_StretchWidth", StretchWidth);
            node.Add("m_StretchHeight", StretchHeight);
            return(node);
        }
Ejemplo n.º 8
0
        public Overflow StartBatch()
        {
            var overflow = _overflow;

            _overflow = null;
            return(overflow);
        }
Ejemplo n.º 9
0
        public YAMLNode ExportYAML(IExportContainer container)
        {
            YAMLMappingNode node = new YAMLMappingNode();

            node.Add(NameName, Name);
            node.Add(NormalName, Normal.ExportYAML(container));
            node.Add(HoverName, Hover.ExportYAML(container));
            node.Add(ActiveName, Active.ExportYAML(container));
            node.Add(FocusedName, Focused.ExportYAML(container));
            node.Add(OnNormalName, OnNormal.ExportYAML(container));
            node.Add(OnHoverName, OnHover.ExportYAML(container));
            node.Add(OnActiveName, OnActive.ExportYAML(container));
            node.Add(OnFocusedName, OnFocused.ExportYAML(container));
            node.Add(BorderName, Border.ExportYAML(container));
            node.Add(MarginName, Margin.ExportYAML(container));
            node.Add(PaddingName, Padding.ExportYAML(container));
            node.Add(OverflowName, Overflow.ExportYAML(container));
            node.Add(FontName, Font.ExportYAML(container));
            node.Add(FontSizeName, FontSize);
            node.Add(FontStyleName, (int)FontStyle);
            node.Add(AlignmentName, (int)Alignment);
            node.Add(WordWrapName, WordWrap);
            node.Add(RichTextName, RichText);
            node.Add(TextClippingName, (int)TextClipping);
            node.Add(ImagePositionName, (int)ImagePosition);
            node.Add(ContentOffsetName, ContentOffset.ExportYAML(container));
            node.Add(FixedWidthName, FixedWidth);
            node.Add(FixedHeightName, FixedHeight);
            node.Add(StretchWidthName, StretchWidth);
            node.Add(StretchHeightName, StretchHeight);
            return(node);
        }
Ejemplo n.º 10
0
 // StyleSetOverflow sets overflow
 public void StyleSetOverflow(Overflow overflow)
 {
     if (this.nodeStyle.Overflow != overflow)
     {
         this.nodeStyle.Overflow = overflow;
         Flex.nodeMarkDirtyInternal(this);
     }
 }
Ejemplo n.º 11
0
 public static string ToCssClass(this Overflow value)
 {
     return(value == Overflow.None
         ? string.Empty
         : new CssClassBuilder("overflow")
            .Append(() => value.GetCssClassPart(), () => value != Overflow.None)
            .Build());
 }
Ejemplo n.º 12
0
        public Overflow StartBatch()
        {
            ThrowIfNotBatchable();
            var overflow = _overflow;

            _overflow = null;
            return(overflow);
        }
Ejemplo n.º 13
0
    /// <summary>
    /// If the label is anchored it should not auto-resize.
    /// </summary>

    protected override void OnAnchor()
    {
        if (mOverflow == Overflow.ResizeFreely || mOverflow == Overflow.ResizeHeight)
        {
            mOverflow = Overflow.ShrinkContent;
        }
        base.OnAnchor();
    }
Ejemplo n.º 14
0
 public Text(string message, IFont font)
 {
     Font              = font;
     Message           = message;
     Wrapped           = true;
     Align             = Alignment.Left;
     OverflowBehaviour = Overflow.Visible;
 }
Ejemplo n.º 15
0
        public static VisualElement SetOverflow(this VisualElement self, Overflow v)
        {
            var c = self.style.overflow;

            c.value             = v;
            self.style.overflow = c;

            return(self);
        }
Ejemplo n.º 16
0
 public bool Add(ICardModel cardModel)
 {
     if (Maxxed.Value)
     {
         Overflow?.Invoke(this);
         return(false);
     }
     _Cards.Add(cardModel);
     return(true);
 }
Ejemplo n.º 17
0
        public BoundedFormattedTextRenderer(Actor actor, Alignment alignment = default, Overflow overflow = Overflow.Elide, Depth depthOffset = default, FormattedText formattedText = default) : base(actor)
        {
            this.boundingRect = RequireComponent <BoundingRect>();
            this.alignment    = alignment;
            this.depthOffset  = depthOffset;
            this.overflow     = overflow;
            SetText(formattedText);

            this.boundingRect.onSizeChange += OnSizeChange;
        }
Ejemplo n.º 18
0
    /// <summary>
    /// Text is pixel-perfect when its scale matches the size.
    /// </summary>

    public override void MakePixelPerfect()
    {
        if (ambigiousFont != null)
        {
            float pixelSize = (bitmapFont != null) ? bitmapFont.pixelSize : 1f;

            Vector3 pos = cachedTransform.localPosition;
            pos.x = Mathf.RoundToInt(pos.x);
            pos.y = Mathf.RoundToInt(pos.y);
            pos.z = Mathf.RoundToInt(pos.z);

            cachedTransform.localPosition = pos;
            cachedTransform.localScale    = Vector3.one;

            if (mOverflow == Overflow.ResizeFreely)
            {
                AssumeNaturalSize();
            }
            else
            {
                Overflow over = mOverflow;
                mOverflow = Overflow.ShrinkContent;
                ProcessText(false);
                mOverflow = over;

                int minX = Mathf.RoundToInt(mCalculatedSize.x * pixelSize);
                int minY = Mathf.RoundToInt(mCalculatedSize.y * pixelSize);

                if (bitmapFont != null)
                {
                    minX = Mathf.Max(bitmapFont.defaultSize);
                    minY = Mathf.Max(bitmapFont.defaultSize);
                }
                else
                {
                    minX = Mathf.Max(base.minWidth);
                    minY = Mathf.Max(base.minHeight);
                }

                if (width < minX)
                {
                    width = minX;
                }
                if (height < minY)
                {
                    height = minY;
                }
            }
        }
        else
        {
            base.MakePixelPerfect();
        }
    }
        public void ShouldSerializeType()
        {
            // arrange
            var overflow = new Overflow();

            // act
            var payload = SlackClient.SerializeObject(overflow);

            // assert
            payload.Should().Contain("\"type\":\"overflow\"");
        }
    /// <summary>
    /// Sets the overflow strategy.
    /// </summary>
    /// <typeparam name="T">An object implementing <see cref="IOverflowable"/>.</typeparam>
    /// <param name="obj">The overflowable object instance.</param>
    /// <param name="overflow">The overflow strategy to use.</param>
    /// <returns>The same instance so that multiple calls can be chained.</returns>
    public static T Overflow <T>(this T obj, Overflow overflow)
        where T : class, IOverflowable
    {
        if (obj is null)
        {
            throw new ArgumentNullException(nameof(obj));
        }

        obj.Overflow = overflow;
        return(obj);
    }
Ejemplo n.º 21
0
 // додавання до черги
 public void Enqueue(T data)
 {
     if (array.Length > count)
     {
         array[++end] = data;
         count++;
     }
     else
     {
         Overflow?.Invoke("черга переповнена");
     }
 }
Ejemplo n.º 22
0
            public ushort Index;    // Insert this cell before idx-th non-overflow cell
            public Overflow Clone()
            {
                var cp = new Overflow();

                if (Cell != null)
                {
                    cp.Cell = MallocEx.sqlite3Malloc(Cell.Length);
                    Buffer.BlockCopy(Cell, 0, cp.Cell, 0, Cell.Length);
                }
                cp.Index = Index;
                return(cp);
            }
        public void ShouldSerializeActionId()
        {
            // arrange
            var overflow = new Overflow {
                ActionId = "Action123"
            };

            // act
            var payload = SlackClient.SerializeObject(overflow);

            // assert
            payload.Should().Contain("\"action_id\":\"Action123\"");
        }
Ejemplo n.º 24
0
        public static bool StringToOverflow(string value, out Overflow result)
        {
            switch (value)
            {
            case "visible": result = Overflow.Visible; return(true);

            case "hidden": result = Overflow.Hidden; return(true);

            case "scroll": result = Overflow.Scroll; return(true);
            }
            result = Overflow.Visible;
            return(false);
        }
        private void SetPropertyValue(object newValue)
        {
            object val  = StyleDebug.GetComputedStyleValue(m_SelectedElement.computedStyle, m_PropertyInfo.id);
            Type   type = m_PropertyInfo.type;

            if (newValue == null)
            {
                if (type == typeof(StyleBackground))
                {
                    val = new StyleBackground();
                }

                if (type == typeof(StyleFont))
                {
                    val = new StyleFont();
                }
            }
            else if (type == newValue.GetType())
            {
                val = newValue;
            }
            else
            {
                if (type == typeof(StyleBackground))
                {
                    val = new StyleBackground(newValue as Texture2D);
                }
                else if (type == typeof(StyleEnum <Overflow>) && newValue is OverflowInternal)
                {
                    OverflowInternal newV = (OverflowInternal)newValue;
                    Overflow         v    = newV == OverflowInternal.Hidden ? Overflow.Hidden : Overflow.Visible;
                    val = new StyleEnum <Overflow>(v);
                }
                else
                {
                    var valueInfo = type.GetProperty("value");
                    try
                    {
                        valueInfo.SetValue(val, newValue, null);
                    }
                    catch (Exception)
                    {
                        Debug.LogError($"Invalid value for property '{m_PropertyName}'");
                        return;
                    }
                }
            }

            StyleDebug.SetInlineStyleValue(m_SelectedElement.style, m_PropertyInfo.id, val);
            SetSpecificity(StyleDebug.InlineSpecificity);
        }
Ejemplo n.º 26
0
        public override RegionArea MakeRegionArea(int allocationRectangleXPosition,
                                                  int allocationRectangleYPosition,
                                                  int allocationRectangleWidth,
                                                  int allocationRectangleHeight)
        {
            BorderAndPadding bap    = propMgr.GetBorderAndPadding();
            BackgroundProps  bProps = propMgr.GetBackgroundProps();
            MarginProps      mProps = propMgr.GetMarginProps();
            BodyRegionArea   body   = new BodyRegionArea(allocationRectangleXPosition
                                                         + mProps.marginLeft,
                                                         allocationRectangleYPosition
                                                         - mProps.marginTop,
                                                         allocationRectangleWidth
                                                         - mProps.marginLeft
                                                         - mProps.marginRight,
                                                         allocationRectangleHeight
                                                         - mProps.marginTop
                                                         - mProps.marginBottom);

            body.setBackground(propMgr.GetBackgroundProps());

            Overflow overflow            = (Overflow)this.properties.GetProperty("overflow").GetEnum();
            string   columnCountAsString =
                this.properties.GetProperty("column-count").GetString();
            int columnCount = 1;

            try
            {
                columnCount = Int32.Parse(columnCountAsString);
            }
            catch (FormatException)
            {
                FonetDriver.ActiveDriver.FireFonetError(
                    "Bad value on region body 'column-count'");
                columnCount = 1;
            }
            if ((columnCount > 1) && (overflow == Overflow.SCROLL))
            {
                FonetDriver.ActiveDriver.FireFonetError(
                    "Setting 'column-count' to 1 because 'overflow' is set to 'scroll'");
                columnCount = 1;
            }
            body.setColumnCount(columnCount);

            int columnGap =
                this.properties.GetProperty("column-gap").GetLength().MValue();

            body.setColumnGap(columnGap);

            return(body);
        }
Ejemplo n.º 27
0
        private void initInternal(AudioFormat format)
        {
            if (Device == null)
            {
                throw new Exception("No device is selected");
            }

            if (Device.ProbeError != 0)
            {
                throw new Exception($"Probe Error : {Device.ProbeError}");
            }

            var native = Soundio.ToSoundioFormat(format);

            if (!native.HasValue)
            {
                throw new NotSupportedException("Format is not supported : " + format);
            }

            _instream                  = Device.CreateInStream();
            _instream.Format           = native.Value;
            _instream.SampleRate       = format.SampleRate;
            _instream.ReadCallback     = ReadCallback;
            _instream.OverflowCallback = () => Overflow?.Invoke(this, EventArgs.Empty);
            _instream.ErrorCallback    = () => UnrecoverableError?.Invoke(this, EventArgs.Empty);
            _instream.SoftwareLatency  = DesiredLatency.TotalSeconds;
            _instream.Open();

            // Open後にチャンネルは設定しないと動作しない模様
            if (Device.CurrentLayout.ChannelCount != format.Channels)
            {
                checkFormatInternal(format, out var channelLayout);
                if (!channelLayout.HasValue)
                {
                    throw new NotSupportedException("No suitable channel layout found : " + format.Channels);
                }

                _instream.Layout = channelLayout.Value;
            }
            _instream.SoftwareLatency = DesiredLatency.TotalSeconds;

            Format          = Soundio.ToManagedFormat(_instream.Format, _instream.SampleRate, _instream.Layout.ChannelCount);
            SoftwareLatency = TimeSpan.FromSeconds(_instream.SoftwareLatency);


            var bytesPerSample = _instream.BytesPerSample;
            var capacity       = Format.SampleRate * Format.Channels * bytesPerSample *
                                 _bufferDuration.TotalSeconds;

            _ringBuffer = new RingBuffer <byte>((uint)capacity);
        }
Ejemplo n.º 28
0
 /// <summary>
 /// Creates the New Falling Block, for the Grid to Handle
 /// </summary>
 /// <param name="blockType"></param>
 public void CreateFallingBlock(TypeOfBlock blockType)
 {
     BlockThatsFalling = new FallingBlock(blockType);
     //Checks to see if the Blocks are that the top of the screen
     foreach (var item in BlockThatsFalling.BlockCells)
     {
         if (_cells[item.CellLocationX, item.CellLocationY].Filled)
         {
             Overflow?.Invoke();
             return;
         }
         _cells[item.CellLocationX, item.CellLocationY].BackColor = item.BackColor;
     }
 }
Ejemplo n.º 29
0
 public RenderStack(
     List <RenderBox> children   = null,
     AlignmentGeometry alignment = null,
     TextDirection textDirection = TextDirection.ltr,
     StackFit fit      = StackFit.loose,
     Overflow overflow = Overflow.clip
     )
 {
     _textDirection = textDirection;
     _alignment     = alignment ?? AlignmentDirectional.topStart;
     _fit           = fit;
     _overflow      = overflow;
     addAll(children);
 }
Ejemplo n.º 30
0
    /// <summary>
    /// Text is pixel-perfect when its scale matches the size.
    /// </summary>

    public override void MakePixelPerfect()
    {
        if (ambigiousFont != null)
        {
            Vector3 pos = cachedTransform.localPosition;
            pos.x = Mathf.RoundToInt(pos.x);
            pos.y = Mathf.RoundToInt(pos.y);
            pos.z = Mathf.RoundToInt(pos.z);

            cachedTransform.localPosition = pos;
            cachedTransform.localScale    = Vector3.one;

            if (mOverflow == Overflow.ResizeFreely)
            {
                AssumeNaturalSize();
            }
            else
            {
                int w = width;
                int h = height;

                Overflow over = mOverflow;
                if (over != Overflow.ResizeHeight)
                {
                    mWidth = 100000;
                }
                mHeight = 100000;

                mOverflow = Overflow.ShrinkContent;
                ProcessText(false, true);
                mOverflow = over;

                int minX = Mathf.RoundToInt(mCalculatedSize.x);
                int minY = Mathf.RoundToInt(mCalculatedSize.y);

                minX = Mathf.Max(minX, base.minWidth);
                minY = Mathf.Max(minY, base.minHeight);

                mWidth  = Mathf.Max(w, minX);
                mHeight = Mathf.Max(h, minY);

                MarkAsChanged();
            }
        }
        else
        {
            base.MakePixelPerfect();
        }
    }
Ejemplo n.º 31
0
    /// <summary>
    /// If the label is anchored it should not auto-resize.
    /// </summary>

    protected override void OnAnchor() {
        if (mOverflow == Overflow.ResizeFreely) {
            if (isFullyAnchored)
                mOverflow = Overflow.ShrinkContent;
        }
        else if (mOverflow == Overflow.ResizeHeight) {
            if (topAnchor.target != null && bottomAnchor.target != null)
                mOverflow = Overflow.ShrinkContent;
        }
        base.OnAnchor();
    }
Ejemplo n.º 32
0
    /// <summary>
    /// Text is pixel-perfect when its scale matches the size.
    /// </summary>

    public override void MakePixelPerfect() {
        if (ambigiousFont != null) {
            Vector3 pos = cachedTransform.localPosition;
            pos.x = Mathf.RoundToInt(pos.x);
            pos.y = Mathf.RoundToInt(pos.y);
            pos.z = Mathf.RoundToInt(pos.z);

            cachedTransform.localPosition = pos;
            cachedTransform.localScale = Vector3.one;

            if (mOverflow == Overflow.ResizeFreely) {
                AssumeNaturalSize();
            }
            else {
                int w = width;
                int h = height;

                Overflow over = mOverflow;
                if (over != Overflow.ResizeHeight) mWidth = 100000;
                mHeight = 100000;

                mOverflow = Overflow.ShrinkContent;
                ProcessText(false, true);
                mOverflow = over;

                int minX = Mathf.RoundToInt(mCalculatedSize.x);
                int minY = Mathf.RoundToInt(mCalculatedSize.y);

                minX = Mathf.Max(minX, base.minWidth);
                minY = Mathf.Max(minY, base.minHeight);

                if ((minX & 1) == 1) ++minX;
                if ((minY & 1) == 1) ++minY;

                mWidth = Mathf.Max(w, minX);
                mHeight = Mathf.Max(h, minY);

                MarkAsChanged();
            }
        }
        else base.MakePixelPerfect();
    }
Ejemplo n.º 33
0
	/// <summary>
	/// If the label is anchored it should not auto-resize.
	/// </summary>

	protected override void OnAnchor ()
	{
		if (mOverflow == Overflow.ResizeFreely || mOverflow == Overflow.ResizeHeight)
			mOverflow = Overflow.ShrinkContent;
		base.OnAnchor();
	}
Ejemplo n.º 34
0
	/// <summary>
	/// Text is pixel-perfect when its scale matches the size.
	/// </summary>

	public override void MakePixelPerfect ()
	{
		if (bitmapFont != null)
		{
			float pixelSize = (bitmapFont != null) ? bitmapFont.pixelSize : 1f;

			Vector3 pos = cachedTransform.localPosition;
			pos.x = Mathf.RoundToInt(pos.x);
			pos.y = Mathf.RoundToInt(pos.y);
			pos.z = Mathf.RoundToInt(pos.z);

			cachedTransform.localPosition = pos;
			cachedTransform.localScale = Vector3.one;

			if (mOverflow == Overflow.ResizeFreely)
			{
				AssumeNaturalSize();
			}
			else
			{
				Overflow over = mOverflow;
				mOverflow = Overflow.ShrinkContent;
				ProcessText(false);
				mOverflow = over;

				int minX = Mathf.RoundToInt(mCalculatedSize.x * pixelSize);
				int minY = Mathf.RoundToInt(mCalculatedSize.y * pixelSize);

				if (width < minX) width = minX;
				if (height < minY) height = minY;
			}
		}
		else base.MakePixelPerfect();
	}
Ejemplo n.º 35
0
 public override void MakePixelPerfect()
 {
     if (this.ambigiousFont != null)
     {
         float num = (this.bitmapFont == null) ? 1f : this.bitmapFont.pixelSize;
         Vector3 localPosition = base.cachedTransform.localPosition;
         localPosition.x = Mathf.RoundToInt(localPosition.x);
         localPosition.y = Mathf.RoundToInt(localPosition.y);
         localPosition.z = Mathf.RoundToInt(localPosition.z);
         base.cachedTransform.localPosition = localPosition;
         base.cachedTransform.localScale = Vector3.one;
         if (this.mOverflow == Overflow.ResizeFreely)
         {
             this.AssumeNaturalSize();
         }
         else
         {
             Overflow mOverflow = this.mOverflow;
             this.mOverflow = Overflow.ShrinkContent;
             this.ProcessText(false);
             this.mOverflow = mOverflow;
             int num2 = Mathf.RoundToInt(this.mCalculatedSize.x * num);
             int num3 = Mathf.RoundToInt(this.mCalculatedSize.y * num);
             if (this.bitmapFont != null)
             {
                 int[] values = new int[] { this.bitmapFont.defaultSize };
                 num2 = Mathf.Max(values);
                 int[] numArray2 = new int[] { this.bitmapFont.defaultSize };
                 num3 = Mathf.Max(numArray2);
             }
             else
             {
                 int[] numArray3 = new int[] { base.minWidth };
                 num2 = Mathf.Max(numArray3);
                 int[] numArray4 = new int[] { base.minHeight };
                 num3 = Mathf.Max(numArray4);
             }
             if (base.width < num2)
             {
                 base.width = num2;
             }
             if (base.height < num3)
             {
                 base.height = num3;
             }
         }
     }
     else
     {
         base.MakePixelPerfect();
     }
 }
Ejemplo n.º 36
0
 /// <summary>
 /// Sets the overflow x/y on the content element of the component. The x/y overflow values can be any valid CSS overflow (e.g., 'auto' or 'scroll'). By default, the value is 'hidden'. Passing null for one of the values will erase the inline style. Passing undefined will preserve the current value.
 /// </summary>
 /// <param name="overflowX">The overflow-x value.</param>
 /// <param name="overflowY">The overflow-y value.</param>
 public void SetOverflowXY(Overflow overflowX, Overflow overflowY)
 {
     this.Call("setOverflowXY", overflowX.ToString().ToLowerInvariant(), overflowY.ToString().ToLowerInvariant());
 }
Ejemplo n.º 37
0
    private void OnGUI()
    {
        userManual = GUILayout.TextArea(userManual, "Label");

        EditorGUILayout.Space();

        EditorGUILayout.LabelField("FontType:");
        EditorGUILayout.Space();
        EditorGUILayout.BeginHorizontal();
        fontType = (FontType)EditorGUILayout.EnumPopup(fontType);
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.Space();

        if (fontType == FontType.Unity)
        {
            unityFont = (Font)EditorGUILayout.ObjectField("UnityFont", unityFont, typeof(Font), false);
        }

        if (fontType == FontType.NGUI)
        {

            var fontObject = EditorGUILayout.ObjectField("NGUIFont", nguiFont, typeof(GameObject), false) as GameObject;
            if (fontObject != null)
            {
                nguiFont = fontObject.GetComponent<UIFont>();
            }

            EditorGUILayout.Space();

            EditorGUILayout.LabelField("Overflow:");
            EditorGUILayout.Space();
            EditorGUILayout.BeginHorizontal();
            overflow = (Overflow)EditorGUILayout.EnumPopup(overflow);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Space();

            EditorGUILayout.LabelField("Crisp:");
            EditorGUILayout.Space();
            EditorGUILayout.BeginHorizontal();
            crisp = (Crisp)EditorGUILayout.EnumPopup(crisp);
            EditorGUILayout.EndHorizontal();
        }

        EditorGUILayout.Space();

        var validated = Validate();
        GUI.enabled = validated;
        if (GUILayout.Button("ApplyFont"))
        {
            ApplyFont();
        }
        GUI.enabled = true;
    }
Ejemplo n.º 38
0
            public ushort Index; // Insert this cell before idx-th non-overflow cell

            #endregion Fields

            #region Methods

            public Overflow Clone()
            {
                var cp = new Overflow();
                if (Cell != null)
                {
                    cp.Cell = MallocEx.sqlite3Malloc(Cell.Length);
                    Buffer.BlockCopy(Cell, 0, cp.Cell, 0, Cell.Length);
                }
                cp.Index = Index;
                return cp;
            }