Commit f29eb71e authored by Scott Ames's avatar Scott Ames
Browse files

fixed disabled css on proj buttons when switching targets and re-added scale control

parent bc7ac0df
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());
  }