diff --git a/package.json b/package.json
index 7f60172bcb..259faeddb1 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "squadcalc",
- "version": "35.0.0",
+ "version": "35.1.0",
"description": "A Complete Mortar Calculator and Map Lane Finder for Squad",
"author": "Maxime 'sharkman' Boussard",
"license": "MIT",
diff --git a/public/locales/en/common.json b/public/locales/en/common.json
index 6016d01b08..7db45030d7 100644
--- a/public/locales/en/common.json
+++ b/public/locales/en/common.json
@@ -34,5 +34,6 @@
"invalidTarget": "Invalid Target",
"invalidMortarTarget": "Invalid Weapon & Target",
"targetOutOfRange": "Target is out of range",
- "layerPlaceholder": "Layer"
+ "layerPlaceholder": "Layer",
+ "nextFlags": "Next Flags"
}
\ No newline at end of file
diff --git a/public/locales/en/settings.json b/public/locales/en/settings.json
index 4133d90c3c..108916e4e9 100644
--- a/public/locales/en/settings.json
+++ b/public/locales/en/settings.json
@@ -24,6 +24,7 @@
"showSpread": "Spread Radius",
"showDamage": "Damage Radiuses",
"showAnimations": "Use Large Icons",
+ "copyTarget": "Auto-copy Target to clipboard",
"showBearing": "Bearing",
"showDistance": "Distance",
"showTimeOfFlight": "Time of Flight",
@@ -33,6 +34,7 @@
"capZoneOnHover": "Only show capzones when hovering",
"revealLayerOnHover" : "Reveal layer when hovering a flag",
"circlesFlags": "Show flag as circles",
+ "copyNextFlags": "Auto-copy next flags to clipboard",
"shortcuts": "Shortcuts",
"enter": "Enter focus mode, hiding UI buttons",
"deleteLastTarget": "Delete last placed target on the map",
diff --git a/public/locales/fr/common.json b/public/locales/fr/common.json
index f25c3af023..8ab43015cf 100644
--- a/public/locales/fr/common.json
+++ b/public/locales/fr/common.json
@@ -34,5 +34,6 @@
"invalidTarget": "Cible invalide",
"invalidMortarTarget": "Arme & Cible invalides",
"targetOutOfRange": "Cible hors de portée",
- "layerPlaceholder": "Layer"
+ "layerPlaceholder": "Layer",
+ "nextFlags": "Prochains points"
}
diff --git a/public/locales/ru/common.json b/public/locales/ru/common.json
index 87b9f8117f..19f952e7b4 100644
--- a/public/locales/ru/common.json
+++ b/public/locales/ru/common.json
@@ -34,6 +34,6 @@
"invalidTarget": "Неверная цель",
"invalidMortarTarget": "Инвалидное оружие и мишень",
"targetOutOfRange": "Цель находится вне зоны действия",
-
- "layerPlaceholder": "Layer"
+ "layerPlaceholder": "Layer",
+ "nextFlags": "Следующие флаги"
}
diff --git a/public/locales/uk/common.json b/public/locales/uk/common.json
index 74a2923f54..bffac20a3e 100644
--- a/public/locales/uk/common.json
+++ b/public/locales/uk/common.json
@@ -34,5 +34,6 @@
"invalidTarget": "Недійсна ціль",
"invalidMortarTarget": "Непридатна зброя та мішень",
"targetOutOfRange": "Ціль поза зоною досяжності",
- "layerPlaceholder": "Layer"
+ "layerPlaceholder": "Layer",
+ "nextFlags": "Наступні прапори"
}
diff --git a/public/locales/zh/common.json b/public/locales/zh/common.json
index aaccee5a2d..99c0bab79a 100644
--- a/public/locales/zh/common.json
+++ b/public/locales/zh/common.json
@@ -34,5 +34,6 @@
"invalidTarget": "无效的目标",
"invalidMortarTarget": "取消武器和目标",
"targetOutOfRange": "目标超出范围",
- "layerPlaceholder": "Layer"
+ "layerPlaceholder": "层",
+ "nextFlags": "下一个点"
}
diff --git a/src/components/dialogs/dialogs.scss b/src/components/dialogs/dialogs.scss
index c66273f70c..efdd4d8362 100644
--- a/src/components/dialogs/dialogs.scss
+++ b/src/components/dialogs/dialogs.scss
@@ -156,6 +156,10 @@ dialog {
h3 {
font-size: 1.3em;
}
+ h4 {
+ padding: 0 2.5em 0.5em;
+ font-size: 1.1em;
+ }
#fontSize {
width: 100%;
height: auto;
diff --git a/src/components/dialogs/settings.html b/src/components/dialogs/settings.html
index 4529f7ebd1..ce511349da 100644
--- a/src/components/dialogs/settings.html
+++ b/src/components/dialogs/settings.html
@@ -217,9 +217,9 @@
Preview
+
+
diff --git a/src/components/shared/_responsive.scss b/src/components/shared/_responsive.scss
index f1b2facbb0..18b7df1954 100644
--- a/src/components/shared/_responsive.scss
+++ b/src/components/shared/_responsive.scss
@@ -214,7 +214,7 @@
}
helpDialog {
font-size: 0.7em;
- height: 530px;
+ height: 550px;
width: 600px;
table {
width: 90%;
diff --git a/src/js/settings.js b/src/js/settings.js
index 3a4701fb80..4e8d55b202 100644
--- a/src/js/settings.js
+++ b/src/js/settings.js
@@ -65,7 +65,13 @@ export function loadSettings(){
dropdownParent: $("#helpDialog"),
minimumResultsForSearch: -1, // Disable search
});
- $(".dropbtn6").val(fontSize).trigger("change");;
+ $(".dropbtn6").val(fontSize).trigger("change");
+
+ App.userSettings.copyNextFlags = loadLocalSetting("settings-copy-next-flags", 0);
+ $("#copyNextFlagsSettings").prop("checked", App.userSettings.copyNextFlags);
+
+ App.userSettings.copyTarget = loadLocalSetting("settings-copy-target", 0);
+ $("#targetCopySetting").prop("checked", App.userSettings.copyTarget);
App.userSettings.circlesFlags = loadLocalSetting("settings-circles-flags");
$("#circlesFlagsSettings").prop("checked", App.userSettings.circlesFlags);
@@ -331,6 +337,18 @@ $("#realMaxRangeSettings").on("change", function() {
App.minimap.updateWeapons();
});
+$("#targetCopySetting").on("change", function() {
+ var val = $("#targetCopySetting").is(":checked");
+ App.userSettings.copyTarget = val;
+ localStorage.setItem("settings-copy-target", +val);
+});
+
+$("#copyNextFlagsSettings").on("change", function() {
+ var val = $("#copyNextFlagsSettings").is(":checked");
+ App.userSettings.copyNextFlags = val;
+ localStorage.setItem("settings-copy-next-flags", +val);
+});
+
$("#cursorChoiceSettings").on("change", function() {
var val = $("#cursorChoiceSettings").is(":checked");
App.userSettings.cursor = val;
diff --git a/src/js/squadLayer.js b/src/js/squadLayer.js
index b1a698085f..165dd9a949 100644
--- a/src/js/squadLayer.js
+++ b/src/js/squadLayer.js
@@ -2,6 +2,7 @@
import { DivIcon, Marker, Circle, LayerGroup, Polyline, Polygon, Rectangle, FeatureGroup } from "leaflet";
import { SquadObjective } from "./squadObjective.js";
import { App } from "../app.js";
+import i18next from "i18next";
export class SquadLayer {
@@ -703,21 +704,29 @@ export class SquadLayer {
console.debug("Flags next step :", nextFlags);
+
+ let nextFlagsNamesArray = [];
+
// Highlight the next flags with a proper class
nextFlags.forEach((flag) => {
flag.flag._icon.classList.add("next");
flag.flag.options.icon.options.className = "flag flag" + flag.position + " next";
flag.isNext = true;
+ nextFlagsNamesArray.push(flag.name);
});
+ // Copy the next flags names to the clipboard
+ if (App.userSettings.copyNextFlags) {
+ App.copy(i18next.t("common:nextFlags") + " : " + nextFlagsNamesArray.join("/"));
+ }
+
+
// Only one flag in front ? Click it
if (nextFlags.length === 1 && !backward && App.userSettings.autoLane){
this._handleFlagClick(nextFlags[0]);
}
-
}
-
/**
* Remove clusters that were not reachable from the previous position
* @param {Set} reachableClusters - Set of reachable clusters
diff --git a/src/js/squadMarker.js b/src/js/squadMarker.js
index cc3804cc14..9199b4bc8e 100644
--- a/src/js/squadMarker.js
+++ b/src/js/squadMarker.js
@@ -564,7 +564,6 @@ export var squadTargetMarker = squadMarker.extend({
this.addTo(this.map.activeTargetsMarkers);
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
sendTargetData({
lat: latlng.lat,
@@ -577,18 +576,23 @@ export var squadTargetMarker = squadMarker.extend({
// Calc PopUps
this.calcMarker1 = new Popup(popUpOptions_weapon1).setLatLng(latlng).addTo(this.map.markersGroup);
this.calcMarker2 = new Popup(popUpOptions_weapon2).setLatLng(latlng).addTo(this.map.markersGroup);
- this.updateCalcPopUps();
- this.calcMarker1.setContent(this.getContent(this.firingSolution1, this.map.activeWeaponsMarkers.getLayers()[0].angleType)).openOn(this.map);
-
// posPopUp
this.posPopUp = new Popup(this.posPopUpOptions).setLatLng(latlng).addTo(this.map.markersGroup).close();
+ this.updateCalcPopUps();
+
+ const [html1, clipboard1] = this.getContent(this.firingSolution1, this.map.activeWeaponsMarkers.getLayers()[0].angleType);
+ this.calcMarker1.setContent(html1).openOn(this.map);
+ if (App.userSettings.copyTarget) App.copy(clipboard1);
+
// If two weapons already on the map
if (this.map.activeWeaponsMarkers.getLayers().length === 2) {
weaponPos = this.map.activeWeaponsMarkers.getLayers()[1].getLatLng();
this.firingSolution2 = new SquadFiringSolution(weaponPos, this.getLatLng(), this.map, this.map.activeWeaponsMarkers.getLayers()[1].heightPadding);
- this.calcMarker1.setContent(`1. ${this.getContent(this.firingSolution1, this.map.activeWeaponsMarkers.getLayers()[0].angleType)}`);
- this.calcMarker2.setContent(`2. ${this.getContent(this.firingSolution2, this.map.activeWeaponsMarkers.getLayers()[1].angleType)}`).openOn(this.map);
+ this.calcMarker1.setContent(`1. ${html1}`);
+ const [html2, clipboard2] = this.getContent(this.firingSolution2, this.map.activeWeaponsMarkers.getLayers()[1].angleType);
+ this.calcMarker2.setContent(`2. ${html2}`).openOn(this.map);
+ if (App.userSettings.copyTarget) App.copy(`${clipboard1} / ${clipboard2}`);
}
// Initiate Spread Ellipse
@@ -727,7 +731,8 @@ export var squadTargetMarker = squadMarker.extend({
content += `
${heightDiff}${i18next.t("common:m")}`;
}
- return content;
+ return [content, `${i18next.t("common:elevation")}: ${elevation} - ${i18next.t("common:bearing")}: ${BEARING.toFixed(1)}°`];
+
},
@@ -855,20 +860,26 @@ export var squadTargetMarker = squadMarker.extend({
/*
* Update target calculationPopups according to it's firing solutions
*/
- updateCalc: function(){
+ updateCalc: function(copy = false){
+ var clipboard;
this.firingSolution1 = new SquadFiringSolution(this.map.activeWeaponsMarkers.getLayers()[0].getLatLng(), this.getLatLng(), this.map, this.map.activeWeaponsMarkers.getLayers()[0].heightPadding);
- this.calcMarker1.setContent(this.getContent(this.firingSolution1, this.map.activeWeaponsMarkers.getLayers()[0].angleType));
+ const [html1, clipboard1] = this.getContent(this.firingSolution1, this.map.activeWeaponsMarkers.getLayers()[0].angleType);
+ this.calcMarker1.setContent(html1);
+ clipboard = clipboard1;
if (this.map.activeWeaponsMarkers.getLayers().length === 2) {
this.firingSolution2 = new SquadFiringSolution(this.map.activeWeaponsMarkers.getLayers()[1].getLatLng(), this.getLatLng(), this.map, this.map.activeWeaponsMarkers.getLayers()[1].heightPadding);
- this.calcMarker1.setContent(`1. ${this.getContent(this.firingSolution1, this.map.activeWeaponsMarkers.getLayers()[0].angleType)}`);
- this.calcMarker2.setContent(`2. ${this.getContent(this.firingSolution2, this.map.activeWeaponsMarkers.getLayers()[1].angleType)}`).openOn(this.map);
+ const [html2, clipboard2] = this.getContent(this.firingSolution2, this.map.activeWeaponsMarkers.getLayers()[1].angleType);
+ this.calcMarker1.setContent(`1. ${html1}`);
+ this.calcMarker2.setContent(`2. ${html2}`).openOn(this.map);
+ clipboard = `1. ${clipboard} / 2. ${clipboard2}`;
} else {
this.calcMarker2.close();
}
this.updateSpread();
this.updateDamageRadius();
+ if (copy && App.userSettings.copyTarget) { App.copy(clipboard); }
},
@@ -999,9 +1010,7 @@ export var squadTargetMarker = squadMarker.extend({
// Hide stuff, do a final update and send data to API
_handleDragEnd: function (e) {
- if (App.userSettings.keypadUnderCursor){
- this.map.on("mousemove", this.map._handleMouseMove);
- }
+ if (App.userSettings.keypadUnderCursor) this.map.on("mousemove", this.map._handleMouseMove);
// Hide PositionPopUp & MiniCircle
this.isDragging = false;
@@ -1009,7 +1018,7 @@ export var squadTargetMarker = squadMarker.extend({
this.miniCircle.setStyle({opacity: 0});
// update one last time when drag end
- this.updateCalc();
+ this.updateCalc(true);
this.updateIcon();
// Report target to squadcalc API
diff --git a/src/js/squadMinimap.js b/src/js/squadMinimap.js
index 4c3763b889..93b0ed1e5e 100644
--- a/src/js/squadMinimap.js
+++ b/src/js/squadMinimap.js
@@ -217,7 +217,7 @@ export var squadMinimap = Map.extend({
updateTargets: function(){
// Update existent targets
this.activeTargetsMarkers.eachLayer(function (target) {
- target.updateCalc(target.latlng);
+ target.updateCalc(true);
target.updateIcon();
});
},
diff --git a/src/js/tooltips.js b/src/js/tooltips.js
index 824d8894b6..48d9794a0b 100644
--- a/src/js/tooltips.js
+++ b/src/js/tooltips.js
@@ -11,12 +11,13 @@ const helpDialog = document.querySelector("#helpDialog");
const commonToolipsSettings = {
animation: "fade",
placement: "right",
+ offset: [0, 20],
allowHTML: true,
touch: false,
theme: "settingsTooltips",
hideOnClick: true,
delay: 50,
- maxWidth: 200,
+ maxWidth: 200,
appendTo: helpDialog,
};
@@ -97,6 +98,26 @@ tippy("span[data-i18n='settings:realMaxRange']", {
},
});
+tippy("span[data-i18n='settings:copyNextFlags']", {
+ ...commonToolipsSettings,
+ onShow(tip) {
+ tip.setContent(`
+ ${i18next.t("tooltips:showMaxRangeTooltip")}
+ `);
+ },
+});
+
+tippy("span[data-i18n='settings:copyTarget']", {
+ ...commonToolipsSettings,
+ onShow(tip) {
+ tip.setContent(`
+ ${i18next.t("tooltips:showMaxRangeTooltip")}
+ `);
+ },
+});
+
+
+
tippy("#bearingNum", {
animation: "fade",
placement: "bottom",