jquery set mouse position inside a <div> graphic area

柔情痞子 提交于 2019-12-11 04:49:59

问题


using http://www.flotcharts.org/ to realize a complex scatterplot graphic with zoom/pan functionalities, i would like to set mouse position at specific coordinates (by example: when doing a zoom in, I would like that cursor would positioned at the center of canvass).

It ssem this function doesn't work:

  function setMousePosition(pos) {

  var x = pos.x;
  var y = pos.y;

  var pointX = ( Math.floor(plot.offset().left + plot.p2c(pos).left) );
  var pointY = ( Math.floor(plot.offset().top + plot.p2c(pos).top) );

 $("#placeholder").mouseXPos( pointX ).`mouseYPos`( pointY );

About mouseXPos and mouseYPos, firebug say: TypeError: placeholder.mouseXPos is not a function

So my question is: there is a way in javascript or jquery to set mouse coordinates inside a graphic area ?


回答1:


There is no any mechanism to place a cusror to specific position programmatically in Javascript




回答2:


The mouse position cannot be set/changed via JavaScript.



来源:https://stackoverflow.com/questions/13320727/jquery-set-mouse-position-inside-a-div-graphic-area

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!