@woosmap/ui 2.43.0 → 2.44.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@woosmap/ui",
3
- "version": "2.43.0",
3
+ "version": "2.44.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/WebGeoServices/ui.git"
@@ -16,6 +16,7 @@ import WalkingImg from '../../images/walk.png';
16
16
  import { tr } from '../utils/locale';
17
17
  import markerIcon from '../../images/marker.png';
18
18
  import Script from '../utils/Script';
19
+ import { createWoosmapMap } from '../Map/drawOnMap';
19
20
 
20
21
  const languages = [
21
22
  { value: 'fr', label: 'French' },
@@ -209,7 +210,7 @@ export default class DistanceDemo extends Component {
209
210
  }
210
211
 
211
212
  if (window.woosmap && window.woosmap.map && this.mapDivRef.current) {
212
- this.map = new window.woosmap.map.Map(this.mapDivRef.current);
213
+ this.map = createWoosmapMap(this.mapDivRef.current);
213
214
  this.requestDistance();
214
215
  } else {
215
216
  this.timeoutMap = setTimeout(this.displayMap, 300);
@@ -6,12 +6,12 @@ import Demo from './SkeletonDemo';
6
6
 
7
7
  import Constants from '../../Constants';
8
8
  import { tr } from '../utils/locale';
9
- import markerIcon from '../../images/marker.png';
10
- import markerIconAlt from '../../images/marker-alt.png';
9
+ import markerIcon from '../../images/marker-dot.svg';
10
+ import markerGeolocationIcon from '../../images/marker-alt.png';
11
11
  import Script from '../utils/Script';
12
12
  import Input from '../Input/Input';
13
13
 
14
- import { WoosmapMapBoundingBox, woosmapBoundsFromViewport } from '../Map/drawOnMap';
14
+ import { WoosmapMapBoundingBox, woosmapBoundsFromViewport, createWoosmapMap } from '../Map/drawOnMap';
15
15
 
16
16
  export default class GeolocationDemo extends Component {
17
17
  constructor(props) {
@@ -56,20 +56,17 @@ export default class GeolocationDemo extends Component {
56
56
  getRequestparams = () => ({
57
57
  key: Constants.geolocationWoosmapSearchKey,
58
58
  radius: 200000,
59
+ limit: 20,
59
60
  });
60
61
 
61
- processMarker = (latLng, icon, forceMap = null) => {
62
+ processMarker = (latLng, icon, forceMap = null, scaledSize = { height: 24, width: 24 }) => {
62
63
  const { showStores } = this.state;
63
64
 
64
65
  let map;
65
66
  if (!forceMap) map = showStores ? this.map : null;
66
67
  else map = forceMap;
67
68
 
68
- return new window.woosmap.map.Marker({
69
- icon: { url: icon, scaledSize: { height: 46, width: 30 } },
70
- position: latLng,
71
- map,
72
- });
69
+ return new window.woosmap.map.Marker({ icon: { url: icon, scaledSize }, position: latLng, map });
73
70
  };
74
71
 
75
72
  displayOnMap = () => {
@@ -93,8 +90,6 @@ export default class GeolocationDemo extends Component {
93
90
  this.overlay = null;
94
91
  }
95
92
 
96
- this.marker = this.processMarker(location, markerIconAlt, this.map);
97
-
98
93
  if (geolocation?.stores?.features) {
99
94
  geolocation.stores.features.forEach((feature) => {
100
95
  const [lng, lat] = feature.geometry.coordinates;
@@ -102,6 +97,8 @@ export default class GeolocationDemo extends Component {
102
97
  });
103
98
  }
104
99
 
100
+ this.marker = this.processMarker(location, markerGeolocationIcon, this.map, { height: 46, width: 30 });
101
+
105
102
  const bounds = woosmapBoundsFromViewport(geolocation.viewport);
106
103
 
107
104
  this.overlay = new WoosmapMapBoundingBox(bounds, { top: 55, left: 30, bottom: 10, right: 30 });
@@ -182,7 +179,7 @@ export default class GeolocationDemo extends Component {
182
179
  }
183
180
 
184
181
  if (window.woosmap && window.woosmap.map && this.mapDivRef.current) {
185
- this.map = new window.woosmap.map.Map(this.mapDivRef.current);
182
+ this.map = createWoosmapMap(this.mapDivRef.current);
186
183
  this.requestGeolocation();
187
184
  } else {
188
185
  this.timeoutMap = setTimeout(this.displayMap, 300);
@@ -10,6 +10,7 @@ import { tr } from '../utils/locale';
10
10
  import Input from '../Input/Input';
11
11
  import markerIcon from '../../images/marker.png';
12
12
  import Script from '../utils/Script';
13
+ import { createWoosmapMap } from '../Map/drawOnMap';
13
14
 
14
15
  export default class LocalitiesAddressDemo extends Component {
15
16
  constructor(props) {
@@ -326,7 +327,7 @@ export default class LocalitiesAddressDemo extends Component {
326
327
  }
327
328
 
328
329
  if (window.woosmap && window.woosmap.map && this.mapDivRef.current) {
329
- this.map = new window.woosmap.map.Map(this.mapDivRef.current);
330
+ this.map = createWoosmapMap(this.mapDivRef.current);
330
331
  this.requestAddress();
331
332
  } else {
332
333
  this.timeoutMap = setTimeout(this.displayMap, 300);
@@ -13,7 +13,7 @@ import Constants from '../../Constants';
13
13
  import { tr } from '../utils/locale';
14
14
  import markerIcon from '../../images/marker.png';
15
15
  import Script from '../utils/Script';
16
- import { WoosmapMapBoundingBox } from '../Map/drawOnMap';
16
+ import { WoosmapMapBoundingBox, createWoosmapMap } from '../Map/drawOnMap';
17
17
 
18
18
  const languages = [
19
19
  { value: 'fr', label: 'French' },
@@ -195,7 +195,7 @@ export default class LocalitiesDemo extends Component {
195
195
  }
196
196
 
197
197
  if (window.woosmap && window.woosmap.map && this.mapDivRef.current) {
198
- this.map = new window.woosmap.map.Map(this.mapDivRef.current);
198
+ this.map = createWoosmapMap(this.mapDivRef.current);
199
199
  this.requestLocalities();
200
200
  } else {
201
201
  this.timeoutMap = setTimeout(this.displayMap, 300);
@@ -11,6 +11,7 @@ import { tr } from '../utils/locale';
11
11
  import markerIcon from '../../images/marker.png';
12
12
  import markerIconAlt from '../../images/marker-alt.png';
13
13
  import Script from '../utils/Script';
14
+ import { createWoosmapMap } from '../Map/drawOnMap';
14
15
  import 'resize-observer-polyfill/dist/ResizeObserver.global';
15
16
 
16
17
  export default class SearchDemo extends Component {
@@ -189,7 +190,7 @@ export default class SearchDemo extends Component {
189
190
  if (this.timeoutMap) clearTimeout(this.timeoutMap);
190
191
 
191
192
  if (window.woosmap && window.woosmap.map && this.mapDivRef.current) {
192
- this.map = new window.woosmap.map.Map(this.mapDivRef.current);
193
+ this.map = createWoosmapMap(this.mapDivRef.current);
193
194
  this.requestSearch();
194
195
  } else {
195
196
  this.timeoutMap = setTimeout(this.displayMap, 300);
@@ -84,6 +84,46 @@ export const woosmapBoundsFromViewport = function woosmapBoundsFromViewport(view
84
84
  );
85
85
  };
86
86
 
87
+ export const createWoosmapMap = (node) =>
88
+ new window.woosmap.map.Map(node, {
89
+ styles: [
90
+ {
91
+ featureType: 'administrative',
92
+ elementType: 'all',
93
+ stylers: [{ visibility: 'on' }, { saturation: -100 }, { lightness: 20 }],
94
+ },
95
+ {
96
+ featureType: 'road',
97
+ elementType: 'all',
98
+ stylers: [{ visibility: 'on' }, { saturation: -100 }, { lightness: 40 }],
99
+ },
100
+ {
101
+ featureType: 'water',
102
+ elementType: 'all',
103
+ stylers: [{ visibility: 'on' }, { saturation: -10 }, { lightness: 30 }],
104
+ },
105
+ {
106
+ featureType: 'landscape.man_made',
107
+ elementType: 'all',
108
+ stylers: [{ visibility: 'simplified' }, { saturation: -60 }, { lightness: 10 }],
109
+ },
110
+ {
111
+ featureType: 'landscape.natural',
112
+ elementType: 'all',
113
+ stylers: [{ visibility: 'simplified' }, { saturation: -60 }, { lightness: 60 }],
114
+ },
115
+ {
116
+ featureType: 'poi',
117
+ elementType: 'all',
118
+ stylers: [{ visibility: 'off' }, { saturation: -100 }, { lightness: 60 }],
119
+ },
120
+ {
121
+ featureType: 'transit',
122
+ elementType: 'all',
123
+ stylers: [{ visibility: 'off' }, { saturation: -100 }, { lightness: 60 }],
124
+ },
125
+ ],
126
+ });
87
127
  export class WoosmapMapBoundingBox {
88
128
  constructor(bounds, padding) {
89
129
  this.overlayView = new window.woosmap.map.OverlayView();
@@ -0,0 +1,15 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32.64 32.64" width="32.64" height="32.64">
2
+ <defs>
3
+ <filter id="dropshadow" height="130%">
4
+ <feGaussianBlur in="SourceAlpha" stdDeviation="1.6"/>
5
+ <feOffset dx="0" dy="1" result="offsetblur"/>
6
+ <feComponentTransfer>
7
+ <feFuncA type="linear" slope="0.4"/>
8
+ </feComponentTransfer>
9
+ <feMerge>
10
+ <feMergeNode/>
11
+ <feMergeNode in="SourceGraphic"/>
12
+ </feMerge>
13
+ </filter>
14
+ </defs>
15
+ <path d="M16.15,27.67a12.486,12.486,0,0,1-8.857-3.663,12.637,12.637,0,0,1,.1-17.714A12.49,12.49,0,1,1,16.15,27.67Z" fill="#fff" filter="url(#dropshadow)" /><path d="M23.593,7.707a10.468,10.468,0,0,0-14.786,0A10.629,10.629,0,0,0,8.715,22.6,10.526,10.526,0,0,0,23.593,7.707Z" fill="#5587fd"/><path d="M16.3,7.9A5.335,5.335,0,0,0,11,13.2c0,3.8,4.8,5.8,4.8,9.4,0,.3.2.4.5.4a.458.458,0,0,0,.5-.4c0-3.5,4.8-5.5,4.8-9.4A5.271,5.271,0,0,0,16.3,7.9Z" fill="#fff"/><circle cx="16.3" cy="13.4" r="2.1" fill="#5587fd"/><rect width="32.6" height="32.6" fill="none"/></svg>