11<template >
22 <div class =" bw-page-container" >
33 <div class =" tlocrt" >
4+ <div class =" map-wrapper" >
5+ <div ref =" mapEl" class =" map-container" aria-label =" Location map" ></div >
6+ </div >
47 <div class =" image" >
58 <img class =" tlocrt-desktop" src =" ../../assets/tlocrt/tlocrt-desktop.svg" alt =" Brucifer Tlocrt" />
69 <img class =" tlocrt-tablet" src =" ../../assets/tlocrt/tlocrt-tablet.svg" alt =" Brucifer Tlocrt" />
3235import Footer from ' @/components/NavbarAndFooter/Footer.vue'
3336import NavbarBweb from ' @/components/NavbarAndFooter/NavbarBweb.vue'
3437
38+ import L from ' leaflet'
39+ import ' leaflet/dist/leaflet.css'
40+
3541export default {
3642 name: ' Naslovnica' ,
3743 components: { Footer, NavbarBweb },
38- props: {
39- msg: String
44+ data () {
45+ return {
46+ map: null ,
47+ params: {
48+ zoom: 0 ,
49+ center: { lat: 0 , lng: 0 },
50+ bounds: { sw: { lat: 0 , lng: 0 }, ne: { lat: 0 , lng: 0 } }
51+ }
52+ }
53+ },
54+ mounted () {
55+ this .$nextTick (() => {
56+ // --- Basic map ---
57+ this .map = L .map (this .$refs .mapEl , {
58+ scrollWheelZoom: false ,
59+ zoomControl: true
60+ })
61+
62+ // Base tiles
63+ // Simple, no-labels basemap
64+ // Base dark-gray layer:
65+ const base = L .tileLayer (' https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png' , {
66+ maxZoom: 19 ,
67+ attribution: ' © OpenStreetMap contributors'
68+ }).addTo (this .map )
69+
70+ this .map .getPane (' tilePane' ).style .filter = ' brightness(0.45) contrast(1.55)'
71+
72+
73+
74+ // Center and bounds (SC area)
75+ const scCenter = L .latLng (45.804 , 15.9673 )
76+ const scBounds = scCenter .toBounds (1000 ) // ~1km box
77+
78+ // Fit to area and clamp a bit so users don't drag too far
79+ const clamped = scBounds .pad (0.15 )
80+ this .map .fitBounds (scBounds, { padding: [30 , 30 ] })
81+ this .map .setMaxBounds (clamped)
82+ const minZoom = this .map .getBoundsZoom (clamped, true )
83+ this .map .setMinZoom (minZoom)
84+
85+ // --- SVG overlay (tlocrt) ---
86+ const overlayBounds = L .latLngBounds (
87+ [45.8027 , 15.9647 ],
88+ [45.8053 , 15.9699 ]
89+ )
90+ L .imageOverlay (
91+ // if using Vite/Webpack with file-loader, require() keeps bundling intact
92+ require (' @/assets/tlocrt/tlocrt-desktop.svg' ),
93+ overlayBounds,
94+ { opacity: 1 , interactive: false }
95+ ).addTo (this .map )
96+
97+ // Keep the “Parameters” panel in sync
98+ const updateParams = () => {
99+ const c = this .map .getCenter ()
100+ const b = this .map .getBounds ()
101+ this .params .zoom = this .map .getZoom ()
102+ this .params .center = { lat: c .lat , lng: c .lng }
103+ this .params .bounds = {
104+ sw: { lat: b .getSouthWest ().lat , lng: b .getSouthWest ().lng },
105+ ne: { lat: b .getNorthEast ().lat , lng: b .getNorthEast ().lng }
106+ }
107+ }
108+ this .map .on (' moveend zoomend' , updateParams)
109+ updateParams ()
110+
111+ // Final size fix in case container animates in
112+ setTimeout (() => this .map && this .map .invalidateSize (), 150 )
113+ })
40114 },
115+ beforeUnmount () {
116+ if (this .map ) {
117+ this .map .off ()
118+ this .map .remove ()
119+ this .map = null
120+ }
121+ }
41122}
42123 </script >
43124
44125<style scoped>
126+ .map-wrapper {
127+ position : relative ;
128+ }
129+
130+ .map-container {
131+ width : 100% ;
132+ height : 60vh ;
133+ border-radius : 12px ;
134+ overflow : hidden ;
135+ }
136+
137+ .params {
138+ position : absolute ;
139+ top : 12px ;
140+ left : 12px ;
141+ background : rgba (255 , 255 , 255 , 0.9 );
142+ padding : 8px 10px ;
143+ border-radius : 8px ;
144+ font-size : 12px ;
145+ line-height : 1.4 ;
146+ box-shadow : 0 2px 10px rgba (0 , 0 , 0 , 0.08 );
147+ }
148+
45149.tlocrt {
46150 width : 100% ;
47151 min-height : 93vh ;
@@ -112,4 +216,4 @@ export default {
112216}
113217
114218@import url (../../bruciweb.css );
115- </style >
219+ </style >
0 commit comments