From b257aa2eef6a77c466bbda56855cccfabd24a23d Mon Sep 17 00:00:00 2001 From: gaoxin Date: Mon, 3 Aug 2020 21:08:38 +0800 Subject: [PATCH] =?UTF-8?q?dragview=E5=9B=9E=E6=BB=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/ManagedResources/~Lua/View/DragView.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Assets/ManagedResources/~Lua/View/DragView.lua b/Assets/ManagedResources/~Lua/View/DragView.lua index d1a0d6e78b..5a811a936f 100644 --- a/Assets/ManagedResources/~Lua/View/DragView.lua +++ b/Assets/ManagedResources/~Lua/View/DragView.lua @@ -51,6 +51,7 @@ end function this:SetDragGO(go) self.dragGO = go + self.moveTween = self.dragGO:GetComponent(typeof(UITweenSpring)) if not self.moveTween then self.moveTween = self.dragGO:AddComponent(typeof(UITweenSpring)) end @@ -64,7 +65,7 @@ end function this:OnPointerDown(Pointgo, data) if not self.dragGO then return end data:Use() - if self.points and self.moveTween then + if self.points then if data.pointerEnter == self.trigger.gameObject and #self.points < 2 then table.insert(self.points, data) if #self.points >= 2 then @@ -88,7 +89,7 @@ end function this:OnBeginDrag(Pointgo, data) if not self.dragGO then return end - if self.points and self.moveTween then + if self.points then if #self.points <= 1 then if self.points[1] == data then self.moveTween.enabled = true @@ -102,7 +103,7 @@ end function this:OnDrag(Pointgo, data) if not self.dragGO then return end - if self.points and self.moveTween then + if self.points then if self.points[1] == data or self.points[2] == data then if #self.points >= 2 then --双点缩放 local distance = Vector2.Distance(self.points[1].position, self.points[2].position) @@ -122,7 +123,7 @@ end function this:OnEndDrag(Pointgo, data) if not self.dragGO then return end - if self.points and self.moveTween then + if self.points then if #self.points == 0 then --移动增加缓动效果 self:SetPosition(data.delta) self.moveTween.IsUseCallBack = true