Name: intersect

Type: function

Syntax: intersect(<object>, <object> [, <threshold>] )

Summary: <return|Returns> true if two <object|objects> overlap, false otherwise.

Introduced: 1.0

OS: mac,windows,linux,ios,android

Platforms: desktop,server,web,mobile

Example:
intersect(field "Comment",the selectedField)

Example:
if intersect(button "target", button "crosshairs") then flashScreen

Example:
if intersect(graphic "spaceship", graphic "asteroid", "opaque pixels") then endGame

Example:
answer intersect(image "gradient", grc "solid",125)

Parameters:
object: an object reference.
threshold (enum): The amount of transparency that pixels in the objects must have in order to be counted during the intersect calculation. Alternative (readable) theshold options
- "alpha value": An integer between 0 and 255 which specifies a threshold that the alpha value of each pixel must be greater than or equal to in order to be counted during calculation of the intersect.
- ""bounds"": (Equivalent to using an alpha value of 0) Specifies that the intersect is calculated using the rect of the two objects.
- ""pixels"": (Equivalent to using an alpha value of 1) Specifies that the intersect is calculated using pixels of the objects that have are not completely transparent, ignoring completely transparent areas.
- ""opaque pixels"": (Equivalent to using an alpha value of 255) Specifies that the intersect is calculated using only pixels that are completely opaque.

Returns (bool): The <intersect> <function> <return|returns> true or false.

Description:
Use the <intersect> <function> to determine whether one <object> obscures part of another <object>, or whether one <object> is over another <object>.

If both objects are <stacks> or <card(object)|cards>, the <intersect> <function> <return(glossary)|returns> true if the <stack window|stack windows> overlap.

The <intersect> <function> uses screen coordinates for <stacks> and <card(object)|cards>, and <relative coordinates|window coordinates> for <control(object)|controls>. This means that if one <object> is a <stack> or <card(keyword)> and the other is a <control(keyword)>, the <intersect> <function> does not <return(constant)> a reliable result.

References: layer (property), function (control_st), card (keyword), control (keyword), return (constant), within (function), stacks (function), relative coordinates (glossary), return (glossary), stack window (glossary), card (object), object (object), stack (object), control (object)

Tags: ui
