⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 scrollphysics.luac.lua

📁 htc manila 2 sourcecode
💻 LUA
字号:
-- Decompiled using luadec 1.0 by sztupy (http://winmo.sztupy.hu)
-- Command line was: -l2 ;1;;2,4,27-38,48-57,93,98;;;5,15,20;;;;;44;47;;; 79fb772c_manila.luac 

require("common")
ScrollPhysics = class()
ScrollPhysics.__init = function(l_1_0, l_1_1, l_1_2, l_1_3, l_1_4, l_1_5, l_1_6)
   local l_1_7 = 0.099990844726563
   l_1_0.ListViewScrollPhysics = CListViewScrollPhysics()
   l_1_0.ListViewScrollPhysics.OnGestureNotify:connect(ScrollPhysics.GestureNotify, l_1_0)
   if l_1_4 == nil then
      l_1_0.pressedfocus = false
   else
      l_1_0.pressedfocus = true
   end
   if l_1_5 == nil then
      l_1_0.keepselection = false
   else
      l_1_0.keepselection = true
   end
   if l_1_6 == nil then
      l_1_0.BehaviorCallback = nil
   else
      l_1_0.BehaviorCallback = l_1_6
   end
   l_1_0.MouseEventCount = 0
   l_1_0.ListView = l_1_1
   l_1_0.HitBox = l_1_2
   l_1_0.SelectionCallback = l_1_3
   l_1_0.PressTimer = timer(l_1_7)
   l_1_0.PressTimer:Stop()
   l_1_0.PressTimer.OnElapsed:connect(ScrollPhysics.HandlePressTimerElapsed, l_1_0)
   l_1_0.isMousePressed = false
   l_1_1:GetLayout().DisableScrollClamping = true
   l_1_0.ConnectFlag = 0
end

ScrollPhysics.IsScrolling = function(l_2_0)
   if l_2_0.ListView == nil then
      return false
   end
   return l_2_0.ListView:IsScrolling()
end

ScrollPhysics.GestureNotify = function(l_3_0)
   local l_3_1 = l_3_0.ListViewScrollPhysics.CurrentBehavior
   local l_3_2 = l_3_0.ListView.MouseBehavior
   l_3_0.ListView.MouseBehavior = l_3_1
   if l_3_1 ~= l_3_2 and l_3_0.BehaviorCallback ~= nil then
      l_3_0.BehaviorCallback(l_3_1)
   end
   if l_3_1 == GESTURE_FLICK then
      l_3_0.ListView:EnableMomentum()
      l_3_0.ListView:GetGenerator():HintEnableVirtualization()
      local l_3_3 = l_3_0.ListViewScrollPhysics.Velocity
      if l_3_3 ~= 0 then
         l_3_0.ListView:ApplyMomentum(Vector3F(0, l_3_3, 0))
      end
   elseif l_3_1 == GESTURE_PAN then
      l_3_0.ListView:GetGenerator().SelectedIndex = -1
      local l_3_4 = l_3_0.ListViewScrollPhysics:GetMovement()
      l_3_0.ListView:ApplyScrollDelta(Vector3F(0, l_3_4, 0))
   elseif l_3_1 == GESTURE_PAN_END then
      l_3_0.ListView:EnableMomentum()
      l_3_0.ListView:GetGenerator():HintEnableVirtualization()
      if l_3_0.ListView:IsScrolling() == true then
         l_3_0.ListViewScrollPhysics.CurrentBehavior = GESTURE_FLICK
      end
   elseif l_3_1 == GESTURE_DOWN then
   elseif l_3_1 == GESTURE_UP then
      l_3_0.ListView:EnableMomentum()
      l_3_0.ListView:GetGenerator():HintEnableVirtualization()
      local l_3_5 = l_3_0.ListView
      local l_3_6 = l_3_0.ListView:GetIndexAtMousePoint(l_3_5._xmouse, l_3_5._ymouse)
      if l_3_6 >= 0 then
         trace("handle selection")
         l_3_0.ListView:GetGenerator().SelectedIndex = l_3_6
         l_3_0.ListView:FocusItems()
         if l_3_0.SelectionCallback ~= nil then
            l_3_0.SelectionCallback(l_3_6)
         end
      end
   else
   end
end

ScrollPhysics.HandleMousePress = function(l_4_0, l_4_1, l_4_2)
   if _config_os == "windowsmobile" then
      l_4_0._TouchFloVerticalStatus = _application.TouchFlo.VerticalEnabled
      _application.TouchFlo.VerticalEnabled = false
   end
   l_4_0.PressTimer:Start()
   if l_4_0.ListView:IsScrolling() == true then
      l_4_0.ListViewScrollPhysics.CurrentBehavior = GESTURE_FLICK
   else
      l_4_0.ListViewScrollPhysics.CurrentBehavior = GESTURE_NONE
      if l_4_0.pressedfocus == true then
         local giamp = l_4_0.ListView:GetIndexAtMousePoint(l_4_0.ListView._xmouse, l_4_0.ListView._ymouse)
         if giamp >= 0 then
           l_4_0.ListView:GetGenerator().SelectedIndex = giamp
         end
      end
   end
   l_4_0.ListView:ClearMomentum()
   l_4_0.ListView:DisableMomentum()
   l_4_0.ListView:GetGenerator():HintDelayVirtualization()
   l_4_0.ListView.onUpdate:connect(ScrollPhysics.HandleUpdate, l_4_0)
   l_4_0.ListViewScrollPhysics:MouseButtonDown(l_4_1._xmouse, l_4_1._ymouse)
   l_4_0.isMousePressed = true
   l_4_0.MouseEventCount = l_4_0.MouseEventCount + 1
   l_4_2.value = true
end

ScrollPhysics.HandleUpdate = function(l_5_0)
   l_5_0.ListViewScrollPhysics:UpdateBehavior()
end

ScrollPhysics.HandlePressTimerElapsed = function(l_6_0)
   l_6_0.PressTimer:Stop()
   local l_6_1 = l_6_0.ListViewScrollPhysics.CurrentBehavior
   if l_6_1 ~= GESTURE_PAN then
      local l_6_2 = l_6_0.ListView:GetIndexAtMousePoint(l_6_0.ListView._xmouse, l_6_0.ListView._ymouse)
      if l_6_2 >= 0 then
         local l_6_3 = l_6_0.ListView:GetGenerator()
         l_6_3.SelectedIndex = l_6_2
         l_6_0.ListView:FocusItems()
      end
   end
end

ScrollPhysics.HandleMouseRelease = function(l_7_0, l_7_1, l_7_2)
   l_7_2.value = true
   if l_7_0.MouseEventCount == 0 then
      return 
   end
   l_7_0.ListView.onUpdate:disconnect(ScrollPhysics.HandleUpdate, l_7_0)
   l_7_0.isMousePressed = false
   l_7_0.MouseEventCount = l_7_0.MouseEventCount - 1
   if _config_os == "windowsmobile" then
      _application.TouchFlo.VerticalEnabled = l_7_0._TouchFloVerticalStatus
   end
   l_7_0.ListViewScrollPhysics:MouseButtonUp(l_7_1._xmouse, l_7_1._ymouse)
   l_7_0.ListView:GetGenerator():HintEnableVirtualization()
   l_7_0.PressTimer:Stop()
   if l_7_0.keepselection == false and l_7_0.ListView:GetGenerator() ~= nil then
      l_7_0.ListView:GetGenerator().SelectedIndex = -1
   end
end

ScrollPhysics.HandleMouseMove = function(l_8_0, l_8_1)
   if l_8_0.isMousePressed ~= true then
      return 
   end
   l_8_0.ListViewScrollPhysics:MouseMove(l_8_1._xmouse, l_8_1._ymouse)
end

ScrollPhysics.OnMomentumFinish = function(l_9_0)
   l_9_0.ListViewScrollPhysics.CurrentBehavior = GESTURE_PAN_END
   if l_9_0.BehaviorCallback ~= nil then
      l_9_0.BehaviorCallback(GESTURE_PAN_END)
   end
end

ScrollPhysics.OnLowMomentum = function(l_10_0)
   if l_10_0.BehaviorCallback ~= nil then
      l_10_0.BehaviorCallback(GESTURE_LOW_MOMENTUM)
   end
end

ScrollPhysics.ConnectMouseEvents = function(l_11_0)
   if l_11_0.ConnectFlag > 0 then
      trace("ScrollPhysics_ConnectMouseEvents : have connected, so return immediately\n")
      return 
   end
   l_11_0.ConnectFlag = l_11_0.ConnectFlag + 1
   l_11_0.HitBox.onPress:connect(ScrollPhysics.HandleMousePress, l_11_0)
   l_11_0.HitBox.onRelease:connect(ScrollPhysics.HandleMouseRelease, l_11_0)
   l_11_0.HitBox.onReleaseOutside:connect(ScrollPhysics.HandleMouseRelease, l_11_0)
   l_11_0.HitBox.onMouseMove:connect(ScrollPhysics.HandleMouseMove, l_11_0)
   if l_11_0.ListView ~= nil then
      local l_11_1 = l_11_0.ListView:GetLayout()
      if l_11_1 ~= nil then
         l_11_1.onMomentumFinish:connect(ScrollPhysics.OnMomentumFinish, l_11_0)
         l_11_1.onLowMomentum:connect(ScrollPhysics.OnLowMomentum, l_11_0)
      end
   end
end

ScrollPhysics.DisconnectMouseEvents = function(l_12_0)
   if l_12_0.ConnectFlag < 1 then
      trace("ScrollPhysics_DisconnectMouseEvents : have not connected, so need not to disconnect\n")
      return 
   end
   l_12_0.ConnectFlag = l_12_0.ConnectFlag - 1
   l_12_0.PressTimer:Stop()
   l_12_0.HitBox.onPress:disconnect(ScrollPhysics.HandleMousePress, l_12_0)
   l_12_0.HitBox.onRelease:disconnect(ScrollPhysics.HandleMouseRelease, l_12_0)
   l_12_0.HitBox.onReleaseOutside:disconnect(ScrollPhysics.HandleMouseRelease, l_12_0)
   l_12_0.HitBox.onMouseMove:disconnect(ScrollPhysics.HandleMouseMove, l_12_0)
   if l_12_0.ListView ~= nil then
      local l_12_1 = l_12_0.ListView:GetLayout()
      if l_12_1 ~= nil then
         l_12_1.onMomentumFinish:disconnect(ScrollPhysics.OnMomentumFinish, l_12_0)
         l_12_1.onLowMomentum:disconnect(ScrollPhysics.OnLowMomentum, l_12_0)
      end
   end
end

ScrollPhysics.CancelBehaviorCallback = function(l_13_0)
   trace("ScrollPhysics:CancelBehaviorCallback\n")
   l_13_0.BehaviorCallback = nil
end

ScrollPhysics.SetBehaviorCallback = function(l_14_0, l_14_1)
   l_14_0:CancelBehaviorCallback()
   trace("ScrollPhysics:SetBehaviorCallback\n")
   if l_14_1 ~= nil then
      l_14_0.BehaviorCallback = l_14_1
   end
end


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -