Inheritance: GraphicEditor
Example #1
0
        public override void OnPreviewGUI(Rect rect, GUIStyle background)
        {
            RawImage rawImage    = base.target as RawImage;
            Texture  mainTexture = rawImage.mainTexture;

            if (!(mainTexture == null))
            {
                Rect outer = RawImageEditor.Outer(rawImage);
                SpriteDrawUtility.DrawSprite(mainTexture, rect, outer, rawImage.uvRect, rawImage.canvasRenderer.GetColor());
            }
        }
Example #2
0
        /// <summary>
        ///   <para>Custom preview for Image component.</para>
        /// </summary>
        /// <param name="rect">Rectangle in which to draw the preview.</param>
        /// <param name="background">Background image.</param>
        public override void OnPreviewGUI(Rect rect, GUIStyle background)
        {
            RawImage target      = this.target as RawImage;
            Texture  mainTexture = target.mainTexture;

            if ((Object)mainTexture == (Object)null)
            {
                return;
            }
            Rect outer = RawImageEditor.Outer(target);

            SpriteDrawUtility.DrawSprite(mainTexture, rect, outer, target.uvRect, target.canvasRenderer.GetColor());
        }
Example #3
0
        /// <summary>
        ///   <para>Can this component be Previewed in its current state?</para>
        /// </summary>
        /// <returns>
        ///   <para>True if this component can be Previewed in its current state.</para>
        /// </returns>
        public override bool HasPreviewGUI()
        {
            RawImage target = this.target as RawImage;

            if ((Object)target == (Object)null)
            {
                return(false);
            }
            Rect rect = RawImageEditor.Outer(target);

            if ((double)rect.width > 0.0)
            {
                return((double)rect.height > 0.0);
            }
            return(false);
        }
Example #4
0
        public override bool HasPreviewGUI()
        {
            RawImage rawImage = base.target as RawImage;
            bool     result;

            if (rawImage == null)
            {
                result = false;
            }
            else
            {
                Rect rect = RawImageEditor.Outer(rawImage);
                result = (rect.width > 0f && rect.height > 0f);
            }
            return(result);
        }