I have been unable to get pop-up behaviors working on features in touch screens - both Android and IPad/Pod although they were OK before updating OL library to 2.11

I have tried various settings in the behavior UI but nothing works so far. Would appreciate any advice on this.

Thanks

Comments

Patroclas’s picture

Does this work at all - or is it my installation? Would be interested to hear from anyone that has pop-ups working on touch screens.

zzolo’s picture

I believe this is a duplicate. But I did some initial testing and saw the same behavior. Unsure if it this module and its popup behavior (likely) or an upstream issue.

Patroclas’s picture

Thanks zzolo - at least I know it is probably not my settings. Would be useful to get this fixed. Anyone else have any suggestions to help out here? Unfortunately I am not a coder so can't help further.

guictx’s picture

I'm having this same issue with touch devices (iPhone, iPad and Android). I thought I had solved the problem I first mentioned here - http://drupal.org/node/1370822 - but no.

My findings:

1. If I disable the Navigation behavior popups work;
2. On my dev machine which uses Nginx instead of Apache popups work - that's why I thought the issue was solved;
3. The popup examples with vector layers on the OL website (eg: http://openlayers.org/dev/examples/dynamic-text-layer.html) work.

Could this be a problem with the navigation behavior?

guictx’s picture

Category: support » bug
JonMcL’s picture

I recently posted this issue:
#1470864: Custom behavior not responding to touch events

There is a quick module I threw together in there that, I think, demonstrates the issue. The module is entirely based off of the standard Feature Popup behavior that ships with OL. So I would think that it *should* work if the standard popup behavior works.

guictx’s picture

I have a new lead!

After diffing the map page served from my nginx machine against apache I discovered that, for some reason, in the page served by Apache openlayers_behavior_popup.js comes before openlayers_behavior_navigation.js in the head section, as oposed to nginx that changes this order.

This is the openlayers_behavior_*.js order in my Nginx machine:

openlayers_behavior_navigation.js
openlayers_behavior_popup.js
openlayers_behavior_zoompanel.js
openlayers_behavior_zoomtolayer.js

And this what I'm getting with Apache:

openlayers_behavior_popup.js
openlayers_behavior_zoompanel.js
openlayers_behavior_zoomtolayer.js
openlayers_behavior_navigation.js

So I went and changed openlayers_behavior_popup.inc to add weight to the openlayers_behavior_popup.js to make sure it comes in last place.

As a result my popups now work in touch devices!

Patroclas’s picture

So I went and changed openlayers_behavior_popup.inc to add weight to the openlayers_behavior_popup.js to make sure it comes in last place.

Could you explain how you actually did that please?

guictx’s picture

Sure, just bear in mind that this is a dirty hack to test and try to identify the bug, not a real solution to the problem.

In /sites/all/modules/openlayers/plugins/behaviors/openlayers_behavior_popup.inc, I changed the last render function to:

  function render(&$map) {
    drupal_add_js(drupal_get_path('module', 'openlayers') . 
      '/plugins/behaviors/openlayers_behavior_popup.js', array('weight' => 1));
    return $this->options;
  }
Patroclas’s picture

Thanks - will test that

zzolo’s picture

So, given certain things, I think this may be caused because of whatever reasons, the Navigation Control is being added after the popup behavior. The Navigation control adds a fair amount of mobile related things. Unfortunately I don't have much technical reason as to why this is, but I think managing some weights is probably the best bet here.

zzolo’s picture

Status: Active » Fixed

I have updated this and tested in iOS simulator and it is working for me. Thanks.

Status: Fixed » Closed (fixed)

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

aasarava’s picture

Zzolo, is this fix in the dev version?

loren H’s picture

I had to also add a weight = 0 to the navigation.inc in addition to popup weight=1 to get it to work. Not sure if that's just common knowledge but thought I'd share if anyone was having troubles.

Nitebreed’s picture

seems to fix it!

cedric_a’s picture

To fix this in Drupal 6, I use the 'type' argument to sort the js calls as explained in the API documentation

So add , 'theme' to drupal_add_js() call in openlayers_behavior_popup.inc (or any custom behaviours having this issue) like this :

<?php
  /**
   * Render.
   */
  function render(&$map) {
    drupal_add_js(drupal_get_path('module', 'openlayers') . 
      '/includes/behaviors/js/openlayers_behavior_popup.js', 'theme');
    return $this->options;
  }
}
?>
sano’s picture

thanks WeBla. :-)