admin管理员组文章数量:1410731
I am using react leaflet draw for drawing polygons and circles.
But when I chose edit polygon there is no drag handler for a move and resize.
How to solve this issue if any one have the same?
This is code
<Map
style={this.leafletMapService.getMapStyle()}
selectArea={true}
onAreaSelected={(event) => this.handleAreaSelection(event)}
boxZoom={false}
ref={map => {this.map = map}}
center={this.props.center}
zoom={this.props.zoom}
minZoom={this.props.minZoom}
maxZoom={this.props.maxZoom}
attributionControl={false}
doubleClickZoom={false}
zoomControl={false}
editable={true}
onZoomEnd={this.handleZoomEnd}
bounceAtZoomLimits={false}
crs={this.leafletMapService.getNonGeographicMapCRS()}
dragging={!!this.props.selectedSection}
scrollWheelZoom={false}>
<FeatureGroup>
<EditControl
position='topright'
onCreated={(event) => this.onCreatedHandler(event)}
/>
{this.props.children}
</FeatureGroup>
</Map>
I am using react leaflet draw for drawing polygons and circles.
But when I chose edit polygon there is no drag handler for a move and resize.
How to solve this issue if any one have the same?
This is code
<Map
style={this.leafletMapService.getMapStyle()}
selectArea={true}
onAreaSelected={(event) => this.handleAreaSelection(event)}
boxZoom={false}
ref={map => {this.map = map}}
center={this.props.center}
zoom={this.props.zoom}
minZoom={this.props.minZoom}
maxZoom={this.props.maxZoom}
attributionControl={false}
doubleClickZoom={false}
zoomControl={false}
editable={true}
onZoomEnd={this.handleZoomEnd}
bounceAtZoomLimits={false}
crs={this.leafletMapService.getNonGeographicMapCRS()}
dragging={!!this.props.selectedSection}
scrollWheelZoom={false}>
<FeatureGroup>
<EditControl
position='topright'
onCreated={(event) => this.onCreatedHandler(event)}
/>
{this.props.children}
</FeatureGroup>
</Map>
Share
edited Sep 28, 2018 at 7:35
Stevan Tosic
asked Sep 19, 2018 at 13:41
Stevan TosicStevan Tosic
7,25913 gold badges65 silver badges120 bronze badges
2
- Please, create a code snippet that demonstrates your problem – n1stre Commented Sep 21, 2018 at 15:59
- There is a lot of dependencies and I am unable to make code snippet. I need to include a leaflet, react-leaflet, leaflet-draw, react-leaflet-draw. I was unable to do so. Can you help me by edit my question? – Stevan Tosic Commented Sep 21, 2018 at 16:52
1 Answer
Reset to default 6There were multiple problems.
First, you must be sure that a simple marker is visible which was not in my case. I have in my CSS some style which hides markers at all.
So be sure that that you can show a marker on the map.
Mandatory styles are both leaflet.css
and leaflet.draw.css
so in ponent add those lines:
import 'leaflet/dist/leaflet.css';
import 'leaflet-draw/dist/leaflet.draw.css'
Then if you have marker icon error just replace icons by adding this lines below
delete L.Icon.Default.prototype._getIconUrl;
L.Icon.Default.mergeOptions({
iconRetinaUrl: 'https://cdnjs.cloudflare./ajax/libs/leaflet/1.3.1/images/marker-icon.png',
iconUrl: 'https://cdnjs.cloudflare./ajax/libs/leaflet/1.3.1/images/marker-icon.png',
shadowUrl: 'https://cdnjs.cloudflare./ajax/libs/leaflet/1.3.1/images/marker-shadow.png',
});
or as described in this question answer
React-Leaflet marker files not found
本文标签: javascriptReact leaflet drawmarker icon and drag handler is missingStack Overflow
版权声明:本文标题:javascript - React leaflet draw - marker icon and drag handler is missing - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744856633a2628813.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论