mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-16 14:51:41 +00:00
usar el tamaño del svg
This commit is contained in:
parent
417559399a
commit
cf5341eec4
1 changed files with 15 additions and 3 deletions
|
@ -55,13 +55,25 @@ export default class extends Controller {
|
||||||
return [this.lat, this.lng]
|
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 () {
|
get map () {
|
||||||
if (!this._map) {
|
if (!this._map) {
|
||||||
this._map = L.map(this.mapTarget).setView(this.coords, 13);
|
this._map = L.map(this.mapTarget).setView(this.coords, 13);
|
||||||
|
|
||||||
const bounds = [[0,0], [this.mapTarget.clientHeight, this.mapTarget.clientWidth]];
|
L.svgOverlay(this.svgOverlay, this.bounds).addTo(this._map);
|
||||||
|
|
||||||
L.svgOverlay(this.overlayTarget.querySelector('svg'), bounds).addTo(this._map);
|
|
||||||
|
|
||||||
this._map.fitBounds(bounds);
|
this._map.fitBounds(bounds);
|
||||||
this._map.setMaxBounds(bounds);
|
this._map.setMaxBounds(bounds);
|
||||||
|
|
Loading…
Reference in a new issue