Commit 6fdb9cf3 authored by Kaitlyn's avatar Kaitlyn
Browse files
parents 3ee699a6 6a0d115c
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ export default class MapContainer extends Component {
  }

  componentDidUpdate() {
    // remove old map container and append new container to its parent
    let oldContainer = document.getElementById("map-container");
    let parent = oldContainer.parentNode;
    let newContainer = document.createElement("div");
@@ -31,13 +32,21 @@ export default class MapContainer extends Component {
    newContainer.setAttribute("id", "map-container");
    parent.appendChild(newContainer);

    // remove disabled classes from projection buttons so that the css is reset to default
    document.getElementById("projectionNorthPole").classList.remove("disabled");
    document
      .getElementById("projectionCylindrical")
      .classList.remove("disabled");
    document.getElementById("projectionSouthPole").classList.remove("disabled");

    // create new map with updated target
    let map = new AstroMap("map-container", this.props.target, {});
    new Projection().addTo(map);
    new MousePosition({
      numDigits: 2,
      targetPlanet: this.props.target
    }).addTo(map);

    new L.Control.Scale({ imperial: false }).addTo(map);
    map.on("fullscreenchange", this.handleFullScreenChange());
  }

+2 −10
Original line number Diff line number Diff line
@@ -56,16 +56,8 @@ export default L.Map.AstroMap = L.Map.extend({
      cylindrical: new LayerCollection(this._target, "cylindrical")
    };

    if (this.layers["northPolar"].isEmpty()) {
      this._hasNorthPolar = false;
    } else {
      this._hasNorthPolar = true;
    }
    if (this.layers["southPolar"].isEmpty()) {
      this._hasSouthPolar = false;
    } else {
      this._hasSouthPolar = true;
    }
    this._hasNorthPolar = !this.layers["northPolar"].isEmpty();
    this._hasSouthPolar = !this.layers["southPolar"].isEmpty();

    this._defaultProj = L.extend({}, L.CRS.EPSG4326, { R: this._radii["a"] });
    this.options["crs"] = this._defaultProj;