1.21 gigawatts
1.21 gigawatts

Reputation: 17878

How to check if the mouse is down in AceEditor

I run computationally expensive code when the cursor changes and this becomes obvious when the user is selecting a lot of text.

I'd like to know if the mouse is down or up so I can ignore the cursor change events if the user is dragging. When they let go of the mouse down button I can run my code on mouse up or on cursor change events when the mouse is up.

Is there a way to tell if the mouse is down in ace editor?

Upvotes: 0

Views: 602

Answers (2)

Harsha pps
Harsha pps

Reputation: 2218

You can use event listeners on ace editor. The mousedown event should help you in this case.

editor.on("mousedown", function () {
      console.log("mouse down");
});

Upvotes: 2

a user
a user

Reputation: 24169

There is editor.$mouseHandler.isMousePressed property.

Upvotes: 1

Related Questions