Commit 729b5d45 authored by Kaitlyn's avatar Kaitlyn
Browse files

Finished first sidebar attempt

parent 397c1252
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -84,7 +84,6 @@
    "leaflet": "^1.6.0",
    "leaflet-draw": "1.0.4",
    "leaflet-fullscreen": "^1.0.2",
    "leaflet-sidebar-v2": "^3.2.2",
    "proj4": "^2.6.0",
    "proj4leaflet": "^1.0.2",
    "react": "^16.12.0",
+3 −40
Original line number Diff line number Diff line
@@ -28,27 +28,7 @@ export default class MapContainer extends Component {
  componentDidMount() {
    let map = new AstroMap("map-container", this.props.target, {});
    let controlManager = new AstroControlManager(map);

    // map.addControl(new ProjectionControl());
    // map.addControl(
    //   new MousePositionControl({
    //     numDigits: 3
    //   })
    // );

    // let drawnItems = new L.FeatureGroup();
    // map.addLayer(drawnItems);

    // map.addControl(
    //   new AstroDrawControl({
    //     edit: {
    //       featureGroup: drawnItems
    //     }
    //   })
    // );

    // map.addControl(new L.Control.Scale({ imperial: false }));
    // map.addControl(new AstroSidebarControl());
    controlManager.addTo(map);
  }

  /**
@@ -73,25 +53,8 @@ export default class MapContainer extends Component {

    // create new map with updated target
    let map = new AstroMap("map-container", this.props.target, {});
    map.addControl(new ProjectionControl());
    map.addControl(
      new MousePositionControl({
        numDigits: 3
      })
    );

    let drawnItems = new L.FeatureGroup();
    map.addLayer(drawnItems);

    map.addControl(
      new AstroDrawControl({
        edit: {
          featureGroup: drawnItems
        }
      })
    );

    map.addControl(new L.Control.Scale({ imperial: false }));
    let controlManager = new AstroControlManager(map);
    controlManager.addTo(map);
  }

  render() {
+1 −1
Original line number Diff line number Diff line
@@ -153,6 +153,7 @@ export default function ConsoleLonLatSelects() {
      alignItems="center"
      className={classes.grid}
      xs={7}
      id="lonLatContainer"
    >
      <StyledTooltip
        title={
@@ -171,7 +172,6 @@ export default function ConsoleLonLatSelects() {
            size="small"
            value={posEastWest}
            onChange={handlePosEastWest}
            id="lonLatContainer"
          >
            <StyledToggleButton id="consoleLonEastBtn" value="PositiveEast">
              <AutorenewIcon fontSize="small" className={classes.flip} />
+1 −1
Original line number Diff line number Diff line
@@ -131,7 +131,7 @@ export default function ConsoleProjectionButtons() {
  return (
    <Grid
      className={classes.grid}
      id="projButtons"
      id="projContainer"
      container
      item
      direction="column"
+20 −8
Original line number Diff line number Diff line
@@ -5,23 +5,26 @@ import AstroDrawControl from "./AstroDrawControl";
import AstroSidebarControl from "./SidebarControl";

/**
 * @class LayerCollection
 * @aka L.Class.LayerCollection
 * @class AstroControlManager
 * @aka L.Class.AstroControlManager
 * @inherits L.Class
 *
 * @classdesc
 * Holds the base layers and overlays of a particular projection
 * for quick and easy use in the AstroMap class.
 * Adds all of the needed controls to the AstroMap.
 */
export default L.AstroControlManager = L.Class.extend({
  /**
   * @function ProjectionControl.prototype.initialize
   * @description Creates all of the required controls.
   * @param {AstroMap} map - The AstroMap to add the controls to. We need to pass in the map here
   *                         because the drawnItems FeatureGroup needs it when initialized.
   */
  initialize: function(map) {
    this._projControl = new ProjectionControl();
    map.addControl(this._projControl);

    this._mouseControl = new MousePositionControl({
      numDigits: 3
    });
    map.addControl(this._mouseControl);

    let drawnItems = new L.FeatureGroup();
    map.addLayer(drawnItems);
@@ -31,13 +34,22 @@ export default L.AstroControlManager = L.Class.extend({
        featureGroup: drawnItems
      }
    });
    map.addControl(this._drawControl);

    this._sidebarControl = new AstroSidebarControl(map, [
    this._sidebarControl = new AstroSidebarControl([
      this._projControl,
      this._mouseControl
    ]);
  },

  /**
   * @function ProjectionControl.prototype.addTo
   * @description Adds all of the controls to the AstroMap.
   * @param {AstroMap} map - The AstroMap to add the controls to.
   */
  addTo: function(map) {
    map.addControl(this._projControl);
    map.addControl(this._mouseControl);
    map.addControl(this._drawControl);
    map.addControl(new L.Control.Scale({ imperial: false }));

    let that = this;
Loading