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

MousePosition degrees template via plugin props #2648

Merged
merged 2 commits into from
Feb 28, 2018
Merged
Changes from 1 commit
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
21 changes: 20 additions & 1 deletion web/client/plugins/MousePosition.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ const {Tooltip} = require('react-bootstrap');
const {createSelector} = require('reselect');

const assign = require('object-assign');
const PropTypes = require('prop-types');
const {isFunction} = require('lodash');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isfunction not used?


const {changeMousePositionCrs, changeMousePositionState} = require('../actions/mousePosition');

Expand Down Expand Up @@ -66,9 +68,26 @@ const MousePositionComponent = require('../components/mapcontrols/mouseposition/


class MousePosition extends React.Component {
static propTypes = {
degreesTemplate: PropTypes.string,
projectedTemplate: PropTypes.string
};

static defaultProps = {
degreesTemplate: 'MousePositionLabelDMS',
projectedTemplate: 'MousePositionLabelYX'
};

getTemplate = (template) => {
return require('../components/mapcontrols/mouseposition/' + template);
};
render() {
const { degreesTemplate, projectedTemplate, ...other} = this.props;
return (
<MousePositionComponent toggle={<MousePositionButton/>} {...this.props}/>
<MousePositionComponent
degreesTemplate={this.getTemplate(degreesTemplate)}
projectedTemplate={this.getTemplate(projectedTemplate)}
toggle={<MousePositionButton/>} {...other}/>
);
}
}
Expand Down