Hi there,

I have a wonderful Openlayers map with some custom markers that works really well. I have the 'Pop Up for Features' behavior enabled and it displays the title and description of my mapped companies.

Everything works really well, except for the fact that the pop-ups are, by default, extreeeemely wide, and do not stay within the current map window. Every time I click on a pin, the window moves way off from the center of the cluster of pins. The user then has to move the map back to center it, clicks on another pin to get information and again -- whoosh -- the screen moves way off to accommodate the long pop-up with the pins again ending up on the very side of the screen, while most are out of view.

Does that make sense? The pop-ups are extremely wide and move the map around a ton. Because they take up pretty much the entire screen width-wise and pan the map around to accommodate their width, the screen pretty much moves 100% of the time, unless you click on the exact same pin twice.

I'm including a patch to the openlayers_behavior_popup.js file, in which I set the popup's keepInMap and panMapIfOutOfView properties.

With the patch, all works wonderfully and the pop-up boxes look so much better because they're not just one really long line of text.

Would you all considering applying this patch for the next version of openlayers?

I'm attaching a couple of screenshots to show before and afters!

Thanks,
Boriana

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

IshaDakota’s picture

Category: support » bug
Status: Active » Needs review

This works really well for me, as I was having the same issue and was trying to control the behavior with css (unsuccessfully).

I think this should be considered a bug, which now has a patch for review.

ditcheva’s picture

Just wondering again whether this could be considered as part of the next release... :-)

Pol’s picture

Status: Needs review » Needs work

Hello,

I'm ok to include the patch if you provide a way to customize these options in Drupal.

Have a look at the file: plugins/behaviors/openlayers_behavior_popup.inc and add those two settings in the configuration form.
Once we'll be able to change those values through Drupal, I'll include your very useful patch.

Thanks !

ditcheva’s picture

Status: Needs work » Needs review
FileSize
2.08 KB

Thanks for the suggestion, Pol. I should have thought of that from the very beginning!

Here is an updated patch with those options exposed in the user interface. I've tested and they work well. :-)

Boriana

Status: Needs review » Needs work

The last submitted patch, openlayers-popup_keep_in_map-1808964.patch, failed testing.

ditcheva’s picture

Status: Needs work » Needs review
FileSize
2.07 KB

Oops. Looks like I made the patch against 7.x-2.x and not the version the issue is attached to. Here goes again.

Can't think what else may be wrong with it...

Status: Needs review » Needs work

The last submitted patch, openlayers-popup_keep_in_map-1808964.patch, failed testing.

Pol’s picture

Version: 7.x-2.0-beta1 » 7.x-2.x-dev
Pol’s picture

Status: Needs work » Needs review
Pol’s picture

Status: Needs review » Fixed

Thanks, committed, please, give us feedback !

ifrik’s picture

Works fine for me.

bogdanru’s picture

The pop-up appears only the first time. After closing it, the pop-up it's not working. Not sure if this is the default behavior ... just wondering.

Pol’s picture

It's fixed in the dev version.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.