滑动 回弹修改提交
parent
360cbbf54f
commit
5cf3388a59
|
@ -78,7 +78,7 @@ local function SetItemIndex(self, curIndex)
|
|||
end
|
||||
end
|
||||
|
||||
local function SetPosition(self, dv2)
|
||||
local function SetPosition(self, dv2,isBack)
|
||||
local av2 = self.dragGOTran.anchoredPosition
|
||||
if self.dragType == 1 then
|
||||
dv2.x = 0
|
||||
|
@ -92,12 +92,16 @@ local function SetPosition(self, dv2)
|
|||
if self.dragType == 1 then
|
||||
if fv2.y < (0 - self.maxOffSet) or fv2.y > (self.itemDis + self.maxOffSet) then
|
||||
fv2.y = math.clamp(fv2.y, 0, self.itemDis)
|
||||
return
|
||||
if not isBack then
|
||||
return
|
||||
end
|
||||
end
|
||||
elseif self.dragType == 2 then
|
||||
if fv2.x < (0 - self.maxOffSet) or fv2.x > (self.itemDis + self.maxOffSet) then
|
||||
fv2.x = math.clamp(-fv2.x, -self.itemDis, 0)
|
||||
return
|
||||
if not isBack then
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
|
@ -142,7 +146,7 @@ end
|
|||
local function OnEndDrag(self, Pointgo, data)
|
||||
if not self.isBeginDrag then return end
|
||||
if not self.dataList then return end
|
||||
SetPosition(self, data.delta)
|
||||
SetPosition(self, data.delta,true)
|
||||
self.moveTween.IsUseCallBack = true
|
||||
data:Use()
|
||||
self.isBeginDrag = false
|
||||
|
|
Loading…
Reference in New Issue