@teipublisher/pb-components 1.30.3 → 1.30.4

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": "@teipublisher/pb-components",
3
- "version": "1.30.3",
3
+ "version": "1.30.4",
4
4
  "description": "Collection of webcomponents underlying TEI Publisher",
5
5
  "repository": "https://github.com/eeditiones/tei-publisher-components.git",
6
6
  "main": "index.html",
package/pb-elements.json CHANGED
@@ -3738,6 +3738,11 @@
3738
3738
  "type": "string",
3739
3739
  "default": "\"mouseover\""
3740
3740
  },
3741
+ {
3742
+ "name": "auto",
3743
+ "type": "boolean",
3744
+ "default": "false"
3745
+ },
3741
3746
  {
3742
3747
  "name": "key",
3743
3748
  "description": "The key to which this element is connected.",
@@ -3819,6 +3824,12 @@
3819
3824
  "type": "string",
3820
3825
  "default": "\"mouseover\""
3821
3826
  },
3827
+ {
3828
+ "name": "auto",
3829
+ "attribute": "auto",
3830
+ "type": "boolean",
3831
+ "default": "false"
3832
+ },
3822
3833
  {
3823
3834
  "name": "key",
3824
3835
  "attribute": "key",
@@ -32,6 +32,9 @@ export class PbGeolocation extends PbHighlight {
32
32
  },
33
33
  event: {
34
34
  type: String
35
+ },
36
+ auto: {
37
+ type: Boolean
35
38
  }
36
39
  };
37
40
  }
@@ -39,22 +42,38 @@ export class PbGeolocation extends PbHighlight {
39
42
  constructor() {
40
43
  super();
41
44
  this.event = 'mouseover';
45
+ this.auto = false;
42
46
  }
43
47
 
44
48
  connectedCallback() {
45
49
  super.connectedCallback();
46
50
 
47
- this.addEventListener(this.event, () =>
48
- this.emitTo('pb-geolocation', {
49
- coordinates: {
50
- latitude: this.latitude,
51
- longitude: this.longitude
52
- },
53
- label: this.label,
54
- popup: this.popup,
55
- element: this
56
- })
57
- );
51
+ if (this.event) {
52
+ this.addEventListener(this.event, () =>
53
+ this.emitTo('pb-geolocation', {
54
+ coordinates: {
55
+ latitude: this.latitude,
56
+ longitude: this.longitude
57
+ },
58
+ label: this.label,
59
+ popup: this.popup,
60
+ element: this
61
+ })
62
+ );
63
+ }
64
+ if (this.auto) {
65
+ this.waitForChannel(() => {
66
+ this.emitTo('pb-geolocation', {
67
+ coordinates: {
68
+ latitude: this.latitude,
69
+ longitude: this.longitude
70
+ },
71
+ label: this.label,
72
+ popup: this.popup,
73
+ element: this
74
+ });
75
+ });
76
+ }
58
77
  }
59
78
 
60
79
  render() {
@@ -12,7 +12,6 @@ import './pb-map-layer.js';
12
12
  * @fires pb-update-map - When received, redraws the map to fit markers passed in with the event
13
13
  * @fires pb-update - When received, redraws the map to show markers for all pb-geolocation elements
14
14
  * @fires pb-geolocation - When received, focuses the map on the geocoordinates passed in with the event
15
-
16
15
  */
17
16
  export class PbLeafletMap extends pbMixin(LitElement) {
18
17
  static get properties() {
@@ -143,7 +142,7 @@ export class PbLeafletMap extends pbMixin(LitElement) {
143
142
  });
144
143
  });
145
144
  // this._map.invalidateSize();
146
- if (locations.length > 1) {
145
+ if (locations.length >= 1) {
147
146
  this._map.fitBounds(bounds);
148
147
  } else {
149
148
  this._map.fitWorld();