Commit 724b6c5247c97e661b104985fbb5956c88fae0dc

Authored by Vladyslav_Prykhodko
Committed by Kalutka Zhenya
1 parent 60de8901

Refactoring

... ... @@ -413,11 +413,11 @@ export default abstract class LeafletMap {
413 413 }
414 414
415 415 convertToCustomFormat(position: L.LatLng): object {
416   - if(position.lng > 180){
  416 + if (position.lng > 180) {
417 417 position.lng = 180;
418   - }else if(position.lng < -180){
  418 + } else if (position.lng < -180) {
419 419 position.lng = -180;
420   - };
  420 + }
421 421 return {
422 422 [this.options.latKeyName]: position.lat,
423 423 [this.options.lngKeyName]: position.lng
... ...
... ... @@ -94,7 +94,7 @@ export class Marker {
94 94 }
95 95
96 96 updateMarkerPosition(position: L.LatLng) {
97   - if (!this.location.equals(position)) {
  97 + if (!this.leafletMarker.getLatLng().equals(position)) {
98 98 this.location = position;
99 99 this.leafletMarker.setLatLng(position);
100 100 }
... ...
... ... @@ -258,29 +258,28 @@ export class ImageMap extends LeafletMap {
258 258 }
259 259
260 260 convertToCustomFormat(position: L.LatLng, width = this.width, height = this.height): object {
261   - let point = this.latLngToPoint(position);
  261 + const point = this.latLngToPoint(position);
262 262 const customX = calculateNewPointCoordinate(point.x, width);
263 263 const customY = calculateNewPointCoordinate(point.y, height);
264 264
265   - if(customX === 0){
  265 + if (customX === 0) {
266 266 point.x = 0;
267   - } else if(customX === 1){
  267 + } else if (customX === 1) {
268 268 point.x = width;
269 269 }
270 270
271   - if(customY === 0){
  271 + if (customY === 0) {
272 272 point.y = 0;
273   - } else if(customY === 1){
  273 + } else if (customY === 1) {
274 274 point.y = height;
275 275 }
276   -
277   - const customLatLng = this.pointToLatLng(point.x,point.y)
  276 + const customLatLng = this.pointToLatLng(point.x, point.y);
278 277
279 278 return {
280 279 [this.options.xPosKeyName]: customX,
281 280 [this.options.yPosKeyName]: customY,
282   - [this.options.latKeyName]:customLatLng.lat,
283   - [this.options.lngKeyName]:customLatLng.lng
  281 + [this.options.latKeyName]: customLatLng.lat,
  282 + [this.options.lngKeyName]: customLatLng.lng
284 283 };
285 284 }
286 285
... ...