Skip to content

Commit

Permalink
Merge pull request #190 from jcachuryb/master
Browse files Browse the repository at this point in the history
Map Pop up attempt center
  • Loading branch information
xzzy authored Feb 7, 2025
2 parents 31829ff + 6d8bf38 commit c8c59fa
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 66 deletions.
3 changes: 1 addition & 2 deletions parkstay/frontend/searchavail2/src/components/parkfinder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1136,8 +1136,7 @@ export default {
.mapPopup {
position: absolute;
background-color: white;
-webkit-filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.2));
filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.2));
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
padding: 15px;
border-radius: 10px;
border: 1px solid #cccccc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -580,54 +580,6 @@ export default {
left: 50%;
}
.mapPopup {
position: absolute;
background-color: white;
-webkit-filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.2));
filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.2));
padding: 15px;
border-radius: 10px;
border: 1px solid #cccccc;
bottom: 32px;
left: -140px;
width: 280px;
}
.mapPopup:after,
.mapPopup:before {
top: 100%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.mapPopup:after {
border-top-color: white;
border-width: 10px;
left: 138px;
margin-left: -10px;
}
.mapPopup:before {
border-top-color: #cccccc;
border-width: 11px;
left: 138px;
margin-left: -11px;
}
.mapPopupClose {
text-decoration: none;
position: absolute;
top: 2px;
right: 8px;
}
.mapPopupClose:after {
content: "";
}
.searchTitle {
font-size: 150%;
Expand Down
36 changes: 24 additions & 12 deletions parkstay/frontend/searchavail2/src/utils/map_init_mount.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,13 @@ export default function (vm) {
vm.popupContent = document.getElementById('mapPopupContent');
vm.popup = new ol.Overlay({
element: document.getElementById('mapPopup'),
autoPan: true,
autoPanAnimation: {
duration: 250,
offset: [0, 0],
positioning: 'center-center',
autoPan: {
margin: 8,
animation: {
duration: 1000,
},
},
});

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

const coord = feature.getGeometry().getCoordinates();
const view = vm.olmap.getView();
let resolution = view.getResolution();
let resolution = vm.resolutions[10];
if (zoom_level > 0) {
resolution = vm.resolutions[zoom_level];
}
// really want to make vue.js render this, except reactivity dies
// when you pass control of the popup element to OpenLayers :(
$('#mapPopupName')[0].innerHTML = feature.get('name');
Expand Down Expand Up @@ -495,16 +503,20 @@ export default function (vm) {
feature.getId()
);
}
// makes sure the
setTimeout(()=> {
setTimeout(() => {
view.animate(
{
center: coord,
resolution: resolution,
duration: 1000,
}
);
return true;
}, 300);
setTimeout(() => {
vm.popup.setPosition(coord);
view.animate({
center: coord,
resolution: resolution,
duration: 1000,
});
return true;
}, 300)
}, 1300);
},
{
layerFilter: function (layer) {
Expand Down
2 changes: 1 addition & 1 deletion parkstay/static/searchavail2_vue/css/main.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions parkstay/static/searchavail2_vue/js/main-legacy.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion parkstay/static/searchavail2_vue/js/main.js

Large diffs are not rendered by default.

0 comments on commit c8c59fa

Please sign in to comment.