Beispiel #1
0
        void OnPromptSearcher(PromptSearcherEvent e)
        {
            if (!(Model is IVariableDeclarationModel vdm))
            {
                return;
            }

            SearcherService.ShowVariableTypes(
                (Stencil)Model.GraphModel.Stencil,
                CommandDispatcher.State,
                e.MenuPosition,
                (t, i) =>
            {
                CommandDispatcher.Dispatch(new ChangeVariableTypeCommand(vdm, t));
            });

            e.StopPropagation();
        }
        protected void AddTypeSelector()
        {
            void OnClick()
            {
                var pos = new Vector2(m_TypeSelectorButton.layout.xMin, m_TypeSelectorButton.layout.yMax);

                pos = m_TypeSelectorButton.parent.LocalToWorld(pos);
                // PF: FIX weird searcher position computation
                pos.y += 21;

                SearcherService.ShowVariableTypes(
                    (Stencil)Model.GraphModel.Stencil,
                    CommandDispatcher.State,
                    pos,
                    (t, i) => OnTypeChanged(t)
                    );
            }

            m_TypeSelectorButton = new Button(OnClick)
            {
                text = GetTypeDisplayText()
            };
            AddRow("Type", m_TypeSelectorButton, rowTypeSelectorUssClassName);
        }