Multiple small improvements and bugfixes

This commit is contained in:
Pax1601
2024-10-19 10:53:43 +02:00
parent 0c5139f5ee
commit 7fa39561e3
17 changed files with 133 additions and 70 deletions

View File

@@ -89,11 +89,8 @@ export var BoxSelect = Handler.extend({
_onMouseMove: function (e: any) {
if (!this._moved) {
this._moved = true;
this._box = DomUtil.create("div", "leaflet-zoom-box", this._container);
DomUtil.addClass(this._container, "leaflet-crosshair");
this._map.fire("boxzoomstart");
}
if (e.type === "touchmove") this._point = this._map.mouseEventToContainerPoint(e.touches[0]);
@@ -117,6 +114,7 @@ export var BoxSelect = Handler.extend({
DomUtil.enableTextSelection();
DomUtil.enableImageDrag();
this._map.dragging.enable();
this._forceBoxSelect = false;
DomEvent.off(
//@ts-ignore
@@ -149,7 +147,6 @@ export var BoxSelect = Handler.extend({
window.setTimeout(Util.bind(this._resetState, this), 0);
var bounds = new LatLngBounds(this._map.containerPointToLatLng(this._startPoint), this._map.containerPointToLatLng(this._point));
this._forceBoxSelect = false;
this._map.fire("selectionend", { selectionBounds: bounds });
},

View File

@@ -67,8 +67,10 @@ export class Map extends L.Map {
#mouseCooldownTimer: number = 0;
#shortPressTimer: number = 0;
#longPressTimer: number = 0;
#selecting: boolean = false;
/* Camera keyboard panning control */
// TODO add back
defaultPanDelta: number = 100;
#panInterval: number | null = null;
#panLeft: boolean = false;
@@ -80,6 +82,7 @@ export class Map extends L.Map {
#isShiftKeyDown: boolean = false;
/* Center on unit target */
// TODO add back
#centeredUnit: Unit | null = null;
/* Minimap */
@@ -721,6 +724,10 @@ export class Map extends L.Map {
return this.#centeredUnit;
}
isSelecting() {
return this.#selecting;
}
setTheatre(theatre: string) {
this.#theatre = theatre;
@@ -921,11 +928,14 @@ export class Map extends L.Map {
this.#isDragging = false;
}
#onSelectionStart(e: any) {}
#onSelectionStart(e: any) {
this.#selecting = true;
}
#onSelectionEnd(e: any) {
getApp().getUnitsManager().selectFromBounds(e.selectionBounds);
document.dispatchEvent(new CustomEvent("mapSelectionEnd"));
this.#selecting = false;
}
#onMouseUp(e: any) {
@@ -966,7 +976,6 @@ export class Map extends L.Map {
this.setState(COALITIONAREA_EDIT);
} else {
this.setState(IDLE);
document.dispatchEvent(new CustomEvent("hideAllMenus"));
}
}