Leaflet.DistortableImage
Leaflet.DistortableImage copied to clipboard
Events for selecting
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");
});
I used selectImage
because select
event is already used in jQuery
(Tests works fine with #493)
Hey @tsparksh are you working on this? The task is open on Github
@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
Ok alright thanks
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);
also I think running this and pushing will fix your travis build:
$ rm -rf package-lock.json node_modules
$ npm install
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 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!
Usage:
image = img._image
image.addEventListener("selectImage", function(event) {
console.log(event.type);
});
image.addEventListener("deselectImage", function(event) {
console.log(event.type);
});
@sashadev-sky, can you check, please
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.