Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable Measure on Info. Close #258 #1409

Merged
merged 1 commit into from
Feb 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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