Skip to content

Commit

Permalink
34.1.3
Browse files Browse the repository at this point in the history
### 🔧 Fixes
- Fixed markers being undraggable on mobile
- Fixed toasts not showing on mobile

### 🔥 Improvements
- Replaced Albasrah basemap with a better encoded version
- Damage radiuses option is now activated by default
  • Loading branch information
sh4rkman authored Dec 17, 2024
2 parents ec7c6a2 + 1d4e7aa commit cd1a240
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 73 deletions.
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
# <img src="https://img.shields.io/badge/-minor%20release-cd6f68?style=for-the-badge"> **34.1.2** *(2024-12-XX)*
# <img src="https://img.shields.io/badge/-minor%20release-cd6f68?style=for-the-badge"> **34.1.3** *(2024-12-17)*

<img src="https://img.shields.io/badge/-%20fix%20-b22"> Fixed markers being undraggable on mobile

<img src="https://img.shields.io/badge/-%20fix%20-b22"> Fixed toasts not showing on mobile

<img src="https://img.shields.io/badge/-%20improv%20-orange"> Replaced Albasrah basemap with a better encoded version

<img src="https://img.shields.io/badge/-%20improv%20-orange"> Damage radiuses option is now activated by default



</br></br><!-- CHANGELOG SPLIT MARKER -->


# <img src="https://img.shields.io/badge/-minor%20release-cd6f68?style=for-the-badge"> **34.1.2** *(2024-12-16)*

<img src="https://img.shields.io/badge/-%20fix%20-b22"> Hovering a flag while zooming in doesn't reveal hidden flags capzones anymore

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "squadcalc",
"version": "34.1.2",
"version": "34.1.3",
"description": "A Complete Mortar Calculator and Map Lane Finder for Squad",
"author": "Maxime 'sharkman' Boussard",
"license": "MIT",
Expand Down
Binary file modified public/maps/albasrah/basemap.webp
Binary file not shown.
Binary file removed src/img/github/basemap.webp
Binary file not shown.
Binary file removed src/img/github/terrainmap.webp
Binary file not shown.
Binary file removed src/img/github/topomap.webp
Binary file not shown.
59 changes: 26 additions & 33 deletions src/js/squadCalc.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,8 @@ export default class SquadCalc {
currentUrl.searchParams.delete("layer");
window.history.replaceState({}, "", currentUrl);

// Refresh layer selector if API is available
if (process.env.API_URL) { this.loadLayers(); }

// Refresh layer selector
this.loadLayers();
});

let abortController = null;
Expand Down Expand Up @@ -215,13 +214,7 @@ export default class SquadCalc {
currentUrl.searchParams.set("map", this.minimap.activeMap.name);
window.history.replaceState({}, "", currentUrl);

// If no API if provided, hide the layer selector
if (process.env.API_URL) {
this.loadLayers();
} else {
this.LAYER_SELECTOR.hide();
$(".btn-helpmap").hide();
}
this.loadLayers();

}

Expand Down Expand Up @@ -454,36 +447,36 @@ export default class SquadCalc {

});


let countdown;

const closeToast = () => {
document.querySelector("#toast").style.animation = "close 0.3s cubic-bezier(.87,-1,.57,.97) forwards";
document.querySelector("#timer").classList.remove("timer-animation");
clearTimeout(countdown);
};

this.openToast = (type, title, text) => {
const toast = document.querySelector("#toast");
clearTimeout(countdown);
toast.classList = [type];
toast.style.animation = "open 0.3s cubic-bezier(.47,.02,.44,2) forwards";
document.querySelector("#timer").classList.add("timer-animation");
toast.querySelector("h4").setAttribute("data-i18n", `tooltips:${title}`);
toast.querySelector("h4").innerHTML = i18next.t(`tooltips:${title}`);
toast.querySelector("p").setAttribute("data-i18n", `tooltips:${text}`);
toast.querySelector("p").innerHTML = i18next.t(`tooltips:${text}`);
countdown = setTimeout(() => { closeToast(); }, 5000);
};

document.querySelector("#toast").addEventListener("click", closeToast);

} else {
$(".btn-focus").hide();
$(".btn-snow").hide();
showSnow(false);
}

let countdown;

const closeToast = () => {
document.querySelector("#toast").style.animation = "close 0.3s cubic-bezier(.87,-1,.57,.97) forwards";
document.querySelector("#timer").classList.remove("timer-animation");
clearTimeout(countdown);
};

