InputEventScreenDrag

继承: InputEventFromWindow < InputEvent < Resource < RefCounted < Object

代表屏幕拖拽事件。

描述

存放与屏幕拖拽事件相关的信息。见 Node._input

教程

属性

int

index

0

bool

pen_inverted

false

Vector2

position

Vector2(0, 0)

float

pressure

0.0

Vector2

relative

Vector2(0, 0)

Vector2

screen_relative

Vector2(0, 0)

Vector2

screen_velocity

Vector2(0, 0)

Vector2

tilt

Vector2(0, 0)

Vector2

velocity

Vector2(0, 0)


属性说明

int index = 0 🔗

  • void set_index(value: int)

  • int get_index()

多次拖动事件中的拖动事件索引。


bool pen_inverted = false 🔗

  • void set_pen_inverted(value: bool)

  • bool get_pen_inverted()

正在使用手写笔的橡皮端时,会返回 true


Vector2 position = Vector2(0, 0) 🔗

节点所在视口中的拖动位置,使用该视口的坐标系。


float pressure = 0.0 🔗

  • void set_pressure(value: float)

  • float get_pressure()

表示用户对笔施加的压力。范围从 0.01.0


Vector2 relative = Vector2(0, 0) 🔗

相对于前一位置(上一帧的位置)的拖动位置。

注意:relative 根据内容缩放系数自动缩放,内容缩放系数由项目的拉伸模式设置定义。这意味着在处理触摸瞄准的脚本中使用 relative 时,触摸灵敏度将根据分辨率而有所不同。为了避免这种情况,请改用 screen_relative


Vector2 screen_relative = Vector2(0, 0) 🔗

  • void set_screen_relative(value: Vector2)

  • Vector2 get_screen_relative()

相对于屏幕坐标中的上一个位置(上一帧的位置)的未缩放拖动位置。该位置根据内容缩放系数或调用 InputEvent.xformed_by 进行缩放。无论项目的拉伸模式如何,对于触摸瞄准来说,这都应该优先于 relative


Vector2 screen_velocity = Vector2(0, 0) 🔗

  • void set_screen_velocity(value: Vector2)

  • Vector2 get_screen_velocity()

屏幕坐标中未缩放的拖动速度(单位为每秒像素数)。该速度不会根据内容缩放系数或对 InputEvent.xformed_by 的调用进行缩放。无论项目的拉伸模式如何,对于触摸瞄准来说,这都应该优先于 velocity


Vector2 tilt = Vector2(0, 0) 🔗

代表笔的倾斜角度。正的 X 坐标值表示向右倾斜。正的Y坐标值表示向用户自身倾斜。两个轴的范围是 -1.01.0


Vector2 velocity = Vector2(0, 0) 🔗

拖动速度。

注意:velocity 根据内容缩放系数自动缩放,内容缩放系数由项目的拉伸模式设置定义。这意味着在处理触摸瞄准的脚本中使用 velocity 时,触摸灵敏度将根据分辨率而表现不同。为了避免这种情况,请改用 screen_velocity