GPUI.Transfer.Event (gpui v0.2.0-rc.1)

Copy Markdown View Source

A bounded renderer-independent drag/drop event fact.

position is expressed in the closed :window_native_pixels coordinate space. External paths in payload always name resources on the machine running the display; this value does not read or interpret them.

Summary

Functions

Normalizes a native wire map or validates an existing transfer event value.

Normalizes a transfer event value or raises ArgumentError.

Converts a canonical transfer event into its serializable native/remote wire map.

Returns whether a term is a supported drag/drop event type.

Types

coordinate_space()

@type coordinate_space() :: :window_native_pixels

position()

@type position() :: {number(), number()}

t()

@type t() :: %GPUI.Transfer.Event{
  coordinate_space: coordinate_space(),
  payload: GPUI.Transfer.Payload.t() | nil,
  position: position(),
  session_id: pos_integer(),
  target_id: String.t()
}

type()

@type type() :: :drag_enter | :drag_move | :drag_leave | :drop

Functions

normalize(type, value)

@spec normalize(type(), t() | map()) :: {:ok, t()} | {:error, term()}

Normalizes a native wire map or validates an existing transfer event value.

normalize!(type, value)

@spec normalize!(type(), t() | map()) :: t()

Normalizes a transfer event value or raises ArgumentError.

to_payload(value)

@spec to_payload(t()) :: map()

Converts a canonical transfer event into its serializable native/remote wire map.

type?(type)

@spec type?(term()) :: boolean()

Returns whether a term is a supported drag/drop event type.