GuiTouchPinch

Constructor:

GuiTouchPinch({ newtouch1.position, newtouch2.position }, scale , pinchspeed, touchState)

Description

This event is triggered when two fingers are pinched or pulled apart on the GUI object.

Parameters

Name Type Description
{ newtouch1.position, newtouch2.position } table {TouchPoint1 position, TouchPoint2 position}
scale float Zoom factor. >1: zoom in; <1: zoom out
pinchspeed float Zoom speed
touchState Enum.UserInputState Input type state

Examples

Add the following client script under ClientfirstLogic. Start the game. Touch on the mobile phone and pinch or pull apart the fingers. Observe whether the event is triggered or not.

wait(1)
local uipanel = RWObject.Create("UiPanel") -- create a UiPanel
local uibtn = RWObject.Create("UiButton") -- create a UiButton
uibtn.Parent = uipanel -- set the parent of the created UiButton to the new created UiPanel
local person = Players:GetLocalPlayer() -- retrieve the player
uipanel.Parent = person. GameUI -- Set the parent of the UiPanel as GameUI
uibtn.TouchPinch:Connect(function(table,dir,speed,state) -- register the event that is triggered when pinching or pulling apart fingers on the GUI object for the UiButton
      uibtn.ImageColor = Vector3.New(255,0,0) -- the button turns red
    print("The event of pinching or pulling apart fingers on the GUI object is triggered")
    for k,v in pairs(table) do
        print("Axis in the table:" ..tostring(k).."      ".." Target point in the table:" ..tostring(v))
    end
    print(tostring(dir))
    print(tostring(speed))
    print(tostring(state))
end)