@autobusal/utilities 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.ts +2 -1
- package/map/index.ts +23 -0
- package/map/marker-icon.png +0 -0
- package/map/marker-shadow.png +0 -0
- package/package.json +1 -1
- package/map.ts +0 -14
package/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createDate, prepareDate, getFormattedShort, differenceYears, futureDate } from './date';
|
|
2
2
|
import { Validate, Display } from './form';
|
|
3
|
-
import getPosition from './map';
|
|
3
|
+
import { getPosition, autobusMarker } from './map';
|
|
4
4
|
import { error, notify, success } from './notify';
|
|
5
5
|
import { getAllowed, getLanguages, getPayments } from './options';
|
|
6
6
|
import { getSex, getOptionsSex } from './passengers';
|
|
@@ -15,6 +15,7 @@ export {
|
|
|
15
15
|
notify,
|
|
16
16
|
success,
|
|
17
17
|
getPosition,
|
|
18
|
+
autobusMarker,
|
|
18
19
|
createDate,
|
|
19
20
|
prepareDate,
|
|
20
21
|
getFormattedShort,
|
package/map/index.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import L, { LatLngExpression } from 'leaflet';
|
|
2
|
+
import markerIcon from './marker-icon.png';
|
|
3
|
+
import markerShadow from './marker-shadow.png';
|
|
4
|
+
|
|
5
|
+
export const getPosition = (position: string[] | undefined): LatLngExpression => {
|
|
6
|
+
if (position === undefined) {
|
|
7
|
+
return [0, 0];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
return [
|
|
11
|
+
Number(position[0]),
|
|
12
|
+
Number(position[1])
|
|
13
|
+
];
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const autobusMarker = new L.Icon({
|
|
17
|
+
iconUrl: markerIcon,
|
|
18
|
+
iconSize: [25, 41], // icon size
|
|
19
|
+
iconAnchor: [12, 41], // point of the icon which will correspond to marker's location
|
|
20
|
+
popupAnchor: [1, -34], // point from which the popup should open relative to the iconAnchor
|
|
21
|
+
shadowUrl: markerShadow,
|
|
22
|
+
shadowSize: [41, 41] // shadow size
|
|
23
|
+
});
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
package/map.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { LatLngExpression } from 'leaflet';
|
|
2
|
-
|
|
3
|
-
const getPosition = (position: string[] | undefined): LatLngExpression => {
|
|
4
|
-
if (position === undefined) {
|
|
5
|
-
return [0, 0];
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
return [
|
|
9
|
-
Number(position[0]),
|
|
10
|
-
Number(position[1])
|
|
11
|
-
];
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export default getPosition;
|