dragview回滚

dev_chengFeng
gaoxin 2020-08-03 21:08:38 +08:00
parent de441aa61d
commit b257aa2eef
1 changed files with 5 additions and 4 deletions

View File

@ -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