Commit 1bb4a71f authored by Michael Underwood's avatar Michael Underwood
Browse files

Omit unspecified booleans instead of defaulting to false

Resolves #242
parent 6081cba1
Loading
Loading
Loading
Loading
+118 −146
Original line number Diff line number Diff line
@@ -18,82 +18,72 @@ import {
  updateLeafletWrapper,
  WINDOW_OR_GLOBAL,
  GLOBAL_LEAFLET_OPT,
  propsToLeafletOptions,
} from "../utils.js";
import { componentProps, setupComponent } from "../functions/component";

export default {
  emits: ["ready", "update:zoom", "update:center", "update:bounds"],
  props: {
const mapProps = {
  ...componentProps,
  /**
   * The center of the map, supports .sync modifier
   */
  center: {
    type: [Object, Array],
      default: () => [0, 0],
  },
  /**
   * The bounds of the map, supports .sync modifier
   */
  bounds: {
    type: [Array, Object],
      default: undefined,
  },
  /**
   * The max bounds of the map
   */
  maxBounds: {
    type: [Array, Object],
      default: undefined,
  },
  /**
   * The zoom of the map, supports .sync modifier
   */
  zoom: {
    type: Number,
      default: 0,
  },
  /**
   * The minZoom of the map
   */
  minZoom: {
    type: Number,
      default: undefined,
  },
  /**
   * The maxZoom of the map
   */
  maxZoom: {
    type: Number,
      default: undefined,
  },
  /**
   * The paddingBottomRight of the map
   */
  paddingBottomRight: {
    type: Array,
      default: undefined,
  },
  /**
   * The paddingTopLeft of the map
   */
  paddingTopLeft: {
    type: Array,
      default: undefined,
  },
  /**
   * The padding of the map
   */
  padding: {
    type: Array,
      default: undefined,
  },
  /**
   * The worldCopyJump option for the map
   */
  worldCopyJump: {
    type: Boolean,
      default: false,
    default: undefined,
  },
  /**
   * The CRS to use for the map. Can be an object that defines a coordinate reference
@@ -103,11 +93,9 @@ export default {
   */
  crs: {
    type: [String, Object],
      default: "EPSG3857",
  },
  maxBoundsViscosity: {
    type: Number,
      default: undefined,
  },
  inertia: {
    type: Boolean,
@@ -115,15 +103,12 @@ export default {
  },
  inertiaDeceleration: {
    type: Number,
      default: undefined,
  },
  inertiaMaxSpeed: {
    type: Number,
      default: undefined,
  },
  easeLinearity: {
    type: Number,
      default: undefined,
  },
  zoomAnimation: {
    type: Boolean,
@@ -131,7 +116,6 @@ export default {
  },
  zoomAnimationThreshold: {
    type: Number,
      default: undefined,
  },
  fadeAnimation: {
    type: Boolean,
@@ -143,13 +127,17 @@ export default {
  },
  noBlockingAnimations: {
    type: Boolean,
      default: false,
    default: undefined,
  },
  useGlobalLeaflet: {
    type: Boolean,
      default: true,
    },
    default: undefined,
  },
};

export default {
  emits: ["ready", "update:zoom", "update:center", "update:bounds"],
  props: mapProps,
  setup(props, context) {
    const root = ref(null);
    const blueprint = reactive({
@@ -158,26 +146,10 @@ export default {
      layersToAdd: [],
      layersInControl: [],
    });

    const { options: componentOptions } = setupComponent(props);
    const options = {
      ...componentOptions,
      minZoom: props.minZoom,
      maxZoom: props.maxZoom,
      maxBounds: props.maxBounds,
      maxBoundsViscosity: props.maxBoundsViscosity,
      worldCopyJump: props.worldCopyJump,
      crs: props.crs,
      center: props.center,
      zoom: props.zoom,
      inertia: props.inertia,
      inertiaDeceleration: props.inertiaDeceleration,
      inertiaMaxSpeed: props.inertiaMaxSpeed,
      easeLinearity: props.easeLinearity,
      zoomAnimation: props.zoomAnimation,
      zoomAnimationThreshold: props.zoomAnimationThreshold,
      fadeAnimation: props.fadeAnimation,
      markerZoomAnimation: props.markerZoomAnimation,
    };

    const options = propsToLeafletOptions(props, mapProps, componentOptions);

    const addLayer = provideLeafletWrapper("addLayer");
    const removeLayer = provideLeafletWrapper("removeLayer");
+4 −0
Original line number Diff line number Diff line
@@ -5,15 +5,19 @@ export const controlLayersProps = {
  ...controlProps,
  collapsed: {
    type: Boolean,
    default: undefined,
  },
  autoZIndex: {
    type: Boolean,
    default: undefined,
  },
  hideSingleBase: {
    type: Boolean,
    default: undefined,
  },
  sortLayers: {
    type: Boolean,
    default: undefined,
  },
  sortFunction: {
    type: Function,
+3 −0
Original line number Diff line number Diff line
@@ -8,12 +8,15 @@ export const controlScaleProps = {
  },
  metric: {
    type: Boolean,
    default: undefined,
  },
  imperial: {
    type: Boolean,
    default: undefined,
  },
  updateWhenIdle: {
    type: Boolean,
    default: undefined,
  },
};

+1 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ export const gridLayerProps = {
  },
  noWrap: {
    type: Boolean,
    default: undefined,
  },
  minZoom: {
    type: Number,
+2 −0
Original line number Diff line number Diff line
@@ -14,9 +14,11 @@ export const imageOverlayProps = {
  },
  interactive: {
    type: Boolean,
    default: undefined,
  },
  crossOrigin: {
    type: Boolean,
    default: undefined,
  },
  errorOverlayUrl: {
    type: String,
Loading