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

Openlayers popup plugin pan map fix #322

Merged
merged 5 commits into from
Mar 29, 2018

Conversation

okauppinen
Copy link
Contributor

_panMapToShowPopup is used to pan map if infobox isn't entirely in the viewport (screen). If map is moving or ShowInfoBoxRequest's given position (lonlat) isn't in the current viewport, pixels for pan might be calculated wrongly. Now map pan is done only if popups position (lonlat) is in the current viewport. If you want to show popup outside current viewport, you have to make mapmoverequest first.

Also pixels calculations for pan map is fixed. Now supported ol.OverlayPositionings are calculated correctly. Before _panMapToShowPopup presumed that overlay's positioning is always 'top-left' (point's location) -> popup is rendered right and down from location. Now if ol.OverlayPositioning isn't defined ('no-position-info') -> 'top-left' positioning is used for calculations.

Object.keys(posClasses).forEach(function (pos){
if (positioning === posClasses[pos]){
positionX = positioning.split("-")[1];
positionY = positioning.split("-")[0];
Copy link
Member

Choose a reason for hiding this comment

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

Split once and take the results:

var popupDirection = positioning.split("-");
positionY = popupDirection[0];
positionX = popupDirection[1];

@ZakarFin ZakarFin added this to the 1.46.0 milestone Mar 29, 2018
@ZakarFin ZakarFin merged commit faaf9ea into oskariorg:develop Mar 29, 2018
@okauppinen okauppinen deleted the feature/pan-map branch March 26, 2019 12:40
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.

2 participants