Refactoring
This commit is contained in:
parent
60de89015a
commit
724b6c5247
@ -417,7 +417,7 @@ export default abstract class LeafletMap {
|
|||||||
position.lng = 180;
|
position.lng = 180;
|
||||||
} else if (position.lng < -180) {
|
} else if (position.lng < -180) {
|
||||||
position.lng = -180;
|
position.lng = -180;
|
||||||
};
|
}
|
||||||
return {
|
return {
|
||||||
[this.options.latKeyName]: position.lat,
|
[this.options.latKeyName]: position.lat,
|
||||||
[this.options.lngKeyName]: position.lng
|
[this.options.lngKeyName]: position.lng
|
||||||
|
|||||||
@ -94,7 +94,7 @@ export class Marker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateMarkerPosition(position: L.LatLng) {
|
updateMarkerPosition(position: L.LatLng) {
|
||||||
if (!this.location.equals(position)) {
|
if (!this.leafletMarker.getLatLng().equals(position)) {
|
||||||
this.location = position;
|
this.location = position;
|
||||||
this.leafletMarker.setLatLng(position);
|
this.leafletMarker.setLatLng(position);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -258,7 +258,7 @@ export class ImageMap extends LeafletMap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
convertToCustomFormat(position: L.LatLng, width = this.width, height = this.height): object {
|
convertToCustomFormat(position: L.LatLng, width = this.width, height = this.height): object {
|
||||||
let point = this.latLngToPoint(position);
|
const point = this.latLngToPoint(position);
|
||||||
const customX = calculateNewPointCoordinate(point.x, width);
|
const customX = calculateNewPointCoordinate(point.x, width);
|
||||||
const customY = calculateNewPointCoordinate(point.y, height);
|
const customY = calculateNewPointCoordinate(point.y, height);
|
||||||
|
|
||||||
@ -273,8 +273,7 @@ export class ImageMap extends LeafletMap {
|
|||||||
} else if (customY === 1) {
|
} else if (customY === 1) {
|
||||||
point.y = height;
|
point.y = height;
|
||||||
}
|
}
|
||||||
|
const customLatLng = this.pointToLatLng(point.x, point.y);
|
||||||
const customLatLng = this.pointToLatLng(point.x,point.y)
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
[this.options.xPosKeyName]: customX,
|
[this.options.xPosKeyName]: customX,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user