Browse Source

working on relative mouse position

master
poikilos 9 years ago
committed by Jacob Gustafson
parent
commit
57843a7a18
  1. 14
      web/chunkymap.php

14
web/chunkymap.php

@ -1087,16 +1087,18 @@ function echo_chunkymap_canvas($show_player_names_enable, $decachunks_enable, $c
//} //}
function get_relative_mouse_point(e) { function get_relative_mouse_point(e) {
//formerly get_mouse_point
var xOffset=Math.max(document.documentElement.scrollLeft,document.body.scrollLeft); var xOffset=Math.max(document.documentElement.scrollLeft,document.body.scrollLeft);
var yOffset=Math.max(document.documentElement.scrollTop,document.body.scrollTop); var yOffset=Math.max(document.documentElement.scrollTop,document.body.scrollTop);
//return {
//x:parseInt(e.clientX+xOffset-my_canvas.offsetLeft),
//y:parseInt(e.clientY+yOffset-my_canvas.offsetTop)
//};
return { return {
x:parseInt(e.clientX+xOffset), x:parseInt(e.clientX+xOffset-my_canvas.offsetLeft),
y:parseInt(e.clientY+yOffset) y:parseInt(e.clientY+yOffset-my_canvas.offsetTop)
}; };
//return {
//x:parseInt(e.clientX+xOffset),
//y:parseInt(e.clientY+yOffset)
//};
} }
window.onload = function() { window.onload = function() {

Loading…
Cancel
Save