# drawhelper-with-cesium-v1.41
**Repository Path**: ticpas/drawhelper-with-cesium-v1.41
## Basic Information
- **Project Name**: drawhelper-with-cesium-v1.41
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: Apache-2.0
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2021-01-12
- **Last Updated**: 2021-01-12
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
1、在原cesium-drawhelper基础上,修改了DrawHelper.js部分地方,从而能够支持最新的cesium v1.41,具体修改说明如下:
2、294行
lineWidth: Math.min(this.strokeWidth || 4.0, context._aliasedLineWidthRange[1])
改为:
lineWidth: 1.0
3、977行开始
function updateExtent(value) { if (extent == null) { extent = new Cesium.RectanglePrimitive(); extent.asynchronous = false; primitives.add(extent); } extent.rectangle = value; // update the markers var corners = getExtentCorners(value); // create if they do not yet exist if (markers == null) { markers = new _.BillboardGroup(_self, defaultBillboard); markers.addBillboards(corners); } else { markers.updateBillboardsPositions(corners); } } // Now wait for start mouseHandler.setInputAction(function (movement) { if (movement.position != null) { var cartesian = scene.camera.pickEllipsoid(movement.position, ellipsoid); if (cartesian) { if (extent == null) { // create the rectangle firstPoint = ellipsoid.cartesianToCartographic(cartesian); var value = getExtent(firstPoint, firstPoint); updateExtent(value); } else { _self.stopDrawing(); if (typeof options.callback == 'function') { options.callback(getExtent(firstPoint, ellipsoid.cartesianToCartographic(cartesian))); } } } } }, Cesium.ScreenSpaceEventType.LEFT_DOWN); mouseHandler.setInputAction(function (movement) { var position = movement.endPosition; if (position != null) { if (extent == null) { tooltip.showAt(position, "Click to start drawing rectangle
"); } else { var cartesian = scene.camera.pickEllipsoid(position, ellipsoid); if (cartesian) { var value = getExtent(firstPoint, ellipsoid.cartesianToCartographic(cartesian)); updateExtent(value); tooltip.showAt(position, "Drag to change rectangle extent
Click again to finish drawing
"); } } } }, Cesium.ScreenSpaceEventType.MOUSE_MOVE); }
// Now wait for start mouseHandler.setInputAction(function (movement) { if (movement.position != null) { var cartesian = scene.camera.pickEllipsoid(movement.position, ellipsoid); if (cartesian) { if (extent == null) { // create the rectangle firstPoint = ellipsoid.cartesianToCartographic(cartesian); var value = getExtent(firstPoint, firstPoint); extent = new _.ExtentPrimitive({ extent: value, asynchronous: false, material: options.material }); primitives.add(extent); markers = new _.BillboardGroup(_self, defaultBillboard); var corners = getExtentCorners(value); markers.addBillboards(corners); } else { _self.stopDrawing(); if (typeof options.callback == 'function') { options.callback(getExtent(firstPoint, ellipsoid.cartesianToCartographic(cartesian))); } } } } }, Cesium.ScreenSpaceEventType.LEFT_DOWN); mouseHandler.setInputAction(function (movement) { var position = movement.endPosition; if (position != null) { if (extent == null) { tooltip.showAt(position, "Click to start drawing rectangle
"); } else { var cartesian = scene.camera.pickEllipsoid(position, ellipsoid); if (cartesian) { var value = getExtent(firstPoint, ellipsoid.cartesianToCartographic(cartesian)); extent.setExtent(value); var corners = getExtentCorners(value); markers.updateBillboardsPositions(corners); tooltip.showAt(position, "Drag to change rectangle extent
Click again to finish drawing
"); } } } }, Cesium.ScreenSpaceEventType.MOUSE_MOVE); }