1
|
/*
|
2
|
Author: Cameron Shorter cameronATshorter.net
|
3
|
License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
|
4
|
|
5
|
$Id$
|
6
|
*/
|
7
|
|
8
|
// Ensure this object's dependancies are loaded.
|
9
|
mapbuilder.loadScript(baseDir+"/tool/ToolBase.js");
|
10
|
|
11
|
/**
|
12
|
* Tool which processes mouse clicks on a widget.
|
13
|
* The tool must be enabled before use by calling tool.enable(true);
|
14
|
* This tool registers mouse event listeners on the parent widget.
|
15
|
* This tool works entirely in pixel/line coordinate space and knows nothing
|
16
|
* about geography.
|
17
|
* @constructor
|
18
|
* @base ToolBase
|
19
|
* @param toolNode The node for this tool from the configuration document.
|
20
|
* @param model The model object that contains this tool
|
21
|
*/
|
22
|
function MouseClickHandler(toolNode, model) {
|
23
|
ToolBase.apply(this, new Array(toolNode, model));
|
24
|
|
25
|
/**
|
26
|
* Process a mouse click action.
|
27
|
* @param objRef Pointer to this MouseClickHandler object.
|
28
|
* @param targetNode The node for the enclosing HTML tag for this widget.
|
29
|
*/
|
30
|
this.clickHandler = function(objRef,targetNode) {
|
31
|
objRef.model.setParam("clickPoint", targetNode.evpl);
|
32
|
}
|
33
|
|
34
|
model.addListener('mouseup',this.clickHandler,this);
|
35
|
}
|