How can I trigger mouse up at the specific position

Viewed 294

I tried to trigger mousedown event at the specific position using jQuery.

What I need is to implement mousedown event at the specified coordinates and mouseup event also.

So I am going to implement mouse drag event automatically when I click any button. Is it possible on canvas?

This is my attempt

$('#clickMe').click(function() {
  $("#map-canvas").trigger("mousedown",  { which: 1, pageX: 1057, pageY: 770 });
  $("#map-canvas").trigger("mouseup", { which: 1, pageX: 370, pageY: 541 });
  $("#map-canvas").off("mousedown").on("mousedown", function (e) {
    console.log('#### DEBUG CLICK: ', e);
  });
  $("#map-canvas").off("mouseup").on("mouseup", function (e) {
    console.log('#### DEBUG CLICK EVENT: ', e); // fixme
  });
});

Trigger`s action is okay. But I can not mousedown event at the expectation position. My Issue

How can I implement it? Thanks.

0 Answers
Related