javascript - OpenLayers DrawFeature control with Point destroys double click to zoom -
i have simple code copied 1 of openlayers examples drawing several different types of geometries on map. problem is, whenever "point" geometry selected, lose ability double-click zoom in. difference between examples , code i'm registering handlers use mod_shift, because want retain ability pan/zoom. here snipit of code:
point: new openlayers.control.drawfeature(this.geometryfilterlayer, openlayers.handler.point, { 'done': console.info("drew point") }, { keymask: openlayers.handler.mod_shift } ), polygon: new openlayers.control.drawfeature(this.geometryfilterlayer, openlayers.handler.polygon, { 'done': console.info("drew polygon") }, { keymask: openlayers.handler.mod_shift } ),
the funny thing above code is, 'done' event gets fired when control/handler created, , keymask doesn't work @ -- have loop through object , manually set keymask each time, that's not real problem @ hand.
i've tried every way can think of register dblclick event, no matter what, can't zoom in when double click. works fine on other geometries (bbox, point/radius, , polygon).
can give me advice?
i never solved issue, ended doing away using mod_xxx altogether. each different draw control had built-in functionality happens when hold shift, ctrl, alt, etc. ended using custom buttons , toolbar, way user can explicitly select drawing control themselves.
this.toolbar = new openlayers.control.panel({ displayclass: 'olcontroleditingtoolbar' }); map.addcontrol(this.toolbar); var navbutton = new openlayers.control.button({ displayclass: "olcontrolnavigation", title: "navigation", trigger: lang.hitch(this, function(data){ this.toggledrawcontrol("navigation"); navbutton.activate(); pointbutton.deactivate(); bboxbutton.deactivate(); pointradiusbutton.deactivate(); polygonbutton.deactivate(); }) }); ... this.toolbar.addcontrols([navbutton, pointbutton, bboxbutton, pointradiusbutton, polygonbutton]);
and function toggle draw controls (can called externally, that's why re-call activate , deactivate functions:
toggledrawcontrol: function(geometrytype){ this.currentgeometrytype = geometrytype; for(key in this.drawcontrols) { var control = this.drawcontrols[key]; if(geometrytype == key) { control.activate(); this.drawingbuttons[key].activate(); } else { control.deactivate(); this.drawingbuttons[key].deactivate(); } } }
Comments
Post a Comment