public static void OnKeydown(Event e, bool isAltPressed, bool isCtrlPressed)
        {
            if (isAltPressed)
            {
                var comp = SelectionExt.GetUIComponentFromSelection();

                if (comp == null)
                {
                    return;
                }

                if (e.keyCode == KeyCode.Alpha1)
                {
                    if (comp is Text)
                    {
                        Multiselect.SelectByTextFont();
                    }
                    else if (comp is Image)
                    {
                        Multiselect.SelectByImageSprite();
                    }
                    else if (comp is RawImage)
                    {
                        Multiselect.SelectByRawImageTexture();
                    }
                }
                if (e.keyCode == KeyCode.Alpha2)
                {
                    if (comp is Text)
                    {
                        Multiselect.SelectByTextSize();
                    }
                }
            }
        }
示例#2
0
        public static void OnSceneGUI()
        {
            DrawOutlines();

            var ui = SelectionExt.GetUIComponentFromSelection();

            if (ui == null)
            {
                return;
            }

            var rt = ui.GetComponent <RectTransform>();

            EditorDrawString.DrawString($"{rt.rect.width.ToString("0.0")} x {rt.rect.height.ToString("0.0")}");
        }
示例#3
0
        public static void OnKeyDown(Event e, bool isCtrlPressed)
        {
            if (isCtrlPressed && e.keyCode == KeyCode.V)
            {
                var buffer = GUIUtility.systemCopyBuffer;
                if (buffer.StartsWith("#") == false)
                {
                    buffer = "#" + buffer;
                }

                var   comp = SelectionExt.GetUIComponentFromSelection();
                Color color;
                if (ColorUtility.TryParseHtmlString(buffer, out color))
                {
                    comp.color = color;
                }
            }
        }