-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Removed zoomAnimation option #4699
Conversation
@fnicollet The unit tests are failing with the same symptoms I (and @yohanboniface) noticed today - we might need to check the popup offset manually before merging. |
Yes, I would say that this commit is the source of the unit test failing: |
Ok, I think I am beginning to understand. Before my PR, the tests fail when zoomAnimated is true, but succeed when zoomAnimated is false. The test is not just one the Popup's zoomAnimation : this._zoomAnimated = this._zoomAnimated && this.options.zoomAnimation; but also on "this._zoomAnimated", which comes from Layer.js: So it takes in account map's zoomAnimation. So my guess is that when running the tests in phantom, the map is set as not animated, probably this test is failing in that env: So basically, the tests have been written for the zoomAnimation=false edge case and not the zoomAnimation=true default case. So I would say, let's fix the tests instead? |
Should this test be removed? It tests for marker1._popup._container.style.left, which now always depends on the popup's width/height but doesn't give any indication of the popup's position relative to its anchor So I would ditch this test. Tell me if you want me to add it to the PR |
@fnicollet popup positioning would certainly deserve a bit of cleaning, but AFAIK even with your commit we are setting the bottom and left manually. So this test should pass IMHO. |
@@ -362,11 +353,7 @@ L.Popup = L.Layer.extend({ | |||
offset = L.point(this.options.offset), | |||
anchor = this._getAnchor(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should fix the failing test:
anchor = this._getAnchor(),
offset = L.point(this.options.offset).add(anchor),
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, _add
instead of add
to prevent a useless Point cloning.
Though I think we may have an issue when |
Here is what I understood from the code:
Both combined achieve the final placement of the popup. So if the test really wants to test popupAnchor, it should be changed to a test which account for both (using element.offsetLeft or something?) or removed |
Just saw your other comment, there will indeed be an issue if L.Browser.any3d is false as setPosition will change top left, and then it will set left/bottom right after and override what's been done in setPosition. |
@@ -286,7 +277,7 @@ L.Popup = L.Layer.extend({ | |||
var prefix = 'leaflet-popup', | |||
container = this._container = L.DomUtil.create('div', | |||
prefix + ' ' + (this.options.className || '') + | |||
' leaflet-zoom-' + (this._zoomAnimated ? 'animated' : 'hide')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we want to keep that.
Even if the Popup itself does not have a zoomAnimation
option, we want to listen to the animation capabilities of the browser and hide the popup when no animation will be made.
Unable to merge due to conflicts with the new tooltip/divoverlay code. Superseded by #4685 |
Removed zoomAnimation option in Popup
Fixes #4685