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

Update L.LatLng initialization syntax Pt.3 #250

Closed
6 tasks
sashadev-sky opened this issue May 8, 2019 · 15 comments
Closed
6 tasks

Update L.LatLng initialization syntax Pt.3 #250

sashadev-sky opened this issue May 8, 2019 · 15 comments

Comments

@sashadev-sky
Copy link
Member

First Time?

This is a first-timers-only issue. This means we've worked to make it more legible to folks who either haven't contributed to our codebase before, or even folks who haven't contributed to open source before.

If that's you, we're interested in helping you take the first step and can answer questions and help you out as you do. Note that we're especially interested in contributions from people from groups underrepresented in free and open source software!

We know that the process of creating a pull request is the biggest barrier for new contributors. This issue is for you 💝

If you have contributed before, consider leaving this one for someone new, and looking through our general help wanted issues. Thanks!

🤔 What you will need to know.

Nothing. This issue is meant to welcome you to Open Source :) We are happy to walk you through the process.

The problem

Same deal as part 1 (#248) and part 2 (#249):

What's supposed to happen:

From the official Leaflet docs:

Class Factories
You may have noticed that Leaflet objects are created without using the new keyword. This is achieved by complementing each class with a lowercase factory method:

new L.Map('map'); // becomes:
L.map('map');

What actually does happen:

We use Leaflet's built-in L.LatLng to initialize the starting positions of our images corners, but we don't take advantage of their suggested class factory syntax. Let's update the code in the files indicated below.

Solution

Where to find the relevant lines of code:

Remove the new keyword from the following code blocks and update L.LatLng to L.latLng :

distortable = L.distortableImageOverlay('/examples/example.jpg', {
corners: [
new L.LatLng(41.7934, -87.6052),
new L.LatLng(41.7934, -87.5852),
new L.LatLng(41.7834, -87.5852),
new L.LatLng(41.7834, -87.6052)
]
}).addTo(map);

distortable = L.distortableImageOverlay('/examples/example.png', {
corners: [
new L.LatLng(41.7934, -87.6052),
new L.LatLng(41.7934, -87.5852),
new L.LatLng(41.7834, -87.5852),
new L.LatLng(41.7834, -87.6052)
]
}).addTo(map);

distortable = L.distortableImageOverlay('/examples/example.jpg', {
corners: [
new L.LatLng(41.7934, -87.6052),
new L.LatLng(41.7934, -87.5852),
new L.LatLng(41.7834, -87.5852),
new L.LatLng(41.7834, -87.6052)
]
}).addTo(map);

Thanks!!

Step by Step

  • Claim this issue with a comment here, below, and ask any clarifying questions you need
  • Fork the repository and set it up locally following the main repo README instructions https://github.com/publiclab/Leaflet.DistortableImage
  • Create a new feature branch with a unique name descriptive to the issue
  • Try to fix the issue following the steps above, but even before you're done, you can:
    commit your changes to your branch and start a pull request (see contributing to Public Lab software) but mark it as "in progress" if you have questions or if you haven't finished
  • Reference this issue in your pull request body
  • Once you submit your pull request, if there's an additional checklist provided for getting it merged, get those boxes checked off. Either way, mention me @sashadev-sky for a review.

Please keep us updated

💬⏰ - We encourage contributors to be respectful to the community and provide an update within a week of claiming a first-timers-only issue. We're happy to keep it assigned to you as long as you need if you update us, but if we don't see any activity a week after you claim it we may reassign it to give someone else a chance. Thank you in advance!

If this happens to you, don't sweat it! Grab another open issue.

💬 Get help

If you need any help - here are some options:

@sashadev-sky
Copy link
Member Author

assigned to @Prasanth-N!

@sashadev-sky
Copy link
Member Author

sashadev-sky commented May 29, 2019

reassigned to @Esh08! Other user never took this up

@Beachyesh
Copy link

Hey, @sashadev-sky I feel like I've made a mistake with my branches, I wasn't able to make my own, so I chose leaflet-src-change. However I'm guessing, I'm supposed to commit changes to main? Please let me know x

@sashadev-sky
Copy link
Member Author

@Esh08 thanks for the PRs! So you opened 4 of them, #277 is merging to the wrong branch, but it looks like you figured out to commit to main in #278 #279 as these are correct.

#275 is addressing a closed PR. The reason you are seeing the old code is because you were on the leaflet-src-change branch, which is 130 commits behind main. So I have closed this PR.

For the others, these would all be better under one PR / feature branch because they are resolving a single issue and not complex enough for splitting up. I think the github webflow only supports editing 1 file, although there are workarounds, so it'll probably be easier to resolve this from the command line. You can either: move the other changes to #279 (hard), redo them and push them to #279 (medium), or just open a new PR and redo all of them (easy). Feel free to resolve it however you'd like!

@Beachyesh
Copy link

Beachyesh commented May 30, 2019 via email

@sashadev-sky
Copy link
Member Author

@Esh08 Don't worry! I closed the PRs you opened and i'll explain

main is where all the updated code is and when you are on the main branch and create a new one (your own feature branch) that branch will have the same code as in main.

One of the benefits of always working on a feature branch is that you can commit changes and push them up, and while you're waiting for them to get reviewed you can open a new feature branch from main that won't have those unmerged changes. So you can build as many features as you want in parallel that aren't dependent on eachother, and push them up as separate PRs.

If you keep opening new branches off main for each change you make, you are working from the clean slate each time. What you need to do instead is make the changes on one branch, and keep committing and pushing to that branch.

Here are the steps for getting this done on the command line:

  1. Fork the main repo from the main page https://github.com/publiclab/Leaflet.DistortableImage, otherwise you'll only get anonymous credit
  2. clone your forked version by clicking the "clone or download" button - copy paste the url given and use the command $ git clone <paste_url> locally
  3. Follow the README instructions for any local setup
  4. Make your changes on a new feature branch (create this with $ git checkout -b <new_branch_name> and use $ git branch to make sure you are on this branch)
  5. $ git push origin <new_branch_name> to submit a pull request then visit the main repo page on Github and you'll see a prompt to create your PR

We can discuss OSS after! Let me know if you have more questions :)

@Beachyesh
Copy link

Beachyesh commented Jun 1, 2019 via email

@sashadev-sky
Copy link
Member Author

Yes open only one feature branch. fix all the files there. commit them. then push them up:

$ git push origin <branch_name>

@Beachyesh
Copy link

Beachyesh commented Jun 4, 2019 via email

@sashadev-sky
Copy link
Member Author

yes! this should clone the repository, then you can cd into it. Are you having trouble with that part?@Esh08

@sashadev-sky
Copy link
Member Author

@Esh08 if you need any live help feel free to message me in our gitter chatroom, linked at the bottom of this PR description!

@Beachyesh
Copy link

Beachyesh commented Jun 6, 2019 via email

@sashadev-sky
Copy link
Member Author

@Esh08 no problem mention me @sashadev-sky and lmk here when you do because it's very easy to miss github messages

@sashadev-sky
Copy link
Member Author

@Esh08 going to assume you are not working on this anymore and solve it in my PR #274 where I'm already doing a lot of refactoring. If you ping me before thats merged and still want it you can of course still upload a PR for it and i'll accept it!

@sashadev-sky
Copy link
Member Author

closed via #274

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants