function calcluateEqualizerCursorRect(focusPosition, boarderLeft, boarderRight, boarderTop, boarderBottom, widgetWidth, widgetHeight, numberOfSliders) visibleWidth = widgetWidth - (boarderLeft+boarderRight) visibleHeight = widgetHeight - (boarderTop+boarderBottom) cursorWidth = visibleWidth / numberOfSliders; cursorPositionX = boarderLeft + focusPosition * cursorWidth; return {x=cursorPositionX, y=0.0, z=boarderBottom }, {x=cursorWidth, y=0.0, z=visibleHeight } end function calculateSliderIndexByTouchFunc(touchPosX, touchPosY, boarderLeft, boarderRight, boarderTop, boarderBottom, widgetWidth, widgetHeight, numberOfSliders) visibleWidth = widgetWidth - (boarderLeft+boarderRight) visibleHeight = widgetHeight - (boarderTop+boarderBottom) cursorWidth = visibleWidth / numberOfSliders; local posX = ((touchPosX + 1.0)/2.0) * widgetWidth local posY = ((touchPosY + 1.0)/2.0) * widgetHeight local sliderIndex = -1 if boarderBottom < posY and posY < widgetHeight + boarderTop then -- if the position is inside hight of slide for var=0,numberOfSliders-1 do cursorPositionX = boarderLeft + var * cursorWidth + cursorWidth; if posX < cursorPositionX then sliderIndex = var break end end end return sliderIndex end function calculateSliderCurrentValueByTouchFunc(touchPosX, touchPosY, widgetWidth, widgetHeight, numberOfSliders, sliderWidth, sliderHeight, gapWidth, gapLeft, gapBottom, minValue, maxValue) local posX = ((touchPosX + 1.0)/2.0) * widgetWidth local posY = ((touchPosY + 1.0)/2.0) * widgetHeight local newSliderValue = 0 local hasTouched = false local sliderIndex = 0 if sliderHeight == 0 then return hasTouched, newSliderValue, sliderIndex end if gapBottom < posY and posY < gapBottom + sliderHeight then -- if the position is inside hight of slide for sliderNr=1,numberOfSliders do local sliderOffsetPos = (sliderNr-1) * (gapWidth + sliderWidth) + gapLeft if sliderOffsetPos < posX and posX < sliderOffsetPos + sliderWidth then newSliderValue = minValue + ((posY - gapBottom)/ sliderHeight) * (maxValue - minValue) hasTouched = true sliderIndex = sliderNr - 1 break end end end if newSliderValue < minValue then newSliderValue = minValue elseif newSliderValue > maxValue then newSliderValue = maxValue end return hasTouched, newSliderValue, sliderIndex end function calculateZBETouchValueOffset(touchInputDragOffsetY, minValue, maxValue) local offset = touchInputDragOffsetY * (maxValue - minValue) / 2.0 return offset end