1.0.8 • Published 9 years ago

react-art-map v1.0.8

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

#ReactMap

npm install react-art-map
var React = require('react');
var ReactMap = require('react-map');

var {
    Map
} = ReactMap;

var viewportWidth = function() {
    return  window.innerWidth - 100;
}
var viewportHeight = function() {
    return window.innerHeight - 100;
}

var center = [
    -122.668197,45.525292 //Portland
];

var App = React.createClass({
  getInitialState: function() {
    return {
      center: center,
      zoom: 15
    }
  },

  handleDrag: function(newCenter) {
    this.setState({
      center: newCenter
    })
  }, 
  render: function () {
    return (
      <div>
        <Map
            width={viewportWidth()}
            height={viewportHeight()}
            center={this.state.center}
            zoom={this.state.zoom}
            tileSource="http://{s}.tile.osm.org/{z}/{x}/{y}.png"
            onDrag={this.handleDrag}
        />
      </div>
    );
  }
});

React.render(<App/>, document.getElementById('example'));
1.0.8

9 years ago

1.0.6

9 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.0

9 years ago