コード例 #1
0
        /// <summary>
        /// 转换节点类型
        /// </summary>
        /// <param name="root"></param>
        /// <returns></returns>
        private static NodeModel GetModel(UiNode root)
        {
            var rect = root.Bounds();

            var model = new NodeModel
            {
                Index         = root.Depth,
                ResourceId    = root.FullId,
                Text          = root.Text,
                Desc          = root.Desc,
                ClassName     = root.ClassName,
                Checkable     = root.Checkable,
                Checked       = root.Checked,
                Clickable     = root.Clickable,
                Enabled       = root.Enabled,
                Scrollable    = root.Scrollable,
                LongClickable = root.LongClickable,
                Password      = root.Password,
                Selected      = root.IsSelected,
                ChildCount    = root.ChildCount,
                Rect          = new Rect
                {
                    Left    = rect.Left,
                    Top     = rect.Top,
                    Right   = rect.Right,
                    Bottom  = rect.Bottom,
                    CenterX = rect.CenterX(),
                    CenterY = rect.CenterY(),
                    Width   = rect.Right - rect.Left,
                    Height  = rect.Bottom - rect.Top,
                }
            };

            return(model);
        }