Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Can sequential selection be improved? #32

Closed
mkucej opened this issue Apr 23, 2020 · 5 comments
Closed

Can sequential selection be improved? #32

mkucej opened this issue Apr 23, 2020 · 5 comments
Labels

Comments

@mkucej
Copy link

mkucej commented Apr 23, 2020

Thank you for this great library. We use it to allow users to select text and add highlights to PDFs in a web browser. The issue is that when a user starts the lasso outside of the first element, all previous elements are added to the selection. This can be reproduced in your demo page for 'lassoSelect` option. We work around the issue like this:

let selectable = new Selectable({
    lassoSelect: 'sequential'
});

selectable.on('start', function (e, item) {
    if(typeof item === 'object') {
        // User started the lasso inside an item. Allow selecting.
        This.selectable.off('end');
        This.selectable.on('end', method);
    } else {
        // User started the lasso outside an item. Disallow selecting.
        This.selectable.off('end');
    }
});

Just thought I would let you know of this.

@Mobius1 Mobius1 added the bug label Apr 24, 2020
@Mobius1
Copy link
Owner

Mobius1 commented Apr 24, 2020

I can't seem to reproduce this. What browser are you using?

@mkucej
Copy link
Author

mkucej commented Apr 24, 2020

Thanks for the quick answer. I should have been more clear. Try it like this:

  1. Place the cursor in the white space between square 14 and 15.
  2. Drag the cursor to the right and down to select.

You will see that all squares were selected starting from the 1st, although the user probably wanted to start from square 15. The problem occurs in all browsers I tried — FF, Chrome, Edge.

@Mobius1
Copy link
Owner

Mobius1 commented Apr 24, 2020

That did it. I'll have a look what's going on and get a fix out.

@Mobius1 Mobius1 reopened this Apr 24, 2020
@Mobius1
Copy link
Owner

Mobius1 commented Apr 24, 2020

This should be fixed in the latest release.

@mkucej
Copy link
Author

mkucej commented Apr 24, 2020

Works well. Thanks!

@Mobius1 Mobius1 closed this as completed Apr 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants