I have openlayers 2.13 along with geoserver 2.1.3.
I have a vector layer where points created, after a CQL filter is activated.
I have a click event for those points. In pc/laptop works fine, but in mobiles (iphone4s safari and android vimicro firefox) if I tap with my finger a point, nothing happens.
I only load the openlayers library <script type='text/javascript' src='OpenLayers.js'></script>
and zoom/pan on the map works in mobiles. CQL filter also works and the points are render in mobiles.
But I can not tap them.
How can I fix this ?
Thanks in advance
the code (I can provide more, if you think is neccessary):
mylayer = new OpenLayers.Layer.Vector("my layer", {renderers: ["Canvas", "SVG", "VML"]})
//Add a select feature control
var select_feature_control = new OpenLayers.Control.SelectFeature(mylayer, {multiple: false,toggle: true});
map.addControl(select_feature_control);
//Activate the control
select_feature_control.activate();
function selected_feature(event){
//do stuff
}
EDIT
I have this now , trying to use Control.GetFeature
//create layer
mylayer = new OpenLayers.Layer.Vector("mylayer", {renderers: ["Canvas", "SVG", "VML"]})
//set protocol
var myprotocol = new OpenLayers.Protocol.WFS({
url: "/geoserver/wfs",
featureType: "mylayer",
featureNS: "http://www.mysite.gr"
});
//set control
var select_feature_control = new OpenLayers.Control.GetFeature({
protocol: myprotocol,
click: true,
maxFeatures: 1,
clickTolerance: 1,
box: false,
hover: false
});
//add the control
map.addControl(select_feature_control);
//activate the control
select_feature_control.activate();
//register it an connect it with the function
pins.events.register('featureselected', this, selected_feature);
//the function - gets the id by splitting the fid
function selected_feature(event){
var sf = event.feature.fid;
var sfs = sf.split(".");
var sff = sfs[1];
showtext(sff);
}
thats the part of the cql filter
//pass the filter to the layer
var prot = new OpenLayers.Protocol.WFS({
url: "/geoserver/wfs",
featureType: "mylayer",
featureNS: "http://www.mysite.gr",
defaultFilter: filter_final});
var _CallBack = function(resp) {
pins.addFeatures(resp.features)
}
var response = prot.read({callback: _CallBack});
//refresh to render POIs
mylayer.refresh({force:true});
I can search the layer and see points on the map. But I still can not select in mobile. In pc, I can click a point, but the cursor of the mouse becomes hourglass and nothing happens. Can you spot what is wrong?
Thanks a million
function selected_feature(event){
does not work. At least when usingControl.SelectFeature
works fine on pc. I tried to load other files too,openlayers.mobile.js
,CQL.js
,Format.js
as neogeomat said, but no difference.callback
inside aControl.SelectFeature
and still not work in mobiles. I tried to set the index of the layer 0 or 99, still nothing....