private void UpdateControllingBlockEdidtorElement()
    {
        if (Input.GetMouseButtonDown(0))
        {
            this.screenPointWhenMouseClicked = Input.mousePosition;
            this.PinchingBlockEditorUnit     = UiUtility.GetTopBlockEditorElementWithScreenPoint <BlockEditorUnit>(Input.mousePosition, BlockEditorUnit.BlockEditorUnitTag);;
        }
        else if (Input.GetMouseButton(0))
        {
            if (this.ControllingBlockEditorUnit == null)
            {
                if (this.PinchingBlockEditorUnit != null && Mathf.Abs(this.screenPointWhenMouseClicked.x - Input.mousePosition.x) > 1.5f)
                {   // If Move Mouse After Clicking Block, it start control clicked block
                    //Set this.ControllingBlockEditorUnit

                    bool isDuplicated = this.PinchingBlockEditorUnit._BlockEditorUnitFlag.HasFlag(BlockEditorUnit.BlockEditorUnitFlag.IsDuplicateType);

                    //if PinchingBlockEditorUnit is shopblock, duplicate it, or controll it
                    this.ControllingBlockEditorUnit = isDuplicated ? this.DuplicateBlockEditorUnit(this.PinchingBlockEditorUnit, this.BlockEditorBody) : this.PinchingBlockEditorUnit;

                    if (this.ControllingBlockEditorUnit != null)
                    {
                        Vector3 mouseWorldPos = UiUtility.GetUiWorldPos(this.BlockEditorBody, Input.mousePosition);
                        this.controllOffset = isDuplicated ? Vector3.zero : mouseWorldPos - this.ControllingBlockEditorUnit.transform.position;

                        this.ControllingBlockEditorUnit.transform.position = mouseWorldPos - controllOffset;
                    }
                    else
                    {
                        Debug.LogError("ControllingBlockEditorUnit is null");
                    }
                }
            }
            else
            {
                this.ControllingBlockEditorUnit.transform.position = UiUtility.GetUiWorldPos(this.BlockEditorBody, Input.mousePosition) - controllOffset;
            }
        }
        else if (Input.GetMouseButtonUp(0))
        {
            if (this.ControllingBlockEditorUnit != null)
            {
                ScrollRect HoveringBodyScrollRect = this.UpdateHoveringBodyScrollRect();

                if (HoveringBodyScrollRect == null || HoveringBodyScrollRect == this.BlockShopScrollRect.gameObject)
                {//if player end controlling block on BlockShop UI or Outside of Editor UI
                    if (this.ControllingBlockEditorUnit._BlockEditorUnitFlag.HasFlag(BlockEditorUnit.BlockEditorUnitFlag.IsRemovable))
                    {
                        this.ControllingBlockEditorUnit.Release();
                    }
                    else
                    {
                        this.ControllingBlockEditorUnit.RevertTransformInfo();
                    }
                }
                else
                {//if player end controlling block on BlockWorkSpace UI
                    base.SetBlockEditorUnitRootAtSourceCodeViewer(this.ControllingBlockEditorUnit);

                    if (this.ControllingBlockEditorUnit.IsAttatchable() == true)
                    {//if block can attach to other block as flowbloc or valueblock
                        this.controllingBlockEditorUnit.AttachBlock();
                    }
                    this.ControllingBlockEditorUnit.OnEndControlling();
                }
            }

            this.ControllingBlockEditorUnit = null;
            this.PinchingBlockEditorUnit    = null;
        }
    }