Learn R Programming

loon (version 1.4.1)

l_currentindex: Get layer-relative index of the item below the mouse cursor

Description

Checks if there is a visual item below the mouse cursor and if there is, it returns the index of the visual item's position in the corresponding variable dimension of its layer.

Usage

l_currentindex(widget)

Value

index of the visual item's position in the corresponding variable dimension of its layer

Arguments

widget

widget path as a string or as an object handle

Details

For more details see l_help("learn_R_bind.html#item-bindings")

See Also

l_bind_item, l_currenttags

Examples

Run this code
if(interactive()){

p <- l_plot(iris[,1:2], color=iris$Species)

printEntered <- function(W) {
    cat(paste('Entered point ', l_currentindex(W), '\n'))
}

printLeave <- function(W) {
    cat(paste('Left point ', l_currentindex(W), '\n'))
}

l_bind_item(p, tags='model&&point', event='',
            callback=function(W) {printEntered(W)})

l_bind_item(p, tags='model&&point', event='',
            callback=function(W) {printLeave(W)})

}

Run the code above in your browser using DataLab