summaryrefslogtreecommitdiffstats
path: root/qooxdoo/source/class/Smokeping/ui/MPosition.js
diff options
context:
space:
mode:
Diffstat (limited to 'qooxdoo/source/class/Smokeping/ui/MPosition.js')
-rw-r--r--qooxdoo/source/class/Smokeping/ui/MPosition.js53
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;
+ }
+ }
+
+
+});
+
+