Skip to content

Commit c8c59fa

Browse files
authored
Merge pull request #190 from jcachuryb/master
Map Pop up attempt center
2 parents 31829ff + 6d8bf38 commit c8c59fa

File tree

6 files changed

+29
-66
lines changed

6 files changed

+29
-66
lines changed

parkstay/frontend/searchavail2/src/components/parkfinder.vue

+1-2
Original file line numberDiff line numberDiff line change
@@ -1136,8 +1136,7 @@ export default {
11361136
.mapPopup {
11371137
position: absolute;
11381138
background-color: white;
1139-
-webkit-filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.2));
1140-
filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.2));
1139+
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
11411140
padding: 15px;
11421141
border-radius: 10px;
11431142
border: 1px solid #cccccc;

parkstay/frontend/searchavail2/src/components/searchCarousel/SearchCarousel.vue

-48
Original file line numberDiff line numberDiff line change
@@ -580,54 +580,6 @@ export default {
580580
left: 50%;
581581
}
582582
583-
.mapPopup {
584-
position: absolute;
585-
background-color: white;
586-
-webkit-filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.2));
587-
filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.2));
588-
padding: 15px;
589-
border-radius: 10px;
590-
border: 1px solid #cccccc;
591-
bottom: 32px;
592-
left: -140px;
593-
width: 280px;
594-
}
595-
596-
.mapPopup:after,
597-
.mapPopup:before {
598-
top: 100%;
599-
border: solid transparent;
600-
content: " ";
601-
height: 0;
602-
width: 0;
603-
position: absolute;
604-
pointer-events: none;
605-
}
606-
607-
.mapPopup:after {
608-
border-top-color: white;
609-
border-width: 10px;
610-
left: 138px;
611-
margin-left: -10px;
612-
}
613-
614-
.mapPopup:before {
615-
border-top-color: #cccccc;
616-
border-width: 11px;
617-
left: 138px;
618-
margin-left: -11px;
619-
}
620-
621-
.mapPopupClose {
622-
text-decoration: none;
623-
position: absolute;
624-
top: 2px;
625-
right: 8px;
626-
}
627-
628-
.mapPopupClose:after {
629-
content: "";
630-
}
631583
632584
.searchTitle {
633585
font-size: 150%;

parkstay/frontend/searchavail2/src/utils/map_init_mount.js

+24-12
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,13 @@ export default function (vm) {
311311
vm.popupContent = document.getElementById('mapPopupContent');
312312
vm.popup = new ol.Overlay({
313313
element: document.getElementById('mapPopup'),
314-
autoPan: true,
315-
autoPanAnimation: {
316-
duration: 250,
314+
offset: [0, 0],
315+
positioning: 'center-center',
316+
autoPan: {
317+
margin: 8,
318+
animation: {
319+
duration: 1000,
320+
},
317321
},
318322
});
319323

@@ -398,10 +402,14 @@ export default function (vm) {
398402
async function (feature, layer) {
399403
vm.popup.setPosition(undefined); // resets popup
400404
vm.selectedFeature = feature;
405+
var zoom_level = $('#zoom_level').val();
401406

402407
const coord = feature.getGeometry().getCoordinates();
403408
const view = vm.olmap.getView();
404-
let resolution = view.getResolution();
409+
let resolution = vm.resolutions[10];
410+
if (zoom_level > 0) {
411+
resolution = vm.resolutions[zoom_level];
412+
}
405413
// really want to make vue.js render this, except reactivity dies
406414
// when you pass control of the popup element to OpenLayers :(
407415
$('#mapPopupName')[0].innerHTML = feature.get('name');
@@ -495,16 +503,20 @@ export default function (vm) {
495503
feature.getId()
496504
);
497505
}
498-
// makes sure the
499-
setTimeout(()=> {
506+
setTimeout(() => {
507+
view.animate(
508+
{
509+
center: coord,
510+
resolution: resolution,
511+
duration: 1000,
512+
}
513+
);
514+
return true;
515+
}, 300);
516+
setTimeout(() => {
500517
vm.popup.setPosition(coord);
501-
view.animate({
502-
center: coord,
503-
resolution: resolution,
504-
duration: 1000,
505-
});
506518
return true;
507-
}, 300)
519+
}, 1300);
508520
},
509521
{
510522
layerFilter: function (layer) {

parkstay/static/searchavail2_vue/css/main.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

parkstay/static/searchavail2_vue/js/main-legacy.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

parkstay/static/searchavail2_vue/js/main.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)