Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

After prolong usage "selection-changed" stop firing #1654

Closed
amitm02 opened this issue Aug 17, 2017 · 3 comments
Closed

After prolong usage "selection-changed" stop firing #1654

amitm02 opened this issue Aug 17, 2017 · 3 comments

Comments

@amitm02
Copy link

amitm02 commented Aug 17, 2017

After some prolog usage, selection-changed" events stop firing.
probably related to #1584

I've manage to track to problem to the following:

this.emitter.listenDOM('selectionchange', document, function () {
      if (mouseCount === 0) {
        setTimeout(_this.update.bind(_this, _emitter4.default.sources.USER), 1);
      }
    });

A breakpoint on that method revealed that mouseCount has a value > 0 (it was 8) and going up with each click.

the mouse-up event handler, that was suppose to keep mouseCount at 0 does not fired, but I couldn't figure out why:

this.emitter.listenDOM('mouseup', document.body, function () {
      mouseCount -= 1;
      if (mouseCount === 0) {
        _this.update(_emitter4.default.sources.USER);
      }
    });
@HWliao
Copy link

HWliao commented Aug 18, 2017

root cause: mousedown was triggered,but the museup was not triggered.
an operation causes this problem:
1.Press the mouse in the browser and do not release it
2.Move the mouse outside the browser
3.Release the mouse
Maybe we can write it like this:

    let mouseCount = 0;
    this.emitter.listenDOM('mousedown', document.body, () => {
      mouseCount  = 1;
    });
    this.emitter.listenDOM('mouseup', document.body, () => {
      mouseCount  = 0;
      if (mouseCount === 0) {
        this.update(Emitter.sources.USER);
      }
    });
    this.emitter.listenDOM('selectionchange', document, () => {
      if (mouseCount === 0) {
        setTimeout(this.update.bind(this, Emitter.sources.USER), 1);
      }
    });

The next time the mouse is uped, it can fix the mouseCount = 0
But not perfect`

@jhchen jhchen closed this as completed in 57d26fc Aug 28, 2017
@jhchen
Copy link
Member

jhchen commented Aug 28, 2017

Thanks for looking into the cause @HWliao !

@sshearer-rsm
Copy link

Is there any idea on the timing for the next version with this commit?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants