[OpenLayers-Users] inconsistent click handling
Gert-Jan Braas
braas at steckelfisch.nl
Tue Mar 9 05:08:55 EST 2010
Thanks.
I've added the suggested line to the test page. The same behaviour persists.
My client/tester (using Safari) noticed that when the marker is
right-clicked,
the expected functionality usually get's activated. So:
- left-click (no response)
- left-click (no response)
- left-click (no response)
- right-click (browser menu pops up)
- left-click (response)
It seems as if the handler does not get in initialized properly, and the
right-click
initializes or restarts something.
Op Di, 9 maart, 2010 10:57, schreef bartvde at osgis.nl:
> Hi,
>
> my first guess would be the clickTolerance, try setting it to a larger
> value (defaults to 4).
>
> There is only an ugly prototype way to set it right now, but please give
> it a try:
>
> OpenLayers.Handler.Feature.prototype.clickTolerance = 6;
>
> Best regards,
> Bart
>
>> Hello list,
>>
>> I'm having a persistent problem, which is not very consistently
>> reproducible.
>>
>> I have a small application with a button, which when beeing clicked,
>> places a marker
>> on a map. The marker can be moved.
>> When double clicked, the marker dis-appears and a popup-window is shown.
>> In 50% (a guestimate) of the 'double-clicks' there is no reaction at al
>>
>> This page is as clean as I can create the example:
>> http://ligplekwijzer.steckelfisch.nl/feature-not-responding-test1.html
>>
>> This code creates the layer:
>> function addNewLigplekLayer() {
>> var SHADOW_Z_INDEX = 10;
>> var MARKER_Z_INDEX = 11;
>>
>> try {
>> newLigplekLayer = new OpenLayers.Layer.Vector( "Aanmelden nieuwe
>> ligplek",
>> {
>> styleMap: new OpenLayers.StyleMap({
>> externalGraphic: "/ligplekwijzer_files/img/Cross.png",
>> backgroundXOffset: 0,
>> backgroundYOffset: -7,
>> graphicZIndex: MARKER_Z_INDEX,
>> backgroundGraphicZIndex: SHADOW_Z_INDEX,
>> pointRadius: 15
>> }),
>> isBaseLayer: false,
>> displayInLayerSwitcher: false
>> }
>> );
>>
>> // Toevoegen drag feature control voor het verslepen van een feature
>> var dragFeature = new OpenLayers.Control.DragFeature(newLigplekLayer);
>> map.addControl( dragFeature );
>> dragFeature.activate();
>>
>> var newLigplekControlOptions = { onSelect: onNieuweLigplekSelect,
>> onUnselect: onNieuweLigplekUnselect };
>>
>> newLigplekControl = new
>> OpenLayers.Control.SelectFeature(newLigplekLayer,
>> newLigplekControlOptions)
>> ;
>> map.addControl( newLigplekControl );
>> newLigplekControl.activate();
>>
>> map.addLayers([newLigplekLayer]);
>> newLigplekLayer.setVisibility( true, true);
>> } catch(e) {
>> alert("Opbouwen van de data-laag AanmeldenNieuweLigplek is verkeerd
>> gegeaan. " + e.name + ". Error message: " + e.message);
>> }
>>
>> }
>>
>>
>>
>> this is the code that adds the marker to the layer:
>>
>> function addNewLigplekFeature() {
>> //alert("addNewLigplekFeature");
>> try {
>> if( newLigplekLayer != null) {
>> try {
>> newLigplekLayer.destroyFeatures(newLigplekLayer.features);
>> }
>> catch( err) {
>> //ignore.
>> alert(err);
>> }
>>
>> var features = [];
>> var center = map.getViewPortPxFromLonLat(map.getCenter());
>> var pixel = new OpenLayers.Pixel(center.x, center.y);
>> var lonLat = map.getLonLatFromViewPortPx(pixel);
>> features.push(
>> new OpenLayers.Feature.Vector(
>> new OpenLayers.Geometry.Point(lonLat.lon, lonLat.lat)
>> )
>> );
>>
>> newLigplekLayer.addFeatures(features);
>> newLigplekLayer.setVisibility( true, true);
>> }
>> }
>> catch( err) {
>> alert( "Error in addNewLigplekFeature: "+err );
>> }
>> }
>>
>>
>> I hope someone can provide me a handle or a pointer to solve this issue.
>>
>> Regards,
>> Gert-Jan Braas
>>
>> ====================
>> Scholen dienen methodes te onderwijzen,
>> niet het gebruik van Microsoft producten.
>>
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>
>
>
>
====================
Scholen dienen methodes te onderwijzen,
niet het gebruik van Microsoft producten.
More information about the Users
mailing list