5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-06-02 05:24:17 +00:00

usar el tamaño del svg

This commit is contained in:
f 2022-02-01 18:20:19 -03:00
parent 417559399a
commit cf5341eec4

View file

@ -55,13 +55,25 @@ export default class extends Controller {
return [this.lat, this.lng]
}
get svgOverlay () {
return this.overlayTarget.querySelector('svg');
}
get bounds () {
return [
[0, 0],
[
this.svgOverlay.viewBox.baseVal.height,
this.svgOverlay.viewBox.baseVal.width,
]
];
}
get map () {
if (!this._map) {
this._map = L.map(this.mapTarget).setView(this.coords, 13);
const bounds = [[0,0], [this.mapTarget.clientHeight, this.mapTarget.clientWidth]];
L.svgOverlay(this.overlayTarget.querySelector('svg'), bounds).addTo(this._map);
L.svgOverlay(this.svgOverlay, this.bounds).addTo(this._map);
this._map.fitBounds(bounds);
this._map.setMaxBounds(bounds);