---
-- @package   eg4-crank-ui
-- @file      scrollable-areas.lua
-- @brief     Functionality to stop touches occurring when scrolling layers.
--
-- @copyright Copyright 2019 Hanover Displays Limited.
-- @license   This program is the confidential and proprietary product of
--            Hanover Displays Limited. Any unauthorised use, reproduction or
--            transfer of this program is strictly prohibited. (Subject to
--            limited distribution and restricted disclosure only.) All
--            rights reserved.
--
--

-- Use to prevent touch events from operating while a layer is being dragged.  
local scroll_active = false
local scroll_delay_timer = nil

local function CBScrollActiveDelay()
  scroll_active = false
end

---
--- @brief  Gets the current scrolling active status.
--- @return true scroll is active.
---
function ScrollActive()
  return scroll_active
end

---
--- @brief  Starts the scrolling active indication
---
function CBScrollAreaDragStart() 
  if scroll_delay_timer ~= nil then
    gre.timer_clear_timeout(scroll_delay_timer)
    scroll_delay_timer = nil
  end
  scroll_active = true
end

---
--- @brief  Stops the scrolling active indication
---
function CBScrollAreaDragStop() 
  scroll_delay_timer = gre.timer_set_timeout(CBScrollActiveDelay, 500)
end

-- EOF --
