mirror of
https://github.com/visgl/react-map-gl.git
synced 2026-01-18 15:54:22 +00:00
Add project method to HTML Overlay (#104)
This commit is contained in:
parent
49d7cd6b49
commit
37fca99708
@ -19,12 +19,12 @@
|
||||
// THE SOFTWARE.
|
||||
|
||||
import React, {PropTypes, Component} from 'react';
|
||||
import ViewportMercator from 'viewport-mercator-project';
|
||||
|
||||
const PROP_TYPES = {
|
||||
width: PropTypes.number.isRequired,
|
||||
height: PropTypes.number.isRequired,
|
||||
redraw: PropTypes.func.isRequired,
|
||||
project: PropTypes.func.isRequired,
|
||||
isDragging: PropTypes.bool.isRequired
|
||||
// TODO: style
|
||||
};
|
||||
@ -32,7 +32,7 @@ const PROP_TYPES = {
|
||||
export default class HTMLOverlay extends Component {
|
||||
|
||||
render() {
|
||||
const {width, height, project, isDragging} = this.props;
|
||||
const {width, height, isDragging} = this.props;
|
||||
const style = {
|
||||
position: 'absolute',
|
||||
pointerEvents: 'none',
|
||||
@ -42,9 +42,12 @@ export default class HTMLOverlay extends Component {
|
||||
height,
|
||||
...this.props.style
|
||||
};
|
||||
const mercator = ViewportMercator(this.props);
|
||||
const {project, unproject} = mercator;
|
||||
|
||||
return (
|
||||
<div ref="overlay" style={ style }>
|
||||
{ this.props.redraw({width, height, project, isDragging}) }
|
||||
{ this.props.redraw({width, height, project, unproject, isDragging}) }
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user