using CommonFroms.SceneGraph2D;
using CommonFroms.SceneGraph2D.Edit;
using CommonLang.Geometry;
using CommonLang.Geometry.SceneGraph2D;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CommonTest
{
    public partial class FormSceneGraph2D : Form
    {
        public FormSceneGraph2D()
        {
            InitializeComponent();
            
            stage.OnCanvasUpdate += Stage_OnCanvasUpdate;
            stage.OnCanvasDraw += Stage_OnCanvasDraw;
        }

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            var body = EditorImageNode.CreateImage(@"C:\Users\yifei.zhang\Desktop\DB\Dragon_1\texture\parts\body.png");
            var head = EditorImageNode.CreateImage(@"C:\Users\yifei.zhang\Desktop\DB\Dragon_1\texture\parts\head.png");
            var handL = EditorImageNode.CreateImage(@"C:\Users\yifei.zhang\Desktop\DB\Dragon_1\texture\parts\handL.png");
            var handR = EditorImageNode.CreateImage(@"C:\Users\yifei.zhang\Desktop\DB\Dragon_1\texture\parts\handR.png");
            var root = stage.RootNode;
            {
                root.AddChild(body);

                head.Translation = new Vector2(0, -100);
                head.Scale = new Vector2(0.8f, 0.7f);
                head.Rotation = 30;
                body.AddChild(head);

                handL.Translation = new Vector2(-120, 0);
                handL.Scale = new Vector2(1.2f, 1.4f);
                head.Rotation = 20;
                body.AddChild(handL);

                handR.Translation = new Vector2(120, 0);
                handL.Scale = new Vector2(1.3f, 1.1f);
                head.Rotation = -20;
                body.AddChild(handR);

                //body.Scale = new Vector2(1.6f, 2.3f);
                //handL.Scale = new Vector2(1f, -1f / 0.001f);
                //body.Rotation = 45;
//                 var mpos = stage.PointToClient(MousePosition);
//                 var rpos = head.RootToLocal(new Vector2(mpos.X, mpos.Y));
//                 handL.Translation = rpos;
            }

        }

        private void Stage_OnCanvasUpdate(int intervalMS)
        {
        
        }

        private void Stage_OnCanvasDraw(Graphics g)
        {

        }



    }
}