Skip to content

Commit

Permalink
linting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanBirtch-aot committed Sep 23, 2024
1 parent 5a41d02 commit 73395f5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
4 changes: 1 addition & 3 deletions components/src/components/Map/Component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default class Component extends (FieldComponent as any) {
loadMap() {
const mapContainer = document.getElementById(`map-${this.componentID}`);
const form = document.getElementsByClassName('formio');
let drawOptions = {
const drawOptions = {
marker: false,
circlemarker: false,
polygon: false,
Expand Down Expand Up @@ -154,8 +154,6 @@ export default class Component extends (FieldComponent as any) {
// Additional logic to render the saved data on the map if necessary
if (this.mapService && value && value.features) {
try {
//const parsedValue = JSON.parse(value);

this.mapService.loadDrawnItems(value.features);
} catch (error) {
console.error('Failed to parse value:', error);
Expand Down
26 changes: 12 additions & 14 deletions components/src/components/Map/services/MapService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class MapService {
setTimeout(() => window.dispatchEvent(new Event('resize')), 0);
// Event listener for drawn objects
map.on('draw:created', (e) => {
let layer = e.layer;
const layer = e.layer;
if (drawnItems.getLayers().length === options.numPoints) {
L.popup()
.setLatLng(layer.getLatLng())
Expand All @@ -73,7 +73,7 @@ class MapService {
}

initializeMap(options: MapServiceOptions) {
let {
const {
mapContainer,
center,
drawOptions,
Expand All @@ -83,14 +83,13 @@ class MapService {
viewMode,
myLocation,
} = options;
console.log(options);

if (drawOptions.rectangle) {
drawOptions.rectangle.showArea = false;
}
//Check to see if there is the formio read only class in the current page, and set notEditable to true if the map is inside a read-only page
// Check to see if there is the formio read only class in the current page, and set notEditable to true if the map is inside a read-only page

//if the user chooses it to be read-only, and the
// if the user chooses it to be read-only, and the
const map = L.map(mapContainer, {
zoomAnimation: viewMode,
}).setView(center, defaultZoom || DEFAULT_MAP_ZOOM);
Expand All @@ -99,28 +98,28 @@ class MapService {
}).addTo(map);

// Initialize Draw Layer
let drawnItems = new L.FeatureGroup();
const drawnItems = new L.FeatureGroup();

map.addLayer(drawnItems);

if (myLocation) {
const myLocationButton = L.Control.extend({
options: {
position: 'topright',
position: 'bottomright',
},
onAdd: function (map) {
var container = L.DomUtil.create(
onAdd(map) {
const container = L.DomUtil.create(
'div',
'leaflet-bar leaflet-control'
);
var button = L.DomUtil.create(
const button = L.DomUtil.create(
'a',
'leaflet-control-button',
container
);
button.innerHTML = '<i class="fa fa-location-arrow"></i>';
L.DomEvent.disableClickPropagation(button);
L.DomEvent.on(button, 'click', function () {
L.DomEvent.on(button, 'click', () => {
if ('geolocation' in navigator) {
navigator.geolocation.getCurrentPosition((position) => {
map.setView(
Expand All @@ -142,16 +141,15 @@ class MapService {
container.title = 'Click to center the map on your location';
return container;
},
onRemove: function (map) {},
});
var myLocationControl = new myLocationButton();
const myLocationControl = new myLocationButton();
myLocationControl.addTo(map);
}

// Add Drawing Controllers
if (!readOnlyMap) {
if (!viewMode) {
let drawControl = new L.Control.Draw({
const drawControl = new L.Control.Draw({
draw: drawOptions,
edit: {
featureGroup: drawnItems,
Expand Down

0 comments on commit 73395f5

Please sign in to comment.