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 rotate branch + Add improvements #7217

Closed
wants to merge 18 commits into from
Closed

Conversation

ronikar
Copy link
Contributor

@ronikar ronikar commented Jul 22, 2020

Fixes #Hi,
In The last year, I have worked with that repository, with rotate branch. In the last week I decided to update my local version (based 1.3.2) to the latest leaflet release #268. In the last time, I didn't know how to work with pull requests concept, but now, I will be more than happy to contribute some improvements that I did.

Summary of the changes:

  • Rebase rotate onto master (fix small problems)
  • Fix Draggble and Marker.Drag
  • Fix Popup

image

The pull request is from my local branch to master, because I made a rebase

@ronikar ronikar changed the title Update rotate branch + Add imporments Update rotate branch + Add improvements Jul 22, 2020
@ronikar
Copy link
Contributor Author

ronikar commented Jul 29, 2020

Hi @Keats,
I have seen that you tried to update rotate branch too. Do you have any suggestion to improve rotate-leaflet?

@Keats
Copy link

Keats commented Jul 29, 2020

I ran into some weird edge cases when rotating that were not obvious to debug so I haven't really used my branch.

@ronikar
Copy link
Contributor Author

ronikar commented Aug 3, 2020

Hi @johnd0e,
What do you think about my pull request?

Copy link
Collaborator

@johnd0e johnd0e left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should add related link pointing to previous discussion, or (even better) complete description of original rotate ideas.
Please also setup some online playground to let people to test new features easily.

src/dom/DomUtil.js Outdated Show resolved Hide resolved
@@ -210,28 +212,37 @@ export function testProp(props) {
// Resets the 3D CSS transform of `el` so it is translated by `offset` pixels
// and optionally scaled by `scale`. Does not have an effect if the
// browser doesn't support 3D CSS transforms.
export function setTransform(el, offset, scale) {
export function setTransform(el, offset, scale, bearing, pivot) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too many arguments, here and in setPosition.
May be it'd better to handle all rotation-related stuff separately.
Like, store them as properties, and apply automatically.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is based on the current version

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that you've only updated existing rotate branch.
Still I do not like that part.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by "handle all rotation-related stuff separately". Could you please expand on that? I don't quite understand what you mean by that.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for example separate function setRotation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got it 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed it :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I'm not sure that current implementation is convenient enough.
I do not like things like DomUtil.setPositionAndRotation.

I'd consider another approach: what if setRotation will just put _leaflet_rotate property into html el?
And DomUtil.setPosition will use that property to keep that rotation.

This is just an idea, I haven't reviewed all the things as a whole!

Copy link
Contributor Author

@ronikar ronikar Aug 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like that approach, I prefer to pass bearing as parameter. It can be very confusing

src/dom/DomUtil.js Outdated Show resolved Hide resolved
@@ -49,12 +49,14 @@ export var Draggable = Evented.extend({

// @constructor L.Draggable(el: HTMLElement, dragHandle?: HTMLElement, preventOutline?: Boolean, options?: Draggable options)
// Creates a `Draggable` object for moving `el` when you start dragging the `dragHandle` element (equals `el` itself by default).
initialize: function (element, dragStartTarget, preventOutline, options) {
initialize: function (element, dragStartTarget, preventOutline, options, map, anchor) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too many arguments.
May be better put them into options.

Also I have concerns about some edge cases: what if draggable is detached from initial map and reattached to another in run time?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a problem when draggable is reattached to another map with a different angle.

@johnd0e
Copy link
Collaborator

johnd0e commented Aug 6, 2020

Those are just preliminary comments, as I haven't checked your PR main functionality.

@ronikar
Copy link
Contributor Author

ronikar commented Aug 8, 2020

Just to be clear, my goal is to update rotate branch , not master.
My rotate branch has some problems, but it is better than the current version

@rblanca
Copy link

rblanca commented Aug 13, 2020

Good to see that some people are still working on this branch. Thanks!

@Azbesciak
Copy link

Hi, is it possible to also consider tilt change? vector tiles can be 3d. Take a look at https://www.google.com/search?q=leaflet+bearing+and+tilt&oq=leaflet+bearing+and+tilt&aqs=chrome..69i57.2970j0j7&sourceid=chrome&ie=UTF-8 also

@ronikar
Copy link
Contributor Author

ronikar commented Aug 21, 2020

@Azbesciak, I don't know how to consider tilt change because Leaflet map is a 2D map by definition.

@ronikar
Copy link
Contributor Author

ronikar commented Aug 24, 2020

I created leaflet-rotate-map package for those who want to use the latest leaflet version with rotation :)

@Azbesciak
Copy link

@ronikar maybe this post at stackexchange can help, also world3d is based on leaflet. Sorry - I though I posted a direct link before

@ronikar ronikar closed this Sep 21, 2020
@rblanca
Copy link

rblanca commented Sep 21, 2020

closed? so..its merged?. Thanks!

@johnd0e
Copy link
Collaborator

johnd0e commented Sep 21, 2020

so..its merged?

No.

@ronikar
Copy link
Contributor Author

ronikar commented Sep 21, 2020

closed? so..its merged?. Thanks!
Unfortunately, no :(

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

Successfully merging this pull request may close these issues.

8 participants