zhaoyang 3 years ago
parent
commit
6d630e14fb

+ 4 - 3
GameClient/Assets/Game/HotUpdate/Views/DressUp/PhotographView.cs

@@ -297,14 +297,15 @@ namespace GFGGame
 
 
             GameObject gameObject = _ui.m_comSelectBox.target.data as GameObject;
             GameObject gameObject = _ui.m_comSelectBox.target.data as GameObject;
             InputEvent inputEvent = (InputEvent)context.data;
             InputEvent inputEvent = (InputEvent)context.data;
-
-            Vector2 pt1 = this.viewCom.GlobalToLocal(new Vector2(inputEvent.x, inputEvent.y) / gameObject.transform.localScale);
+            Vector2 screenPos = this.viewCom.GlobalToLocal(_ui.m_comSelectBox.m_btnSize.LocalToGlobal(Vector2.zero));
+            Vector2 pt = new Vector2(screenPos.x, screenPos.y);
+            Vector2 pt1 = this.viewCom.GlobalToLocal(new Vector2(inputEvent.x, inputEvent.y));
             Vector2 pt2 = new Vector2(_ui.m_comSelectBox.target.x, _ui.m_comSelectBox.target.y);
             Vector2 pt2 = new Vector2(_ui.m_comSelectBox.target.x, _ui.m_comSelectBox.target.y);
             Debug.Log("pt1" + pt1 + "   pt2:" + pt2);
             Debug.Log("pt1" + pt1 + "   pt2:" + pt2);
 
 
             if (!_equipDistance.ContainsKey(gameObject))
             if (!_equipDistance.ContainsKey(gameObject))
             {
             {
-                float distance = Vector2.Distance(pt1, pt2);
+                float distance = Vector2.Distance(pt, pt2);/// gameObject.transform.localScale.x;
                 _equipDistance.Add(gameObject, distance);
                 _equipDistance.Add(gameObject, distance);
             }
             }
             _startDistance = _equipDistance[gameObject];
             _startDistance = _equipDistance[gameObject];