Skip to content

Commit

Permalink
Disable Measure on Info. Close geosolutions-it#258
Browse files Browse the repository at this point in the history
  • Loading branch information
Gnafu committed Jan 26, 2017
1 parent 781a0e0 commit b40ade8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
11 changes: 10 additions & 1 deletion web/client/actions/measurement.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,23 @@
*/
const CHANGE_MEASUREMENT_TOOL = 'CHANGE_MEASUREMENT_TOOL';
const CHANGE_MEASUREMENT_STATE = 'CHANGE_MEASUREMENT_STATE';
const {setControlProperty} = require('./controls');

function changeMeasurement(measurement) {
// TODO: the measurement control should use the "controls" state
function toggleMeasurement(measurement) {
return {
type: CHANGE_MEASUREMENT_TOOL,
...measurement
};
}

function changeMeasurement(measurement) {
return (dispatch) => {
dispatch(setControlProperty('info', 'enabled', false, false));
dispatch(toggleMeasurement(measurement));
};
}

function changeMeasurementState(measureState) {
return {
type: CHANGE_MEASUREMENT_STATE,
Expand Down
14 changes: 13 additions & 1 deletion web/client/reducers/measurement.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
* LICENSE file in the root directory of this source tree.
*/

var {
const {
CHANGE_MEASUREMENT_TOOL,
CHANGE_MEASUREMENT_STATE
} = require('../actions/measurement');

const {TOGGLE_CONTROL} = require('../actions/controls');
const assign = require('object-assign');

function measurement(state = {
Expand Down Expand Up @@ -41,6 +42,17 @@ function measurement(state = {
lenUnit: action.lenUnit,
areaUnit: action.areaUnit
});
case TOGGLE_CONTROL:
{
// TODO: remove this when the controls will be able to be mutually exclusive
if (action.control === 'info') {
return {
lineMeasureEnabled: false,
areaMeasureEnabled: false,
bearingMeasureEnabled: false
};
}
}
default:
return state;
}
Expand Down

0 comments on commit b40ade8

Please sign in to comment.