import * as actions from './actions';

export default {
  [actions.setShapesCreated]: (state, { payload }) =>
    ({ ...state, shapesCreated: payload }),
  [actions.setPosition]: (state, { payload }) =>
    ({ ...state, position: payload }),
  [actions.setInitialPosition]: (state, { payload }) =>
    ({ ...state, initialPosition: payload, position: payload }),
  [actions.togglePosition]: (state) => {
    const newPosition = { ...state.position };
    newPosition.latitude = -state.position.latitude;
    newPosition.longitude = (state.position.longitude + 180) % 180;
    return { ...state, position: newPosition };
  }
};

@@ -497,16 +497,58 @@
 titude;%0A
+    if (state.position.longitude %3E 0) %7B%0A  
     newP
@@ -567,17 +567,16 @@
 itude = 
-(
 state.po
@@ -596,21 +596,128 @@
 ude 
-+
+-
  180
-) %25 180;
+;%0A    %7D else if (state.position.longitude %3C 0)%7B%0A      newPosition.longitude = state.position.longitude + 180;%0A    %7D
 %0A   

fix toggle calculations