# FacilMap component

The FacilMap component renders a complete FacilMap UI. It can be used like this in a Vue.js app:

<template>
	<FacilMap base-url="/" server-url="https://facilmap.org/" pad-id="my-map"></FacilMap>
</template>
<script>
	import { FacilMap } from "facilmap-frontend";

	export default {
		components: { FacilMap }
	};
</script>

In a non-Vue.js app, it can be embedded like this:

import { FacilMap } from "facilmap-frontend";
import Vue from "vue";

new Vue({
	el: "#facilmap", // A selector whose DOM element will be replaced with the FacilMap component
	components: { FacilMap },
	render: (h) => (
		h("FacilMap", {
			props: {
				baseUrl: "/",
				serverUrl: "https://facilmap.org/",
				padId: "my-map"
			}
		})
	)
});

# Props

Note that all of these props are reactive and can be changed while the map is open.

  • baseUrl (string, required): Collaborative maps should be reachable under ${baseUrl}${mapId}, while the general map should be available under ${baseUrl}. For the default FacilMap installation, baseUrl would be https://facilmap.org/ (or simply /). It needs to end with a slash. It is used to create the map URL for example in the map settings or when switching between different maps (only in interactive mode).
  • serverUrl (string, required): The URL under which the FacilMap server is running, for example https://facilmap.org/. This is invisible to the user.
  • padId (string, optional): The ID of the collaborative map that should be opened. If this is undefined, no map is opened. This is reactive, when a new value is passed, a new map is opened. Note that the map ID may change as the map is open, either because the ID of the map is changed in the map settings, or because the user navigates to a different map (only in interactive mode). Use :padId.sync to get a two-way binding (opens new window) (or listen to the update:padId event).
  • toolbox (boolean, optional): Whether the toolbox should be shown. Default is true.
  • search (boolean, optional): Whether the search box should be shown. Default is true.
  • autofocus (boolean, optional): Whether the search field should be focused. Default is false.
  • legend (boolean, optional): Whether the legend should be shown (if it is available). Default is true.
  • interactive (boolean, optional): Whether interactive mode should be enabled. Default is true.
  • linkLogo (boolean, optional): If true, the FacilMap logo will be a link that opens the map in a new window. Default is false.
  • updateHash (boolean, optional): Whether location.hash should be synchonised with the current map view. Default is false.

# Events

  • update:padId: When the ID of the currently open map is changed, either because the ID of the map was changed in the map settings or because the user navigated to another map. The parameter is a string or undefined (if no map is opened).
  • update:padName: When the name of the currently open map is changed, either because it was changed in the map settings or because the user navigated to another map. The parameter is a string or undefined (if no map is opened).

# Slots

  • default: Components in this slot are rendered directly on top of the map. It makes sense to position them absolutely and choose an appropriate z-index.
  • before, after: Components in these slots are rendered above and below the map. Note that on narrow screens (such as smartphones), the search box is also rendered in the after slot.

# Styling

By default, the FacilMap component renders a flex box with flex-grow: 1. To render it at a certain size, wrap it in a flex box of a certain size or override the styles of the fm-facilmap class.

The map itself will shrink to make space for the before and after slots.