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

Toolbar positioning #201

Merged
merged 46 commits into from
Apr 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
a207da0
dist file
sashadev-sky Mar 24, 2019
766ded1
Merge branch 'main' of https://github.com/publiclab/Leaflet.Distortab…
sashadev-sky Mar 31, 2019
517c86a
Merge branch 'main' of https://github.com/publiclab/Leaflet.Distortab…
sashadev-sky Apr 4, 2019
1a960f2
Merge branch 'main' of https://github.com/publiclab/Leaflet.Distortab…
sashadev-sky Apr 6, 2019
729242c
Merge branch 'main' of https://github.com/publiclab/Leaflet.Distortab…
sashadev-sky Apr 11, 2019
f4ca34d
Merge branch 'main' of https://github.com/publiclab/Leaflet.Distortab…
sashadev-sky Apr 16, 2019
62a5448
Merge branch 'main' of https://github.com/publiclab/Leaflet.Distortab…
sashadev-sky Apr 20, 2019
df8a3a3
Fix toolbar positioning
sashadev-sky Mar 31, 2019
26414f2
Clean up code
sashadev-sky Mar 31, 2019
6e7427c
Clean
sashadev-sky Mar 31, 2019
ddc4755
toolbar marker overlap fix
sashadev-sky Apr 4, 2019
048b92c
Make toolbar dynamically update
sashadev-sky Mar 31, 2019
c7accf4
Fix toolbar positioning
sashadev-sky Mar 31, 2019
39cb1f6
Clean up code
sashadev-sky Mar 31, 2019
1efe4b8
Clean
sashadev-sky Mar 31, 2019
31a4834
toolbar marker overlap fix
sashadev-sky Apr 4, 2019
bccb57d
Standardize testing syntax
sashadev-sky Apr 4, 2019
049f589
Fix toggleRotateDistort hotkeys
sashadev-sky Apr 4, 2019
5242fe6
Clean up code
sashadev-sky Apr 4, 2019
8d3f2a4
Toolbar marker overlap alternative
sashadev-sky Apr 5, 2019
0db6bd6
remove onHandleDragEnd showToolbar
sashadev-sky Apr 5, 2019
b6db6d8
Rotating toolbar working no bugs
sashadev-sky Apr 5, 2019
87e03c2
Disable zoom animation to fix zoom glitch bug
sashadev-sky Apr 5, 2019
d5fd7c6
Toolbar moves dynamically
sashadev-sky Apr 5, 2019
672ccd8
Toolbar with multiple images
sashadev-sky Apr 11, 2019
75c5d39
Start ignoring bower_components
sashadev-sky Apr 11, 2019
e9d8c06
add bower_components to .gitignore
sashadev-sky Apr 11, 2019
d471080
Purposefully leave some code commented and explain why
sashadev-sky Apr 14, 2019
0f9c4ba
Update README to use getCorners() exposed API instead of private corners
sashadev-sky Apr 14, 2019
9716b9f
Update README
sashadev-sky Apr 15, 2019
893851d
Remove commented out lines
sashadev-sky Apr 15, 2019
ead4134
README extra whitespace removal
sashadev-sky Apr 15, 2019
7b72d3e
Stop rounding calculations
sashadev-sky Apr 15, 2019
504941d
implement greg-tarrs solution
sashadev-sky Apr 15, 2019
ff36e0f
remove obsolete test
sashadev-sky Apr 15, 2019
efdf05f
Remove forgotten commented code, comment code to remove soon
sashadev-sky Apr 15, 2019
bed7b8b
Put window method back
sashadev-sky Apr 15, 2019
fb5ffa2
Delete PULL_REQUEST_TEMPLATE.md
sashadev-sky Apr 17, 2019
cd20f65
Revert travis.yml back to previous state
sashadev-sky Apr 17, 2019
b0b6405
add code accidentally removed during rebase
sashadev-sky Apr 17, 2019
4618145
update getCorner
sashadev-sky Apr 20, 2019
eb7e507
Remove complex corner explanation from README until gain a better und…
sashadev-sky Apr 20, 2019
4b1af75
Remove handle zoom from prior implementation
sashadev-sky Apr 20, 2019
a1416c7
Remove final code from old implementation
sashadev-sky Apr 20, 2019
05933f0
undo deletion of PR template file
sashadev-sky Apr 20, 2019
588efdd
remove any changes to PR template in this PR
sashadev-sky Apr 20, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ todo.txt
*.swp
*.swo
package-lock.json
bower_components
26 changes: 22 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,18 +149,36 @@ ToggleOrder = EditOverlayAction.extend({

```

### Corners
## Corners

The corners are stored in `img._corners` as `L.latLng` objects, so after instantiating the image and moving it around, you can always access them like this:
The corners are stored as `L.latLng` objects
on the image, and can be accessed using our `getCorners()` method after the image is instantiated and added to the map.

Useful usage example:

```js
// instantiate and add to map
img = L.distortableImageOverlay(...);
img.addTo(map);
// move the image around
JSON.stringify(img._corners)

// grab the initial corner positions
JSON.stringify(img.getCorners())
=> "[{"lat":51.52,"lng":-0.1},{"lat":51.52,"lng":-0.14},{"lat":51.5,"lng":-0.1},{"lat":51.5,"lng":-0.14}]"

// ...move the image around...

// check the new corner positions.
JSON.stringify(img.getCorners())
=> "[{"lat":51.51091971397745,"lng":-0.015994012355804447},{"lat":51.51091971397745,"lng":-0.05599111318588257},{"lat":51.49093697986642,"lng":-0.015994012355804447},{"lat":51.49093697986642,"lng":-0.05599111318588257}]"

// note there is an added level of precision after dragging the image for debugging purposes

```

### Corner

We further added a `getCorner(idx)` method used the same way as its plural counterpart but with an index passed to it.

## Setup

1. From the root directory, run `npm install` or `sudo npm install`
Expand Down
Loading