diff options
author | Tobi Oetiker <tobi@oetiker.ch> | 2007-12-09 23:24:30 +0100 |
---|---|---|
committer | Tobi Oetiker <tobi@oetiker.ch> | 2007-12-09 23:24:30 +0100 |
commit | 7362792c380114c774fd01120c978360e81360d3 (patch) | |
tree | c0a2d3be2b6e4037be61010d3dc96db9273fa17d /qooxdoo/source/class/Smokeping/ui/MPosition.js | |
parent | 05eb797de4c547890e373587d768b88335d37c44 (diff) | |
download | smokeping-7362792c380114c774fd01120c978360e81360d3.tar.gz smokeping-7362792c380114c774fd01120c978360e81360d3.tar.xz |
initial
Diffstat (limited to 'qooxdoo/source/class/Smokeping/ui/MPosition.js')
-rw-r--r-- | qooxdoo/source/class/Smokeping/ui/MPosition.js | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/qooxdoo/source/class/Smokeping/ui/MPosition.js b/qooxdoo/source/class/Smokeping/ui/MPosition.js new file mode 100644 index 0000000..74b709d --- /dev/null +++ b/qooxdoo/source/class/Smokeping/ui/MPosition.js @@ -0,0 +1,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; + } + } + + +}); + + |