Drag the POLYGON OL3 function

I am trying to find code for dragging a polygon (don't change) .... OL3

polygon is created by code (bbox for print area).

can someone enter the code?

    var format = new ol.format.WKT();
    var feature = format.readFeature(wkt2);

    selectInteraction = new ol.interaction.Select({style: styles});
    map.addInteraction(selectInteraction);
    selectInteraction.getFeatures().push(feature);
    modifyInteraction = new ol.interaction.DragAndDrop({
        features: selectInteraction.getFeatures()
    });
    map.addInteraction(modifyInteraction);


    vector = new ol.layer.Vector({ 
        style: styles,
        source: new ol.source.Vector({
            features: [feature]
        })
    });
    map.getLayers().insertAt(1000, vector);
+4
source share
2 answers

This extension, called Transform Interaction , works great with drag and drop. It also supports rotation, stretching, and scaling. It is definitely worth a look!

+1
source

See here an example of a drag and drop function: http://openlayers.org/en/v3.4.0/examples/drag-features.html

There is also work on interacting with Translate Translate: https://github.com/openlayers/ol3/pull/3250

+3

Source: https://habr.com/ru/post/1583951/


All Articles