Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@draganfilipovic/confluence-map

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@draganfilipovic/confluence-map - npm Package Compare versions

Comparing version 1.2.13 to 1.2.14

2

package.json
{
"name": "@draganfilipovic/confluence-map",
"version": "1.2.13",
"version": "1.2.14",
"description": "embed OSM into Confluence pages",

@@ -5,0 +5,0 @@ "license": "Apache-2.0",

@@ -12,3 +12,3 @@ import { config } from './config.js';

this.addTiles(map);
this.addMarkers(map, NS.state);
this.addMarkers(map, NS.state, NS.center);

@@ -32,10 +32,15 @@ return map;

addMarkers(map, state) {
addMarkers(map, state, center) {
NS.L.Icon.Default.imagePath = `${config.LEAFLET.PATH}/images/`;
Object.values(state).forEach(({ location, label }) => {
const marker = NS.L.marker(location);
marker.bindPopup(label).openPopup();
marker.addTo(map);
})
this.addMarker(map, location, label);
});
this.addMarker(map, center, 'Center');
}
addMarker(map, location, label) {
const marker = NS.L.marker(location);
marker.bindPopup(label).openPopup();
marker.addTo(map);
}
}
class NameSpace {
constructor(name) {
this._center = [0, 0];
this._state = {};

@@ -26,3 +27,24 @@ this._config = {};

};
if (typeof active === 'boolean') {
this.updateCenter();
}
}
get center() {
return this._center;
}
updateCenter() {
const list = Object.values(this.state)
.map(({ location }) => location.map(l => Number(l)));
const size = list.length;
if (size === 1) {
return list;
}
this._center = list.reduce((acc, curr) => {
return [acc[0] + curr[0]/size, acc[1] + curr[1]/size]
}, [0, 0]);
}
}

@@ -29,0 +51,0 @@

@@ -24,3 +24,3 @@ import { NS } from './ns.js';

this.multiRoutingControl = this.multiRoutingControl || {};
const center = this.getCenter();
const center = NS.center;
const centerPoint = NS.L.latLng(center[0], center[1]);

@@ -85,15 +85,6 @@ console.log({ centerPoint, waypoints });

async zoomToCenter() {
const points = Object.values(NS.state).map(({ location }) => location);
const points = Object.values(NS.cen).map(({ location }) => location);
await NS.map.fitBounds(points);
return this.__sleep(300);
}
getCenter() {
const list = Object.values(NS.state)
.map(({ location }) => location.map(l => Number(l)));
const size = list.length;
return list.reduce((acc, curr) => {
return [acc[0] + curr[0]/size, acc[1] + curr[1]/size]
}, [0, 0]);
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc