blob: 74b709d5c575b54d3cfc5d832be7429e2c6a5e93 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
/* ************************************************************************
#module(Smokeping)
************************************************************************ */
/**
* some mouse handling routines for thegraph mover and zoomer.
*/
qx.Mixin.define('Smokeping.ui.MPosition',
{
members: {
_init_cache: function(){
var el = this._target.getElement();
this._page_left = qx.html.Location.getPageAreaLeft(el);
this._page_top = qx.html.Location.getPageAreaTop(el);
this._image_width = qx.html.Location.getPageAreaRight(el) - this._page_left;
this._image_height = qx.html.Location.getPageAreaBottom(el) - this._page_top ;
this._canvas_top = this._top;
this._canvas_left = this._image_width-this._width-this._right;
this._canvas_right = this._right;
this._canvas_bottom = this._image_height-this._height-this._top;
},
_get_mouse_y: function(e){
var mouse_y = e.getPageY()-this._page_top;
if (mouse_y < this._canvas_top) {
mouse_y = this._canvas_top;
}
if (mouse_y > this._canvas_top + this._height) {
mouse_y = this._canvas_top + this._height;
}
return mouse_y;
},
_get_mouse_x: function(e){
var mouse_x = e.getPageX()-this._page_left;
if (mouse_x < this._canvas_left) {
mouse_x = this._canvas_left;
}
if (mouse_x > this._canvas_left + this._width) {
mouse_x = this._canvas_left + this._width;
}
return mouse_x;
}
}
});
|