# ol-rectangle-draw   [](//yesifang.com) > 这是一个openlayers矩形绘制补充包。 > > This is an openlayers rectangle drawing supplement package. [English Document](../README.md)
## 运行示例 ```shell $ git clone https://github.com/SuperYesifang/ol-rectangle-draw.git $ cd ol-rectangle-draw $ npm run serve ``` ## 使用 `new RectangleDraw(Draw, Polygon, options?)` ### 1. 使用CDN ```html ``` ### 2. 使用ESM ```js 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构造函数的选项 }) map.addInteraction(draw); ``` ## 选项 | 选项 | 类型 | 含义 | | ------------ | --------- | ------------------------------------------------------------ | | `Draw` | `Draw` | openlayers的Draw交互组件构造函数。 | | `Polygon` | `Polygon` | openlayers的Polygon几何体构造函数。 | | `options` | `object` | Draw构造函数的选项(除了`type`和`geometryFunction`) |