this.openToast = (type, title, text) => {
const toast = document.querySelector("#toast");
clearTimeout(countdown);
toast.classList = [type];
toast.style.animation = "open 0.3s cubic-bezier(.47,.02,.44,2) forwards";
document.querySelector("#timer").classList.add("timer-animation");
toast.querySelector("h4").setAttribute("data-i18n", `tooltips:${title}`);
toast.querySelector("h4").innerHTML = i18next.t(`tooltips:${title}`);
toast.querySelector("p").setAttribute("data-i18n", `tooltips:${text}`);
toast.querySelector("p").innerHTML = i18next.t(`tooltips:${text}`);
countdown = setTimeout(() => { closeToast(); }, 5000);
};

document.querySelector("#toast").addEventListener("click", closeToast);


weaponInformation.addEventListener("close", function(){
// Remove listeners when closing weapon information to avoid stacking
Expand Down
69 changes: 31 additions & 38 deletions src/js/squadMarker.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,13 @@ export var squadWeaponMarker = squadMarker.extend({

this.getIcon();

// Report marker to squadcalc API if API is configured
if (process.env.API_URL) {
sendMarkerData({
lat: this._latlng.lat,
lng: this._latlng.lng,
weapon: App.activeWeapon.name,
map: App.minimap.activeMap.name,
});
}
// Report marker to squadcalc API
sendMarkerData({
lat: this._latlng.lat,
lng: this._latlng.lng,
weapon: App.activeWeapon.name,
map: App.minimap.activeMap.name,
});

if (App.userSettings.realMaxRange) {
this.updateWeaponMaxRange(true);
Expand Down Expand Up @@ -434,16 +432,14 @@ export var squadWeaponMarker = squadMarker.extend({

this.map.updateTargets();

// Report marker to squadcalc API if API is configured
if (process.env.API_URL) {
sendMarkerData({
lat: this._latlng.lat,
lng: this._latlng.lng,
weapon: App.activeWeapon.name,
map: App.minimap.activeMap.name,
});
}

// Report marker to squadcalc API
sendMarkerData({
lat: this._latlng.lat,
lng: this._latlng.lng,
weapon: App.activeWeapon.name,
map: App.minimap.activeMap.name,
});

},

_handleMouseOver: function(){
Expand Down Expand Up @@ -580,15 +576,14 @@ export var squadTargetMarker = squadMarker.extend({
this.miniCircle = new CircleMarker(latlng, this.miniCircleOptions).addTo(this.map.markersGroup);
this.firingSolution1 = new SquadFiringSolution(this.map.activeWeaponsMarkers.getLayers()[0].getLatLng(), this.getLatLng(), this.map, this.map.activeWeaponsMarkers.getLayers()[0].heightPadding);

// Report target to squadcalc API if API is configured
if (process.env.API_URL) {
sendTargetData({
lat: latlng.lat,
lng: latlng.lng,
weapon: App.activeWeapon.name,
map: App.minimap.activeMap.name,
});
}
// Report target to squadcalc API
sendTargetData({
lat: latlng.lat,
lng: latlng.lng,
weapon: App.activeWeapon.name,
map: App.minimap.activeMap.name,
});


// Calc PopUps
this.calcMarker1 = new Popup(popUpOptions_weapon1).setLatLng(latlng).addTo(this.map.markersGroup);
Expand Down Expand Up @@ -1010,7 +1005,7 @@ export var squadTargetMarker = squadMarker.extend({
if (!App.hasMouse) {
this.calcMarker1.setContent(" ");
this.calcMarker2.setContent(" ");
this.spreadMarker2.disableSpreadRadii();
this.disableSpreadRadii();
this.disableDamageRadii();
}

Expand All @@ -1035,15 +1030,13 @@ export var squadTargetMarker = squadMarker.extend({
this.updateCalc();
this.updateIcon();

// Report target to squadcalc API if API is configured
if (process.env.API_URL) {
sendTargetData({
lat: e.target.getLatLng().lat,
lng: e.target.getLatLng().lng,
weapon: App.activeWeapon.name,
map: App.minimap.activeMap.name,
});
}
// Report target to squadcalc API
sendTargetData({
lat: e.target.getLatLng().lat,
lng: e.target.getLatLng().lng,
weapon: App.activeWeapon.name,
map: App.minimap.activeMap.name,
});
},

// Delete targetMarker on right clic
Expand Down

0 comments on commit cd1a240

Please sign in to comment.