npm.io
0.1.0 • Published 4 years ago

ol-rectangle-draw

Licence
MIT
Version
0.1.0
Deps
0
Size
15 kB
Vulns
0
Weekly
0

ol-rectangle-draw

ol-rectangle-draw nodejs blog

这是一个openlayers矩形绘制补充包。

This is an openlayers rectangle drawing supplement package.

中文文档

Run Simple Demo

$ git clone https://github.com/SuperYesifang/ol-rectangle-draw.git
$ cd ol-rectangle-draw
$ npm run serve

Usage

new RectangleDraw(Draw, Polygon, options?)

1. Use CDN
<script src="https://raw.githubusercontent.com/SuperYesifang/ol-rectangle-draw/master/dist/RectangleDraw.cdn.js"></script>
<script>
const draw = new RectangleDraw(ol.interaction.Draw, ol.geom.Polygon, {
  //...Draw constructor options
});

map.addInteraction(draw);
</script>
2. Use ESM
import Draw from "ol/interaction/Draw";
import Polygon from "ol/geom/Polygon";
import RectangleDraw from "ol-rectangle-draw";

const draw = new RectangleDraw(Draw, Polygon, {
  //...Draw constructor options
})

map.addInteraction(draw);

Options

prop type description
Draw Draw openlayers Draw interaction constructor.
Polygon Polygon openlayers Polygon geometry constructor.
options object Draw consturctor options (without type and geometryFunction)

Keywords