Support country-level map zoom on tracking page

master
Skylar Ittner 1 year ago
parent 148f38d9d9
commit 5285f6445f

@ -31,12 +31,20 @@ class MapControl {
* @param {number} latitude * @param {number} latitude
* @param {number} longitude * @param {number} longitude
* @param {boolean} accurate set true to zoom to street level (z13), false to zoom to general area (z10). * @param {boolean} accurate set true to zoom to street level (z13), false to zoom to general area (z10).
* @param {boolean} countrylevel set true to override accurate and set zoom level to z4
* @returns {undefined} * @returns {undefined}
*/ */
clearMarkersAndCenterMapOnNewMarker(classname, latitude, longitude, accurate) { clearMarkersAndCenterMapOnNewMarker(classname, latitude, longitude, accurate, countrylevel) {
this.mapObj.removeMarkers(); this.mapObj.removeMarkers();
this.mapObj.addMarker(latitude, longitude, classname); this.mapObj.addMarker(latitude, longitude, classname);
this.mapObj.animateMapIn(latitude, longitude, (accurate ? 13 : 10)); var zoomlevel = 10;
if (accurate) {
zoomlevel = 13;
}
if (countrylevel) {
zoomlevel = 4;
}
this.mapObj.animateMapIn(latitude, longitude, zoomlevel);
} }
loadMarkersFromGeoJson(geojson, iconname, name) { loadMarkersFromGeoJson(geojson, iconname, name) {

@ -193,7 +193,8 @@ function trackOpenAsync( {to, resolve, reject}) {
enabled: (typeof resp.info.latitude == "number" && typeof resp.info.longitude == "number" && MapControl.supported()), enabled: (typeof resp.info.latitude == "number" && typeof resp.info.longitude == "number" && MapControl.supported()),
latitude: resp.info.latitude, latitude: resp.info.latitude,
longitude: resp.info.longitude, longitude: resp.info.longitude,
accurate: resp.info.geoaccurate accurate: resp.info.geoaccurate,
geoiscountrylevel: (typeof resp.info.geoiscountrylevel == "undefined" ? false : resp.info.geoiscountrylevel)
} }
}; };
if (resp.info.statustext) { if (resp.info.statustext) {

@ -44,7 +44,7 @@
<script src="node_modules/template7/dist/template7.min.js"></script> <script src="node_modules/template7/dist/template7.min.js"></script>
<script src="node_modules/jquery/dist/jquery.min.js"></script> <script src="node_modules/jquery/dist/jquery.min.js"></script>
<script src="node_modules/maplibre-gl/dist/maplibre-gl.js"></script> <script src="node_modules/maplibre-gl/dist/maplibre-gl.js"></script>
<script src="node_modules/bwip-js/dist/bwip-js-min.js"></script> <script src="node_modules/bwip-js/dist/bwip-js-min.js"></script>
<script src="assets/js/qrcode.min.js"></script> <script src="assets/js/qrcode.min.js"></script>
<script src="assets/js/bitcore-lib.min.js"></script> <script src="assets/js/bitcore-lib.min.js"></script>
<script src="assets/js/bitcore-lib-doge.min.js"></script> <script src="assets/js/bitcore-lib-doge.min.js"></script>
@ -72,6 +72,7 @@
<script src="assets/js/serviceareamap.js"></script> <script src="assets/js/serviceareamap.js"></script>
<script src="assets/js/moneyorder.js"></script> <script src="assets/js/moneyorder.js"></script>
<script src="assets/js/address_qrcode.js"></script> <script src="assets/js/address_qrcode.js"></script>
<script src="assets/js/labelmaker.js"></script>
<script src="routes.js"></script> <script src="routes.js"></script>
<script src="assets/js/main.js"></script> <script src="assets/js/main.js"></script>

@ -30,7 +30,7 @@
{{#if map.enabled}} {{#if map.enabled}}
<div class="col-100 large-50 xlarge-50"> <div class="col-100 large-50 xlarge-50">
<div class="no-margin-vertical-md tablet-inset elevation-tablet display-flex align-items-stretch" id="trackMapContainer"> <div class="no-margin-vertical-md tablet-inset elevation-tablet display-flex align-items-stretch" id="trackMapContainer">
<div class="mapbox" style="width: 100%; height: 100%;" id="mapbox-track" data-latitude="{{map.latitude}}" data-longitude="{{map.longitude}}" data-accurate="{{map.accurate}}"></div> <div class="mapbox" style="width: 100%; height: 100%;" id="mapbox-track" data-latitude="{{map.latitude}}" data-longitude="{{map.longitude}}" data-accurate="{{map.accurate}}" data-geoiscountrylevel="{{map.geoiscountrylevel}}"></div>
</div> </div>
</div> </div>
{{/if}} {{/if}}

@ -23,6 +23,7 @@ var pagesToCompile = [
"shop", "shop",
"shoppingcart_fragment", "shoppingcart_fragment",
"rateresult", "rateresult",
// "labelrateresult",
"crypto", "crypto",
"crypto_wallet", "crypto_wallet",
"account", "account",
@ -205,11 +206,17 @@ var routes = [
resolve({ resolve({
content: compiledPages.send({ content: compiledPages.send({
pages: [ pages: [
// {
// title: "From My Phone",
// href: "/labelmaker",
// icon: "fa-duotone fa-mobile-alt",
// text: "Send USPS Flat Rate packages from your phone. Printer optional."
// },
{ {
title: "Use a Drop Box", title: "From a Drop Box",
href: "/dropandsend", href: "/dropandsend",
icon: "fa-duotone fa-box-alt", icon: "fa-duotone fa-box-alt",
text: "Bring your package to a Drop and Send location and we'll ship it for you. No postage or appointment needed." text: "Bring your package to a Drop and Send drop box or kiosk and we'll ship it for you. No postage or appointment needed."
}, },
{ {
title: "Request a Pickup", title: "Request a Pickup",
@ -224,7 +231,7 @@ var routes = [
text: "Our Mobile Shipping Center roams the Helena area like a food truck for mail. Find dates and places here." text: "Our Mobile Shipping Center roams the Helena area like a food truck for mail. Find dates and places here."
}, },
{ {
title: "Book an Appointment", title: "By Appointment",
href: "/appointment/shipping", href: "/appointment/shipping",
icon: "fa-duotone fa-calendar-alt", icon: "fa-duotone fa-calendar-alt",
text: "A courier will come to you on your schedule. No account required." text: "A courier will come to you on your schedule. No account required."
@ -307,7 +314,7 @@ var routes = [
} }
} }
}, },
{ {
path: '/quicksend', path: '/quicksend',
content: compiledPages.address_qrcode(), content: compiledPages.address_qrcode(),
name: 'quicksend' name: 'quicksend'
@ -512,6 +519,25 @@ var routes = [
} }
} }
}, },
// {
// path: '/labelmaker',
// url: './pages/labelmaker.html',
// name: 'labelmaker',
// on: {
// pageBeforeIn: function () {
// checkIfAccountGoodWithPaymentMethod(function (ok) {
// if (!ok) {
// $("#addPaymentMethodNag").css("display", "");
// }
// }, function (error) {
// $("#addPaymentMethodNag").css("display", "");
// });
// },
// pageAfterIn: function () {
// initLabelMakerForm();
// }
// }
// },
{ {
path: '/account', path: '/account',
name: 'account', name: 'account',
@ -534,7 +560,8 @@ var routes = [
var latitude = $(mapboxel).data("latitude"); var latitude = $(mapboxel).data("latitude");
var longitude = $(mapboxel).data("longitude"); var longitude = $(mapboxel).data("longitude");
var accurate = $(mapboxel).data("accurate") == true; var accurate = $(mapboxel).data("accurate") == true;
trackingMap.clearMarkersAndCenterMapOnNewMarker("package-marker", latitude, longitude, accurate); var geoiscountrylevel = $(mapboxel).data("geoiscountrylevel") == true;
trackingMap.clearMarkersAndCenterMapOnNewMarker("package-marker", latitude, longitude, accurate, geoiscountrylevel);
} }
} }
}, },

Loading…
Cancel
Save