How to set the holeModifier on OpenLayers.Control.DrawFeature to always be active?

المشرف العام

Administrator
طاقم الإدارة
I would like to create a button "draw a hole" taht uses by default the holeModifier functionality but the user dont need to press the cttrlBtn.

The "standard" way I guess, would be to create a way of create holes in OpenLayers would be something like this:

var drawPolygon = new OpenLayers.Control.DrawFeature(ftthLayer, OpenLayers.Handler.Polygon,{ handlerOptions: { holeModifier: "ctrlKey"} };By this way the user needs to press the ctrlKey to draw a hole, or else a new polygon is created.Is it possible to make the control DrawFeature always be in "holeModifier" mode?

I have tried setting the property drawingHole= true on the handler (OpenLayers.Handler.Polygon) that's connected to DrawFeature control , but that doesn't seem to help.

I know there are different ways to solve hole creation, but the ones I have seen havn't solved so that the user see you are drawing a hole. Like the way it's working when you use the holeModifier.

Happy for any input

BrMike



أكثر...
 
أعلى