B.3.2.2 Theme-Level Functions
Theme-level mouse event control functions can be defined for mouse-click, mouse-move, mouse-over, and mouse-out events.
A mouse-click event control function is called when theme feature
selection is enabled and a feature of the theme is clicked. Each theme in
the map can have its own mouse-click event control function. A theme-level
mouse-click event control function is specified by the onclick attribute in
the <theme>
element in the map request or base map
definition.
A mouse-move event control function is called whenever the mouse moves inside any
feature of the theme. Each theme in the map can have its own mouse-move
event control function. A theme-level mouse-move event control function is
specified by the onmousemove
attribute in the
<theme>
element in the map request or base map
definition.
A mouse-over event control function is called whenever the mouse moves from
outside a feature of the theme to inside a feature of the theme. Each theme
in the map can have its own mouse-over event control function. A theme-level
mouse-over event control function is specified by the
onmouseover
attribute in the
<theme>
element in the map request or base map
definition.
A mouse-out event control function is called whenever the mouse moves out of a
feature of the theme. Each theme in the map can have its own mouse-out event
control function. A theme-level mouse-out event control function is
specified by the onmouseout
attribute in the
<theme>
element in the map request or base map
definition.
These JavaScript functions must be defined in the web page that has the SVG map embedded. They take the following parameters:
- Theme name
- Key of the feature
- X-axis value of the point in the SVG viewer window where the mouse click occurred
- Y-axis value of the point in the SVG viewer window where the mouse click occurred
The key of the feature is the value of the key column from the base table, which
is specified by the key_column
attribute of the
<theme>
element in the map request or base map
definition. ROWID is used as the default key column. For example, if the
onclick
attribute is set to
selectCounty
for the COUNTY
theme,
the following JavaScript function call is executed if the feature with rowid
AAAHQDAABAAALk6Abm of the COUNTY
theme is clicked on the
SVG map at (100,120): selectCounty('COUNTY', 'AAAHQDAABAAALk6Abm',
100, 120)
.
The x-axis and y-axis values specify the coordinates inside the SVG viewer window where the mouse event occurred. The coordinate is defined in the local SVG viewer window coordinate system, which starts from (0,0) at the upper-left corner and ends at (width, height) at the lower-right corner.
Parent topic: User-Defined Mouse Event Control Functions