Hide Table of Contents
esri/dijit/util
esri/layer/pixelFilters
esri/process
esri/workers
Class: ScreenPoint

require(["esri/geometry/ScreenPoint"], function(ScreenPoint) { /* code goes here */ });

Description

(Added at v3.3)
ScreenPoint represents a point in terms of pixels relative to the top-left corner of the map control. Prior to version 3.3, a screen point was represented using a regular Point where the point object is defined without a spatial reference. 

Samples

Search for samples that use this class.

Constructors

NameSummary
new ScreenPoint(x, y)Creates a new ScreenPoint object with X-, Y- coordinates.
new ScreenPoint(coords)Creates a new ScreenPoint object with an array containing X-, Y- coordinates.
new ScreenPoint(json)Creates a new ScreenPoint object with a JSON object.

Properties

NameTypeSummary
xNumberX-coordinate relative to the top-left corner of the map control in pixels.
yNumberY-coordinate relative to the top-left corner of the map control in pixels.

Methods

NameReturn typeSummary
offset(dx, dy)ScreenPointOffsets the point in an x and y direction.
setX(x)ScreenPointSets x-coordinate of point.
setY(y)ScreenPointSets y-coordinate of point.
toJson()ObjectConverts object to its ArcGIS Server JSON representation.
update(x, y)ScreenPointUpdates a ScreenPoint.
Constructor Details

new ScreenPoint(x, y)

Creates a new ScreenPoint object with X-, Y- coordinates.
Parameters:
<Number> x Required X-coordinate relative to the top-left corner of the map control in pixels.
<Number> y Required Y-coordinate relative to the top-left corner of the map control in pixels.

new ScreenPoint(coords)

Creates a new ScreenPoint object with an array containing X-, Y- coordinates.
Parameters:
<Number[]> coords Required An array that includes X-, Y- coordinates. For example: [100,50].

new ScreenPoint(json)

Creates a new ScreenPoint object with a JSON object.
Parameters:
<Object> json Required A JSON object that includes X-, Y- coordinates.
Property Details

<Number> x

X-coordinate relative to the top-left corner of the map control in pixels.

<Number> y

Y-coordinate relative to the top-left corner of the map control in pixels.
Method Details

offset(dx, dy)

Offsets the point in an x and y direction.
Return type: ScreenPoint
Parameters:
<Number> dx Required Value for x-coordinate of point.
<Number> dy Required Value for y-coordinate of point.

setX(x)

Sets x-coordinate of point.
Return type: ScreenPoint
Parameters:
<Number> x Required Value for x-coordinate of point.

setY(y)

Sets y-coordinate of point.
Return type: ScreenPoint
Parameters:
<Number> y Required Value for y-coordinate of point.

toJson()

Converts object to its ArcGIS Server JSON representation.
Return type: Object

update(x, y)

Updates a ScreenPoint.
Return type: ScreenPoint
Parameters:
<Number> x Required X-coordinate relative to the top-left corner of the map control in pixels.
<Number> y Required Y-coordinate relative to the top-left corner of the map control in pixels.