diff --git a/lib/editor/actions/map/index.js b/lib/editor/actions/map/index.js index d67a16b20..c81ff4994 100644 --- a/lib/editor/actions/map/index.js +++ b/lib/editor/actions/map/index.js @@ -247,7 +247,7 @@ export function handleControlPointDragStart (controlPoint: ControlPoint) { export function removeControlPoint (controlPoints: Array, index: number, pattern: Pattern, patternCoordinates: any) { return async function (dispatch: dispatchFn, getState: getStateFn) { - const {avoidMotorways, followStreets} = getState().editor.editSettings.present + const {avoidMotorways, snapToOption} = getState().editor.editSettings.present const { coordinates, updatedControlPoints @@ -257,8 +257,8 @@ export function removeControlPoint (controlPoints: Array, index: n controlPoints, editType: 'delete', index, - followStreets, - patternCoordinates + patternCoordinates, + snapToOption }) // Update the shape_dist_traveled values to reflect the new pattern that the bus follows diff --git a/lib/editor/actions/map/stopStrategies.js b/lib/editor/actions/map/stopStrategies.js index ba2483862..06584259d 100644 --- a/lib/editor/actions/map/stopStrategies.js +++ b/lib/editor/actions/map/stopStrategies.js @@ -528,7 +528,7 @@ export function removeStopFromPattern (pattern: Pattern, stop: GtfsStop, index: console.log('pattern coordinates do not exist') patternStops.splice(index, 1) } else { - const {avoidMotorways, followStreets} = getState().editor.editSettings.present + const {avoidMotorways, snapToOption} = getState().editor.editSettings.present let result try { // $FlowFixMe: Flow does not recognize controlpoints within returned Promise type @@ -537,8 +537,8 @@ export function removeStopFromPattern (pattern: Pattern, stop: GtfsStop, index: controlPoints: clonedControlPoints, editType: 'delete', index: cpIndex, - followStreets, - patternCoordinates: clonedPatternSegments + patternCoordinates: clonedPatternSegments, + snapToOption }) } catch (err) { console.log(err) diff --git a/lib/editor/components/pattern/EditShapePanel.js b/lib/editor/components/pattern/EditShapePanel.js index f3a7179a6..ded23ae67 100644 --- a/lib/editor/components/pattern/EditShapePanel.js +++ b/lib/editor/components/pattern/EditShapePanel.js @@ -48,7 +48,7 @@ export default class EditShapePanel extends Component { /** * Construct new pattern geometry from the pattern stop locations. */ - async drawPatternFromStops (pattern: Pattern, stopsCoordinates: Array, followStreets: boolean): Promise { + async drawPatternFromStops (pattern: Pattern, stopsCoordinates: Array): Promise { const {editSettings, saveActiveGtfsEntity, setErrorMessage, updatePatternGeometry} = this.props let patternSegments = [] if (editSettings.present.snapToOption !== 'NONE') { @@ -92,7 +92,7 @@ export default class EditShapePanel extends Component { } _generateShapeFromStops = () => { - const {activePattern, editSettings, stops} = this.props + const {activePattern, stops} = this.props const stopLocations = stops && activePattern.patternStops && activePattern.patternStops.length ? activePattern.patternStops .map((s, index) => { @@ -104,7 +104,7 @@ export default class EditShapePanel extends Component { return {lng: stop.stop_lon, lat: stop.stop_lat} }) : [] - this.drawPatternFromStops(activePattern, stopLocations, editSettings.present.followStreets) + this.drawPatternFromStops(activePattern, stopLocations) } _confirmCreateFromStops = () => { diff --git a/lib/editor/reducers/settings.js b/lib/editor/reducers/settings.js index 63e44f098..b0b0a0cef 100644 --- a/lib/editor/reducers/settings.js +++ b/lib/editor/reducers/settings.js @@ -49,7 +49,7 @@ export const reducers = { ...defaultState, // Do not reset follow streets if exiting pattern editing. // TODO: Are there other edit settings that should not be overridden? - followStreets: state.followStreets + snapToOption: state.snapToOption } }, 'SETTING_ACTIVE_GTFS_ENTITY' (