fixed middle markers stay on marker deletion

This commit is contained in:
muerwre 2019-02-07 16:42:38 +07:00
parent 8a90c50352
commit bb661b976b
5 changed files with 11 additions and 10 deletions

View file

@ -175,4 +175,4 @@ const mapDispatchToProps = dispatch => bindActionCreators({
setDialogActive,
}, dispatch);
export const MapListMoreDialog = connect(mapStateToProps, mapDispatchToProps)(Component);
export const MapListDialog = connect(mapStateToProps, mapDispatchToProps)(Component);

View file

@ -4,7 +4,7 @@ import { DIALOGS } from '$constants/dialogs';
import classnames from 'classnames';
import { AppInfoDialog } from '$components/dialogs/AppInfoDialog';
import { Icon } from '$components/panels/Icon';
import { MapListMoreDialog } from '$components/dialogs/MapListMoreDialog';
import { MapListDialog } from '$components/dialogs/MapListDialog';
type Props = {
dialog: String,
@ -14,7 +14,7 @@ type Props = {
}
const LEFT_DIALOGS = {
[DIALOGS.MAP_LIST]: MapListMoreDialog,
[DIALOGS.MAP_LIST]: MapListDialog,
[DIALOGS.APP_INFO]: AppInfoDialog,
};

View file

@ -2,7 +2,8 @@
## BUGS
todo cancelling editing someone's else map return back to it's original address /razminochnyj/
todo adding/removing points doesn't change distance
done cancelling editing someone's else map return back to it's original address /razminochnyj/
todo selecting logo on crop
todo delete sticker icon
todo fix arrows (can't reproduce now :-( )

View file

@ -1,6 +1,5 @@
import { map, tileLayer } from 'leaflet';
import 'leaflet/dist/leaflet.css';
// import 'leaflet-editable';
import { PROVIDER } from '$config/frontend';
import { DEFAULT_PROVIDER, PROVIDERS } from '$constants/providers';

View file

@ -435,13 +435,14 @@ L.Polyline.polylineEditor = L.Polyline.extend({
if (!this._markers || this._markers.length <= 2) return;
if (this.constr.is_drawing) return;
if (_marker.newPointMarker) {
this._map.removeLayer(_marker.newPointMarker);
}
this._map.removeLayer(_marker);
// that._map.removeLayer(newPointMarker);
this._markers.splice(_pointNo, 1);
this._reloadPolyline(_pointNo);
if (this._options.onPointAdded) this._options.onPointAdded(event, 'dropped');
if (this._options.onPointDropped) this._options.onPointDropped(event, 'dropped');
});
// marker.on(that._options.addFirstLastPointEvent, (event) => {
@ -583,8 +584,6 @@ L.Polyline.polylineEditor = L.Polyline.extend({
return;
}
if (this._options.onPointAdded) this._options.onPointAdded(event);
const pointNo = (this._markers && this._markers.length) || 0;
this._addMarkers(pointNo, event.latlng, true);
@ -592,6 +591,8 @@ L.Polyline.polylineEditor = L.Polyline.extend({
this._map.off('click', this._addPointForward);
if (this._options.onPointAdded) this._options.onPointAdded(event);
setTimeout(this._prepareForNewPoint.bind(this), 25);
};