barsa-novin-ray-core 2.3.35 → 2.3.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -14976,7 +14976,14 @@ class LeafletLongPressDirective {
|
|
|
14976
14976
|
this.longPress = new EventEmitter(); // latlng رو به بیرون میده
|
|
14977
14977
|
this.sub = new Subscription();
|
|
14978
14978
|
}
|
|
14979
|
-
ngOnInit() {
|
|
14979
|
+
ngOnInit() { }
|
|
14980
|
+
ngOnChanges(changes) {
|
|
14981
|
+
const { map } = changes;
|
|
14982
|
+
if (map && map.currentValue) {
|
|
14983
|
+
this._initMap();
|
|
14984
|
+
}
|
|
14985
|
+
}
|
|
14986
|
+
_initMap() {
|
|
14980
14987
|
if (!this.map) {
|
|
14981
14988
|
console.error('LeafletLongPressDirective: No map instance provided.');
|
|
14982
14989
|
return;
|
|
@@ -14990,7 +14997,27 @@ class LeafletLongPressDirective {
|
|
|
14990
14997
|
this.sub.add(longPress$.subscribe((startEvent) => {
|
|
14991
14998
|
const originalEvent = startEvent instanceof MouseEvent ? startEvent : startEvent.touches?.[0] || startEvent;
|
|
14992
14999
|
const latlng = this.map.mouseEventToLatLng(originalEvent);
|
|
14993
|
-
this.
|
|
15000
|
+
const point = this.map.mouseEventToContainerPoint(originalEvent);
|
|
15001
|
+
let markerData = null;
|
|
15002
|
+
let targetMarker = null;
|
|
15003
|
+
// پیدا کردن مارکری که این نقطه داخلش باشه
|
|
15004
|
+
this.map.eachLayer((layer) => {
|
|
15005
|
+
if (layer instanceof L.Marker) {
|
|
15006
|
+
const iconEl = layer.getElement();
|
|
15007
|
+
if (iconEl && iconEl.contains(originalEvent.target)) {
|
|
15008
|
+
targetMarker = layer;
|
|
15009
|
+
markerData = layer.options?.data ?? null;
|
|
15010
|
+
}
|
|
15011
|
+
}
|
|
15012
|
+
});
|
|
15013
|
+
this.longPress.emit({
|
|
15014
|
+
latlng, // مختصات جغرافیایی
|
|
15015
|
+
point, // مختصات پیکسلی داخل کانتینر
|
|
15016
|
+
x: point.x,
|
|
15017
|
+
y: point.y,
|
|
15018
|
+
marker: targetMarker || null,
|
|
15019
|
+
data: markerData
|
|
15020
|
+
});
|
|
14994
15021
|
}));
|
|
14995
15022
|
// جلوگیری از contextmenu پیشفرض موبایل (اختیاری)
|
|
14996
15023
|
container.addEventListener('contextmenu', (evt) => evt.preventDefault());
|
|
@@ -14999,7 +15026,7 @@ class LeafletLongPressDirective {
|
|
|
14999
15026
|
this.sub.unsubscribe();
|
|
15000
15027
|
}
|
|
15001
15028
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: LeafletLongPressDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
15002
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: LeafletLongPressDirective, isStandalone: false, selector: "[leafletLongPress]", inputs: { map: ["leafletLongPress", "map"], longPressDuration: "longPressDuration" }, outputs: { longPress: "longPress" }, ngImport: i0 }); }
|
|
15029
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.6", type: LeafletLongPressDirective, isStandalone: false, selector: "[leafletLongPress]", inputs: { map: ["leafletLongPress", "map"], longPressDuration: "longPressDuration" }, outputs: { longPress: "longPress" }, usesOnChanges: true, ngImport: i0 }); }
|
|
15003
15030
|
}
|
|
15004
15031
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: LeafletLongPressDirective, decorators: [{
|
|
15005
15032
|
type: Directive,
|