Leaflet.DistortableImage icon indicating copy to clipboard operation
Leaflet.DistortableImage copied to clipboard

Events for selecting

Open tsparksh opened this issue 5 years ago β€’ 11 comments

Fixes #460

Make sure these boxes are checked before your pull request (PR) is ready to be reviewed and merged. Thanks!

  • [x] PR is descriptively titled πŸ“‘ and links the original issue above πŸ”—
  • [x] tests pass -- look for a green checkbox βœ”οΈ a few minutes after opening your PR -- or run tests locally with grunt
  • [x] code is in uniquely-named feature branch and has no merge conflicts πŸ“
  • [x] screenshots/GIFs are attached πŸ“Ž in case of UI updates
  • [x] @mention the original creator of the issue in a comment below for help or for a review

Example:

$(img).on("deselectImage", function() {
  console.log("deselected");
});

$(img).on("selectImage", function() {
  console.log("selected");
});

select-events

tsparksh avatar Dec 24 '19 10:12 tsparksh

I used selectImage because select event is already used in jQuery

(Tests works fine with #493)

tsparksh avatar Dec 24 '19 11:12 tsparksh

Hey @tsparksh are you working on this? The task is open on Github

Uzay-G avatar Dec 31 '19 13:12 Uzay-G

@Uzay-G, on the gci dashboard for some reason there are two identical tasks with a link to this issue, my task is marked as accepted

tsparksh avatar Dec 31 '19 13:12 tsparksh

Ok alright thanks

Uzay-G avatar Dec 31 '19 13:12 Uzay-G

This is optional, but instead of using jQuery and adding it to the test dependecies you could have done this in JavaScript:

var selectImageEvent = new Event('selectImage');
this.dispatchEvent(selectImageEvent);

VladimirMikulic avatar Jan 10 '20 02:01 VladimirMikulic

also I think running this and pushing will fix your travis build:

$ rm -rf package-lock.json node_modules
$ npm install

sashadev-sky avatar Jan 10 '20 06:01 sashadev-sky

I can’t fix it in the next week, but I’ll definitely do it as I return, thanks!

On 10 Jan 2020, at 13:49, Sasha Boginsky [email protected] wrote:

ο»Ώ also I think running this and pushing will fix your travis build:

$ rm -rf package-lock.json node_modules $ npm install β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

tsparksh avatar Jan 10 '20 09:01 tsparksh

@tsparksh okay no problem! Please note that the mentor approved the task for you so that you could move on to others in my absence, but you still need to complete them (merged PR) to actually get the points!

sashadev-sky avatar Jan 10 '20 10:01 sashadev-sky

Usage:

image = img._image
image.addEventListener("selectImage", function(event) {
    console.log(event.type);
  });
image.addEventListener("deselectImage", function(event) {
    console.log(event.type);
  });

events

tsparksh avatar Jan 19 '20 13:01 tsparksh

@sashadev-sky, can you check, please

tsparksh avatar Jan 19 '20 13:01 tsparksh

I agree @sashadev-sky. Consistency is important. I didn't know that fire method existed, but know that I know we should definitely use it instead of 'manually' creating an event and dispatching it.

VladimirMikulic avatar Jan 27 '20 01:01 VladimirMikulic